diff --git a/Logic/TicTacTocManager.cs b/Logic/TicTacTocManager.cs index 1c84386..bcecd00 100644 --- a/Logic/TicTacTocManager.cs +++ b/Logic/TicTacTocManager.cs @@ -42,21 +42,23 @@ namespace ProjectGrid if (_state != State.GAME_OVER) { _board.SetFieldValue(_currentPlayer, move.Field); + + response.Winning = _board.ValueWon(_currentPlayer); + if (_currentPlayer > 0 && response.Winning != null) + { + response.PlayerWon = _currentPlayer; + _state = State.GAME_OVER; + } + // switch between 1 and 2 _currentPlayer = 3 - _currentPlayer; } - - response.Winning = _board.ValueWon(_currentPlayer); - if (_currentPlayer > 0 && response.Winning != null) - { - response.PlayerWon = _currentPlayer; - _state = State.GAME_OVER; - } response.Board = _board.Field; return response; } + public void Restart() { _currentPlayer = new Random().Next(1, 2); @@ -64,6 +66,7 @@ namespace ProjectGrid _state = State.PLAYING; } + public TicTacTocResponse GetBoard() { TicTacTocResponse response = new TicTacTocResponse();