Difference between revisions of "Location"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(The code)
Line 2: Line 2:
 
<tabber>
 
<tabber>
 
CSharp
 
CSharp
|-|
+
 
 
<syntaxhighlight lang="csharp" line>
 
<syntaxhighlight lang="csharp" line>
 
   class Location
 
   class Location
Line 18: Line 18:
 
|-|
 
|-|
 
VB
 
VB
|-|
+
 
 
</tabber>
 
</tabber>
 +
 
=Explanation=
 
=Explanation=
 
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.

Revision as of 23:18, 30 November 2016

The code

"csharp" line> class Location { public Fox Fox; public Warren Warren; public Location() { Fox = null; Warren = null; } } </syntaxhighlight>

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.