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; }
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; } } }
public GameSimulator(BoardState.Cell player) { this.CurrentPlayer = player; this.state = new BoardState(); }