private void NewGame() { p1 = new HumanPlayerGUI_WF(this); p2 = new HumanPlayerGUI_WF(this); game = new TicTacToe.Game(p1, p2); UpdateSymbols(); }
public void GameState_Matches_Success() { var game1 = new TicTacToe.Game(); game1.CurrentBoard.Add(UserType.EndUser, 1, 1) .Add(UserType.Machine, 2, 2); var game2 = new TicTacToe.Game(); game2.CurrentBoard.Add(UserType.EndUser, 1, 1) .Add(UserType.Machine, 2, 2); Assert.AreEqual(game1.State, game2.State); }
public void GameState_MatchesSymmetricalAfterRotateBackAndForth_Success() { var game1 = new TicTacToe.Game(); game1.CurrentBoard.Add(UserType.EndUser, 1, 1) .Add(UserType.Machine, 2, 2) .Add(UserType.EndUser, 1, 2) .Add(UserType.Machine, 0, 1); var rotated = game1.CurrentBoard.RotateClockwise(); Assert.AreNotEqual(game1.State, rotated.GetHashCode()); rotated = rotated.RotateCounterClockwise(); Assert.AreEqual(game1.State, rotated.GetHashCode()); }
public void GameState_FullBoard_Success() { var game = new TicTacToe.Game(); game.CurrentBoard.Add(UserType.EndUser, 0, 0) .Add(UserType.Machine, 0, 1) .Add(UserType.EndUser, 0, 2) .Add(UserType.Machine, 1, 0) .Add(UserType.EndUser, 1, 1) .Add(UserType.Machine, 1, 2) .Add(UserType.EndUser, 2, 0) .Add(UserType.Machine, 2, 1) .Add(UserType.EndUser, 2, 2); Assert.AreNotEqual(null, game.State); Assert.AreNotEqual(null, game.State); }
public void GameState_MatchesSymmetricalAfterRotate_Success() { var game1 = new TicTacToe.Game(); game1.CurrentBoard.Add(UserType.EndUser, 1, 1) .Add(UserType.Machine, 2, 2) .Add(UserType.EndUser, 1, 2) .Add(UserType.Machine, 0, 1); var game2 = new TicTacToe.Game(); game2.CurrentBoard.Add(UserType.EndUser, 1, 1) .Add(UserType.Machine, 0, 2) .Add(UserType.EndUser, 1, 2) .Add(UserType.Machine, 0, 1); Assert.AreNotEqual(game1.State, game2.State); Assert.AreNotEqual(game1.State, game2.CurrentBoard.RotateClockwise().GetHashCode()); }
//Launch Tic Tac Toe game in a console window static void Main(string[] args) { Game tictactoe = new TicTacToe.Game(); tictactoe.Run(); }