Exemplo n.º 1
0
 public static void Player2Turn()
 {
     if (Player1Board1[x_coord][y_coord] == BoardSquareState.Ship)
     {
         Player2Board2[x_coord][y_coord] = BoardSquareState.Hit;
         Player1Board1[x_coord][y_coord] = BoardSquareState.Hit;
         hitMiss = BoardSquareState.Hit;
     }
     else if (Player1Board1[x_coord][y_coord] == BoardSquareState.Empty)
     {
         Player2Board2[x_coord][y_coord] = BoardSquareState.Miss;
         Player1Board1[x_coord][y_coord] = BoardSquareState.Miss;
         hitMiss = BoardSquareState.Miss;
     }
 }
Exemplo n.º 2
0
 public void Player2Turn()
 {
     //x_coord = Int32.Parse(hitCoordinates.Substring(0, 1));
     //y_coord = Int32.Parse(hitCoordinates.Substring(1, 1));
     if (Player1Board1[x_coord][y_coord] == BoardSquareState.Ship)
     {
         Player2Board2[x_coord][y_coord] = BoardSquareState.Hit;
         Player1Board1[x_coord][y_coord] = BoardSquareState.Hit;
         hitOrMiss = BoardSquareState.Hit;
     }
     else if (Player1Board1[x_coord][y_coord] == BoardSquareState.Empty)
     {
         Player2Board2[x_coord][y_coord] = BoardSquareState.Miss;
         Player1Board1[x_coord][y_coord] = BoardSquareState.Miss;
         hitOrMiss = BoardSquareState.Miss;
     }
 }
Exemplo n.º 3
0
        public string GetBoardSquareStateSymbol(BoardSquareState state)
        {
            switch (state)
            {
            case BoardSquareState.Empty: return("~");

            case BoardSquareState.Unknown: return("~");

            case BoardSquareState.Ship: return("S");

            case BoardSquareState.Hit: return("X");

            case BoardSquareState.Miss: return("0");


            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }
        }