public BoardModel(int xSize, int ySize) { XSize = xSize; YSize = ySize; Locations = new StateValue[XSize,YSize]; for (int x = 0; x < XSize; x++) { for (int y = 0; y < YSize; y++) { Locations[x, y] = new StateValue() { X = x, Y = y, State = LocationState.U }; } } }
public void TakeTurn(int x, int y) { SetLocation(x, y, (CurrentPlayer == Player.X ? LocationState.X : LocationState.O)); _currentPlayer = (CurrentPlayer == Player.X ? Player.O : Player.X); LastPlay = GetLocation(x, y); LastPlayer = (CurrentPlayer == Player.X ? Player.O : Player.X); TurnTaken(this); }