Location

From TRCCompSci - AQA Computer Science
Revision as of 22:16, 30 November 2016 by Admin (talk | contribs)
Jump to: navigation, search

The code

CSharp

 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   }
tab2=VB

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.