public Coordinate[,] getUpperScreenFromOpponent(LowerScreen screen) { UpperScreen tempScreen = new UpperScreen(debugMode); for (int j = 0; j < tempScreen.screen.GetLength(1); j++) { for (int i = 0; i < tempScreen.screen.GetLength(0); i++) { tempScreen.screen[i, j] = screen.screen[i, j]; } } return(tempScreen.screen); }
void getCounts(LowerScreen ls) { List <Coordinate> listOfCoordinatesFromSunkShips = new List <Coordinate>(); listofOpponentsSunkShips.ForEach(delegate(Ship ship) { foreach (KeyValuePair <Coordinate, bool> coord in ship.isHitDictionary) { listOfCoordinatesFromSunkShips.Add(coord.Key); } }); for (int j = 0; j < 10; j++) { for (int i = 0; i < 10; i++) { heatmap[i, j].count = 0; } } foreach (Ship ship in ls.Ships) { if (shipIsAlive(ship)) { for (int j = 0; j < 10; j++) { for (int i = 0; i < 10; i++) { countShipFitHorizontal(ship, i, j, listOfCoordinatesFromSunkShips); countShipFitVertical(ship, i, j, listOfCoordinatesFromSunkShips); } } } } for (int j = 0; j < 10; j++) { for (int i = 0; i < 10; i++) { if (hitOrMissScreen[i, j] == "H") { heatmap[i, j].count = 0; } if (hitOrMissScreen[i, j] == "M") { heatmap[i, j].count = 0; } } } }
public void updateHeatMap(LowerScreen ls) { getCounts(ls); printCounts(); }
public Board(bool dm) { upperScreen = new UpperScreen(dm); lowerScreen = new LowerScreen(dm); }