winning ends game now
This commit is contained in:
parent
bfcd8f8761
commit
90218f1af2
|
|
@ -42,9 +42,6 @@ namespace ProjectGrid
|
||||||
if (_state != State.GAME_OVER)
|
if (_state != State.GAME_OVER)
|
||||||
{
|
{
|
||||||
_board.SetFieldValue(_currentPlayer, move.Field);
|
_board.SetFieldValue(_currentPlayer, move.Field);
|
||||||
// switch between 1 and 2
|
|
||||||
_currentPlayer = 3 - _currentPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
response.Winning = _board.ValueWon(_currentPlayer);
|
response.Winning = _board.ValueWon(_currentPlayer);
|
||||||
if (_currentPlayer > 0 && response.Winning != null)
|
if (_currentPlayer > 0 && response.Winning != null)
|
||||||
|
|
@ -52,11 +49,16 @@ namespace ProjectGrid
|
||||||
response.PlayerWon = _currentPlayer;
|
response.PlayerWon = _currentPlayer;
|
||||||
_state = State.GAME_OVER;
|
_state = State.GAME_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// switch between 1 and 2
|
||||||
|
_currentPlayer = 3 - _currentPlayer;
|
||||||
|
}
|
||||||
response.Board = _board.Field;
|
response.Board = _board.Field;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
_currentPlayer = new Random().Next(1, 2);
|
_currentPlayer = new Random().Next(1, 2);
|
||||||
|
|
@ -64,6 +66,7 @@ namespace ProjectGrid
|
||||||
_state = State.PLAYING;
|
_state = State.PLAYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public TicTacTocResponse GetBoard()
|
public TicTacTocResponse GetBoard()
|
||||||
{
|
{
|
||||||
TicTacTocResponse response = new TicTacTocResponse();
|
TicTacTocResponse response = new TicTacTocResponse();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue