public Cell Move()
 {
     Cell newLocation = currentLocation.CellColour == Color.White ?
     Turn90DegreesRight(currentLocation) :
     Turn90DegreesLeft(currentLocation);
       currentLocation = newLocation;
       CellGraphic = new Rectangle(currentLocation.X * Width, currentLocation.Y * Height, Width, Height);
       return newLocation;
 }
 public World(int aSize, int cellWidth, int cellHeight)
 {
     size = aSize;
       cells = new Cell[size, size];
       for (int i = 0; i < size; i++) {
     for (int j = 0; j < size; j++) {
       cells[i, j] = new Cell(i, j, cellWidth, cellHeight);
     }
       }
       for (int i = 0; i < size; i++) {
     for (int j = 0; j < size; j++) {
       cells[i, j].NorthCell = i == 0 ? cells[size - 1, j] : cells[i - 1, j];
       cells[i, j].SouthCell = i == size - 1 ? cells[0, j] : cells[i + 1, j];
       cells[i, j].EastCell = j == 0 ? cells[i, size - 1] : cells[i, j - 1];
       cells[i, j].WestCell = j == size - 1 ? cells[i, 0] : cells[i, j + 1];
     }
       }
       ant = new Ant(size / 2, size / 2, cellWidth, cellHeight, cells[size / 2, size / 2]);
 }
 private Cell Turn90DegreesRight(Cell currentLocation)
 {
     Cell newLocation = null;
       currentLocation.CellColour = Color.Black;
       if (forwardDirection == currentLocation.NorthCell) {
     newLocation = currentLocation.WestCell;
     forwardDirection = newLocation.WestCell;
       }
       else if (forwardDirection == currentLocation.SouthCell) {
     newLocation = currentLocation.EastCell;
     forwardDirection = newLocation.EastCell;
       }
       else if (forwardDirection == currentLocation.EastCell) {
     newLocation = currentLocation.NorthCell;
     forwardDirection = newLocation.NorthCell;
       }
       else if (forwardDirection == currentLocation.WestCell) {
     newLocation = currentLocation.SouthCell;
     forwardDirection = newLocation.SouthCell;
       }
       return newLocation;
 }
 public Ant(int xPos, int yPos, int aWidth, int aHeight, Cell startLocation)
     : base(xPos, yPos, aWidth, aHeight)
 {
     currentLocation = startLocation;
       forwardDirection = currentLocation.NorthCell;
 }