public bool update() { c1.board.upperScreen.listofOpponentsSunkShips = testBoard.lowerScreen.getListofDeadShips(); c1.board.upperScreen.updateHeatMap(testBoard.lowerScreen); c1.turn(testBoard, false); if (c1.CheckWin(testBoard.lowerScreen.Ships)) { return(true); } return(false); }
public bool update(bool isHumanFirst, bool debugMode) { if (isHumanFirst) { player.turn(computerPlayer.board, debugMode); if (player.CheckWin(computerPlayer.board.lowerScreen.Ships)) { Console.WriteLine("Congratulations You Win"); return(true); } computerPlayer.board.upperScreen.listofOpponentsSunkShips = player.board.lowerScreen.getListofDeadShips(); computerPlayer.board.upperScreen.updateHeatMap(player.board.lowerScreen); computerPlayer.turn(player.board, debugMode); if (computerPlayer.CheckWin(player.board.lowerScreen.Ships)) { Console.WriteLine("The Computer wins"); return(true); } } else { computerPlayer.board.upperScreen.listofOpponentsSunkShips = player.board.lowerScreen.getListofDeadShips(); computerPlayer.board.upperScreen.updateHeatMap(player.board.lowerScreen); computerPlayer.turn(player.board, debugMode); computerPlayer.turn(player.board, debugMode); if (computerPlayer.CheckWin(player.board.lowerScreen.Ships)) { Console.WriteLine("The Computer wins"); return(true); } player.turn(computerPlayer.board, debugMode); if (player.CheckWin(computerPlayer.board.lowerScreen.Ships)) { Console.WriteLine("Congratulations You Win"); return(true); } } return(false); }