Пример #1
0
 public void Move(int x, int y)
 {
     if (state.Board[x, y] != Cell.Empty)
     {
         throw new Exception("La celda ya estaba ocupada");
     }
     state = state.Play(new BoardState.Move(x, y, CurrentPlayer));
     this.CurrentPlayer = this.CurrentPlayer == BoardState.Cell.O ? BoardState.Cell.X : BoardState.Cell.O;
 }
Пример #2
0
    void UpdateTabuleiro()
    {
        for (int i = 0; i < 9; i++)
        {
            BoardState.Cell oneCell = this.myState.getCellValue(i);
            switch (oneCell)
            {
            case BoardState.Cell.Empty:
                this.texts[i].text = "-";
                break;

            case BoardState.Cell.Player1:
                this.texts[i].text = "X";
                break;

            case BoardState.Cell.Player2:
                this.texts[i].text = "O";
                break;
            }
        }
    }
Пример #3
0
 public GameSimulator(BoardState.Cell player)
 {
     this.CurrentPlayer = player;
     this.state         = new BoardState();
 }