Difference between revisions of "Location"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Explanation)
m (The code: Removed not needed VB code.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==The code==
 
==The code==
<tabber>
 
C#=
 
 
<syntaxhighlight lang="csharp" line>
 
<syntaxhighlight lang="csharp" line>
 
   class Location
 
   class Location
Line 15: Line 13:
 
   }
 
   }
 
</syntaxhighlight>
 
</syntaxhighlight>
|-|
 
VB=
 
<syntaxhighlight lang="vbnet" line>
 
 
</syntaxhighlight>
 
</tabber>
 
  
 
=Explanation=
 
=Explanation=
The lord shulk has really appreciated the skeleton program.
 
 
A location has 2 data items within the class, a Fox called Fox and a Warren called Warren.
 
A location has 2 data items within the class, a Fox called Fox and a Warren called Warren.
  
 
When the location is created both are set to null, this means they are empty. So each location could store only one Warren and one Fox. This class is used for each square of the grid (2d Array) called Landscape generated in the simulation class.
 
When the location is created both are set to null, this means they are empty. So each location could store only one Warren and one Fox. This class is used for each square of the grid (2d Array) called Landscape generated in the simulation class.

Latest revision as of 15:59, 16 December 2016

The code

 1   class Location
 2   {
 3     public Fox Fox;
 4     public Warren Warren;
 5  
 6     public Location()
 7     {
 8       Fox = null;
 9       Warren = null;
10     }
11   }

Explanation

A location has 2 data items within the class, a Fox called Fox and a Warren called Warren.

When the location is created both are set to null, this means they are empty. So each location could store only one Warren and one Fox. This class is used for each square of the grid (2d Array) called Landscape generated in the simulation class.