private string GetStatusImpl(TicTacToeGameBasic game) { if (game.IsWin) { var winner = "You "; if ((_isMachineFirst && game.AllGamePlays.Count%2 != 0) || (!_isMachineFirst && game.AllGamePlays.Count%2 == 0) ) { winner = "Machine "; } return winner + "Win!"; } if (game.IsTie) { return "Tie!"; } return String.Empty; }
public string GetStatus(int nextPlay) { int? t=null; if (!string.IsNullOrEmpty( _stateToken)) t = int.Parse(_stateToken); var game = new TicTacToeGameBasic(t, nextPlay ); return GetStatusImpl(game); }
public string GetStatus() { var game = new TicTacToeGameBasic (int.Parse( _stateToken)); return GetStatusImpl(game); }