private int EvaluateMove(TicTacToeBoard board, ITicTacToePlayer currentPlayer, ITicTacToePlayer otherPlayer)
        {
            if ((new EquationWinEvaluator()).HasPlayerWon(currentPlayer, board))
                return currentPlayer == this ? Win : Loss;

            return Draw;
        }
        private void generateButtonClick()
        {
            int i = 0;
            int j = 0;

            TicTacToeBoard.PlayTurn(ref i, ref j);
        }
        private ScoreTally PlayAllPossibleGames(TicTacToeBoard currentBoard, ITicTacToePlayer player, ITicTacToePlayer opponent)
        {
            var tally = ScoreTally.Start;

            var position = player.PlayTurn(currentBoard);
            var nextBoard = currentBoard.UpdateBoard(position, player);
            if (new BitMaskWinEvaluator().HasPlayerWon(player, nextBoard))
                return ScoreTally.Win;
            if (nextBoard.IsComplete)
                return ScoreTally.Draw;

            foreach (var boardPosition in nextBoard.VacantSquares)
            {
                var possibleMove = nextBoard.UpdateBoard(boardPosition, opponent);
                if (new BitMaskWinEvaluator().HasPlayerWon(opponent, possibleMove))
                    return ScoreTally.Loss;
                if (possibleMove.IsComplete)
                    return ScoreTally.Draw;

                var result = PlayAllPossibleGames(possibleMove, player, opponent);
                tally = result + tally;
            }

            return tally;
        }
Exemple #4
0
        public void UpperEdgeCase_ValidMove()
        {
            GameBoard board  = new TicTacToeBoard();
            var       result = board.IsvalidMove(8);

            Assert.Equal(true, result);
        }
Exemple #5
0
        public void PlayInSideOfBoard_ValidMove()
        {
            GameBoard board  = new TicTacToeBoard();
            var       result = board.IsvalidMove(5);

            Assert.Equal(true, result);
        }
        public IActionResult Index()
        {
            TicTacToeBoard board = new TicTacToeBoard();
            List <Cell>    cells = board.GetCells();

            foreach (Cell cell in cells)
            {
                cell.Mark = TempData[cell.Id]?.ToString();
            }
            board.CheckForWinner();

            TicTacViewModel model = new TicTacViewModel
            {
                Cells    = cells,
                Selected = new Cell {
                    Mark = TempData["nextTurn"]?.ToString() ?? "X"
                },
                IsGameOver = board.HasWinner || board.HasAllCellsSelected
            };

            if (model.IsGameOver)
            {
                TempData["nextTurn"] = "X";
                TempData["message"]  = board.HasWinner ? $"{board.WinningMark} wins" : "Its a tie";
            }
            else
            {
                TempData.Keep();
            }
            return(View(model));
        }
Exemple #7
0
        public void PlayOutSideOfBoard_NotValidMove()
        {
            GameBoard board  = new TicTacToeBoard();
            var       result = board.IsvalidMove(10);

            Assert.Equal(false, result);
        }
Exemple #8
0
    public TicTacToeMove NegaMaxMove(TicTacToeBoard game)
    {
        List <Vector2> moves = game.FindBlankCells(game.Board);

        float score;

        TicTacToeMove  bestMove  = new TicTacToeMove();
        TicTacToeBoard boardCopy = new TicTacToeBoard();

        bestMove.Score = -10000;

        int depth = 0;

        foreach (Vector2 v in moves)
        {
            boardCopy.Board = game.CopyBoard(game.Board);
            boardCopy.PlaceMarker(boardCopy.Board, Marker.X, v);
            score = NegaMax(boardCopy, boardCopy.GetOppositeMarker(Marker.X), depth);
            if (score >= bestMove.Score)
            {
                bestMove.Score = (int)score;
                bestMove.Cell  = v;
            }
        }
        return(bestMove);
    }
        public void GivenCatGameExpectNullWinner()
        {
            // arrange
            var boardScenario = new TicTacToeBoard();

            boardScenario.Values[0] = new List <TicTacToePlayers?>
            {
                TicTacToePlayers.X,
                TicTacToePlayers.O,
                TicTacToePlayers.X
            };
            boardScenario.Values[1] = new List <TicTacToePlayers?>
            {
                TicTacToePlayers.O,
                TicTacToePlayers.O,
                TicTacToePlayers.X
            };
            boardScenario.Values[2] = new List <TicTacToePlayers?>
            {
                TicTacToePlayers.X,
                TicTacToePlayers.X,
                TicTacToePlayers.O
            };

            // act
            TicTacToePlayers?winner = this.TicTacToeAlgorithm.GetWinner(boardScenario);

            // assert
            winner.Should().BeNull();
        }
Exemple #10
0
        public static void Main()
        {
            var board = new TicTacToeBoard();

            var minimax = new MinimaxDecision <ProblemState, ProblemAction>();

            var alphaBeta = new AlphaBetaPruning <ProblemState, ProblemAction>();

            var agent = new ProblemAgent(alphaBeta);

            ProblemAction action;

            while ((action = agent.Work(board)) != default)
            {
                var player = agent.Problem.Player(agent.State);

                if (player == ProblemDefinition.PlayerX)
                {
                    Console.WriteLine($"Enter Positions (e.g. {action.PutPosition.x} {action.PutPosition.y}): ");
                    action = ProblemStateExtensions.FromInput(player, Console.ReadLine());
                }

                board = agent.Problem.Result(agent.State, action).FromProblemState();

                WriteBoard(board);
            }
        }
Exemple #11
0
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello, World!");

        var positions = Enumerable.Range(1, 9).Select(_ => TicTacToePiece.E).ToArray();
        var board     = new TicTacToeBoard(positions, TicTacToePiece.X);

        var(human, computer) = SelectSide();

        var moveNumber = 0;

        while (board.GetLegalMoves().Any())
        {
            Console.Clear();
            Console.WriteLine($"step#{moveNumber}");
            Console.WriteLine(board.ToString());

            var location = board.GetTurn() == human
                ? DoHumanMove(board, human)
                : DoComputerMove(board);

            moveNumber++;
            board = board.Move(location) as TicTacToeBoard;
        }

        PrintResult(moveNumber, board, human);
    }
        private void btnNNHint_Click(object sender, RoutedEventArgs e)
        {
            if (_nnHowToPlayX == null)
            {
                Dispatcher.Invoke(() => this.ShowMessageAsync("Error occured", "You need to train Neural Network how to play first"));
                return;
            }

            var currSymbol = TicTacToeGame.Opposite(_gameBoard.PrevSymbol);

            if (currSymbol != S.X) // trzeba użyć odwrotnej planszy, bo sieć jest nauczona grać iksem
            {
                var invertedBoard = new TicTacToeBoard();
                invertedBoard.Create(new Canvas {
                    Width = cvBoard.Width, Height = cvBoard.Height
                });
                invertedBoard.GameState = _gameBoard.GameState.Opposite();
                invertedBoard.PlaceNNShadow(_gameBoard.PrevSymbol, _nnHowToPlayX); // prevSymbol to odwrotność obecnego
                //_gameBoard.GameState = invertedBoard.GameState.Opposite();
                var oppositeShadow = invertedBoard.GetShadow();
                _gameBoard.PlaceShadow(ShadowType.CircleShadow, oppositeShadow.I, oppositeShadow.J);
            }
            else
            {
                _gameBoard.PlaceNNShadow(currSymbol, _nnHowToPlayX);
            }
        }
Exemple #13
0
        public async Task TicTacToe()
        {
            var board = new TicTacToeBoard();

            while (true)
            {
                await ReplyAsync("yes", embed : board.GetFormattedBoard(Context.User).Build());

                var response = await NextMessageAsync(timeout : new TimeSpan(0, 0, 0, 0, -1));

                string responseText = response.Content;
                if (responseText == "quit")
                {
                    return;
                }
                else if (responseText == "a")
                {
                    board.Set(TicTacToeBoardPosition.TopLeft, TicTacToeMark.X);
                }
                else if (responseText == "a")
                {
                    board.Set(TicTacToeBoardPosition.Middle, TicTacToeMark.O);
                }
                else if (responseText == "a")
                {
                    board.Set(TicTacToeBoardPosition.BottomRight, TicTacToeMark.X);
                }
            }
        }
        public static TicTacToeBoard AddMark(string playerUuid, int i, int j, TicTacToeBoard board)
        {
            if (board.CurrentPlayerId != playerUuid)
            {
                return(board);
            }

            string mark;

            if (board.FirstPlayer.Uuid == playerUuid)
            {
                mark = "X";
            }
            else if (board.SecondPlayer.Uuid == playerUuid)
            {
                mark = "O";
            }
            else
            {
                throw new Exception("Received player id is not in this game");
            }

            board.Grid[i][j] = mark;

            board.CurrentPlayerId = board.CurrentPlayerId == board.FirstPlayer.Uuid
                ? board.SecondPlayer.Uuid
                : board.FirstPlayer.Uuid;
            return(board);
        }
Exemple #15
0
        public void Place_symbols_in_correct_locations(int position, string player)
        {
            var ticTacToe = new TicTacToeBoard();
            var board     = ticTacToe.Change(position, player);

            Assert.That(board[position - 1], Is.EqualTo(player));
        }
Exemple #16
0
        public void Error_if_position_is_played()
        {
            var ticTacToe = new TicTacToeBoard();

            ticTacToe.Change(2, "X");
            Assert.Throws <ArgumentException>(() => ticTacToe.Change(2, "O"));
        }
 public static TicTacToeBoard.TicTacToePiece[] GetDiagonal1(this TicTacToeBoard board)
 {
     TicTacToeBoard.TicTacToePiece[] results = new TicTacToeBoard.TicTacToePiece[3];
     results[0] = board.R0C2;
     results[1] = board.R1C1;
     results[2] = board.R2C0;
     return(results);
 }
 public static TicTacToeBoard.TicTacToePiece[] GetCol2(this TicTacToeBoard board)
 {
     TicTacToeBoard.TicTacToePiece[] results = new TicTacToeBoard.TicTacToePiece[3];
     results[0] = board.R0C2;
     results[1] = board.R1C2;
     results[2] = board.R2C2;
     return(results);
 }
 public static TicTacToeBoard.TicTacToePiece[] GetRow0(this TicTacToeBoard board)
 {
     TicTacToeBoard.TicTacToePiece[] results = new TicTacToeBoard.TicTacToePiece[3];
     results[0] = board.R0C0;
     results[1] = board.R0C1;
     results[2] = board.R0C2;
     return(results);
 }
        public void Error_on_invalid_position(int position)
        {
            var board = new TicTacToeBoard();

            var ticTacToe = new TicTacToeGame(board);

            Assert.Throws <ArgumentOutOfRangeException>(() => ticTacToe.Play(position));
        }
        public void NotAllowOToGoFirst()
        {
            var ticTacToeBoard = new TicTacToeBoard();

            ticTacToeBoard.PlaceMarker(new OMarker(), new Position(0, 0));

            ticTacToeBoard.CalculateGameState();
        }
        public void ShouldReturnFalseOnBlankBoard()
        {
            var board = new TicTacToeBoard();

            var isTied = TieDetector.IsTied(board);

            isTied.Should().BeFalse();
        }
        public void IsWonShouldBeFalseForBlankGrid()
        {
            var board = new TicTacToeBoard();

            var winStatus = WinDetector.GetWinStatus(board);

            winStatus.IsWon.Should().BeFalse();
        }
        public TicTacToeGame(ITicTacToePlayer naughts, ITicTacToePlayer crosses)
        {
            Naughts = naughts;
            Crosses = crosses;
            _board = new TicTacToeBoard();

            CurrentPlayer = Naughts;
        }
Exemple #25
0
        public void PlayOnOccupiedField_NotValidMove()
        {
            GameBoard board = new TicTacToeBoard();

            board.Place(5, "X");
            var result = board.IsvalidMove(5);

            Assert.Equal(false, result);
        }
Exemple #26
0
        public void EmptyBoard_GameIsNotOver()
        {
            GameRules rules = new TicTacToeRules();
            GameBoard board = new TicTacToeBoard();

            var result = rules.IsWinningMove(board);

            Assert.Equal(false, result);
        }
        public void EnsurePlayersCannotSkipATurn()
        {
            var ticTacToeBoard = new TicTacToeBoard();

            ticTacToeBoard.PlaceMarker(new XMarker(), new Position(0, 0));
            ticTacToeBoard.PlaceMarker(new XMarker(), new Position(0, 1));

            ticTacToeBoard.CalculateGameState();
        }
        /// <summary>
        /// Create Board and Player
        /// </summary>
        public void InitGame()
        {
            // Init board
            Board = new TicTacToeBoard();

            // Read libs and put in queues
            // TODO:
            // var lsPlayer =
        }
 public bool HasPlayerWon(ITicTacToePlayer currentPlayer, TicTacToeBoard board)
 {
     var playerMask = GetPositionMaskForPlayer(currentPlayer, board);
     foreach (var win in _wins)
     {
         if ((win & playerMask) == win)
             return true;
     }
     return false;
 }
 private static void AssertAllCellsAreBlank(TicTacToeBoard board)
 {
     for (int x = 0; x < 3; x++)
     {
         for (int y = 0; y < 3; y++)
         {
             board.GetCellValue(x, y).Should().Be(TicTacToeCellValue.Blank);
         }
     }
 }
        /// <summary>
        /// The get vertical win.
        /// </summary>
        /// <param name="winningPlayer">
        /// The winning player.
        /// </param>
        /// <returns>
        /// The <see cref="TicTacToeBoard"/>.
        /// </returns>
        private static TicTacToeBoard GetVerticalWin(TicTacToePlayers winningPlayer)
        {
            var boardScenario = new TicTacToeBoard();

            boardScenario.Values[0][2] = winningPlayer;
            boardScenario.Values[1][2] = winningPlayer;
            boardScenario.Values[2][2] = winningPlayer;

            return(boardScenario);
        }
        public void GetStringBoardShouldReturnLayoutOfBoardWithAllBlanks()
        {
            var board = new TicTacToeBoard();

            var stringBoard = board.GetStringBoard();

            stringBoard[0].Should().Be("---");
            stringBoard[1].Should().Be("---");
            stringBoard[2].Should().Be("---");
        }
        public async Task BoredAsync()
        {
            Board board = new TicTacToeBoard {
            };

            string s = board.ToString();

            Console.Write(s);
            await ReplyAsync(s);
        }
        public void ShouldReturnFalseSinglePopulatedCell()
        {
            var board = new TicTacToeBoard();

            board.SetCellValue(0, 0, TicTacToeCellValue.O);

            var isTied = TieDetector.IsTied(board);

            isTied.Should().BeFalse();
        }
        public bool HasPlayerWon(ITicTacToePlayer currentPlayer, TicTacToeBoard ticTacToeBoard)
        {
            var winningLines = new WinningLinesGenerator(ticTacToeBoard.Boundries, ticTacToeBoard).PossibleWins();
            foreach (var winningLine in winningLines)
            {
                if (PlayerHasWon(currentPlayer, winningLine))
                    return true;
            }

            return false;
        }
Exemple #36
0
        public BoardPosition PlayTurn(TicTacToeBoard board)
        {
            var random = new Random();

            BoardPosition move;
            do
            {
                move = new BoardPosition(random.Next(1, 4), random.Next(1, 4));
            } while (!board.SquareIsFree(move));

            return move;
        }
 private int GetPositionMaskForPlayer(ITicTacToePlayer currentPlayer, TicTacToeBoard board)
 {
     var positionMask = 0;
     var gridPosition = 1;
     foreach (var playerOnPosition in board)
     {
         if (playerOnPosition == currentPlayer)
             positionMask |= 1 << (board.Boundries.TotalNumberOfSquares - gridPosition);
         gridPosition++;
     }
     return positionMask;
 }
        public void MakeWinningMove()
        {
            var naughts = new TurnByTurnPlayerStub();
            var crosses = new MiniMaxPlayer(naughts);
            var board = new TicTacToeBoard(new ITicTacToePlayer[]
            {
                naughts, null, crosses,
                null, naughts, null,
                naughts, null, crosses
            });

            var position = crosses.PlayTurn(board);
            Assert.That(position, Is.EqualTo(new BoardPosition(2, 3)));
        }
        public void FindBestStartingMove()
        {
            var naughts = new TurnByTurnPlayerStub();
            var crosses = new MiniMaxPlayer(naughts);
            var board = new TicTacToeBoard(new ITicTacToePlayer[]
            {
                null, null, null,
                null, null, null,
                null, null, null
            });

            var position = crosses.PlayTurn(board);
            Assert.That(position, Is.EqualTo(new BoardPosition(1, 1)));
        }
        public void PlayerAlwaysWinsOrDrawsIfOtherPlayerStartsTheGame()
        {
            var naughts = new TurnByTurnPlayerStub();
            var crosses = new MiniMaxPlayer(naughts);

            var board = new TicTacToeBoard();
            var tally = ScoreTally.Start;
            foreach (var square in board.VacantSquares)
            {
                var results = PlayAllPossibleGames(board.UpdateBoard(square, naughts), crosses, naughts);
                tally = tally + results;
            }

            Assert.That(tally.Losses, Is.EqualTo(0));
        }
        public void PlayTurn()
        {
            if(IsFinished)
                throw new GameOverException();

            // this design isn't perfect because it doesn't feed back to the
            // player if they have made an invalid move
            var position = CurrentPlayer.PlayTurn(_board);
            if(_board[position] == null)
            {
                _board = _board.UpdateBoard(position, CurrentPlayer);
                if (HasMadeWinningMove(CurrentPlayer))
                    Winner = CurrentPlayer;

                CurrentPlayer = CurrentPlayer == Naughts ? Crosses : Naughts;
            }
        }
        private Tuple<BoardPosition, int> MaximizeScore(TicTacToeBoard board)
        {
            var scores = new List<Tuple<BoardPosition, int>>();
            foreach (var boardPosition in board.VacantSquares)
            {
                var nextBoard = board.UpdateBoard(boardPosition, this);

                var score = IsFinalMove(nextBoard, this, _opponent)
                    ? EvaluateMove(nextBoard, this, _opponent)
                    : MinimizeScore(nextBoard).Item2;

                if (ShouldAlphaBetaPrune(score, Win))
                    return new Tuple<BoardPosition, int>(boardPosition, score);

                scores.Add(new Tuple<BoardPosition, int>(boardPosition, score));
            }
            return scores.OrderByDescending(x => x.Item2).First();
        }
        private Tuple<BoardPosition, int> MinimizeScore(TicTacToeBoard board)
        {
            var scores = new List<Tuple<BoardPosition, int>>();
            foreach (var boardPosition in board.VacantSquares)
            {
                var nextBoard = board.UpdateBoard(boardPosition, _opponent);

                var score = IsFinalMove(nextBoard, _opponent, this) ?
                    EvaluateMove(nextBoard, _opponent, this) :
                    MaximizeScore(nextBoard).Item2;
                var scoreForPosition = new Tuple<BoardPosition, int>(boardPosition, score);

                if (ShouldAlphaBetaPrune(score, Loss))
                    return scoreForPosition;

                scores.Add(scoreForPosition);
            }
            return scores.OrderBy(x => x.Item2).First();
        }
 public BoardPosition PlayTurn(TicTacToeBoard boardStatus)
 {
     Console.WriteLine("Please enter in the coordinates for where you'd like to go (for example 3,1).");
     var input = _consoleInputStub.Read();
     return ParseTurn(input);
 }
 private bool IsFinalMove(TicTacToeBoard board, ITicTacToePlayer currentPlayer, ITicTacToePlayer otherPlayer)
 {
     return board.IsComplete || (new EquationWinEvaluator()).HasPlayerWon(currentPlayer, board);
 }
 // I know I could have used a mocking framework but my requirements were pretty simple.
 // I think mocking frameworks put a lot of noise and ugly code into your tests.
 public BoardPosition PlayTurn(TicTacToeBoard board)
 {
     return NextTurn();
 }
 public BoardPosition PlayTurn(TicTacToeBoard board)
 {
     return MaximizeScore(board).Item1;
 }
 public BoardPosition PlayTurn(TicTacToeBoard boardStatus)
 {
     _moves.MoveNext();
     return _moves.Current;
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TicTacToeForm));
     this.statusStrip = new System.Windows.Forms.StatusStrip();
     this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
     this.menuStrip1 = new System.Windows.Forms.MenuStrip();
     this.gameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.newGameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     this.timePerMoveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.timePerMoveToolStripComboBox = new System.Windows.Forms.ToolStripComboBox();
     this.difficultyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.difficultyToolStripComboBox = new System.Windows.Forms.ToolStripComboBox();
     this.ticTacToeBoard = new TicTacToe.UI.WindowsForm.TicTacToeBoard();
     this.playerOInformationPanel = new TicTacToe.UI.WindowsForm.PlayerInformationPanel();
     this.playerXInformationPanel = new TicTacToe.UI.WindowsForm.PlayerInformationPanel();
     this.statusStrip.SuspendLayout();
     this.menuStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // statusStrip
     //
     this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.toolStripStatusLabel});
     this.statusStrip.Location = new System.Drawing.Point(0, 294);
     this.statusStrip.Name = "statusStrip";
     this.statusStrip.Size = new System.Drawing.Size(563, 22);
     this.statusStrip.TabIndex = 0;
     this.statusStrip.Text = "statusStrip1";
     //
     // toolStripStatusLabel
     //
     this.toolStripStatusLabel.BackColor = System.Drawing.SystemColors.Control;
     this.toolStripStatusLabel.Name = "toolStripStatusLabel";
     this.toolStripStatusLabel.Size = new System.Drawing.Size(548, 17);
     this.toolStripStatusLabel.Spring = true;
     this.toolStripStatusLabel.Text = "let rec ``fun`` (a:\'tic) (b:\'tac) : \'toe = ``fun`` a b";
     //
     // menuStrip1
     //
     this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.gameToolStripMenuItem});
     this.menuStrip1.Location = new System.Drawing.Point(0, 0);
     this.menuStrip1.Name = "menuStrip1";
     this.menuStrip1.Size = new System.Drawing.Size(563, 24);
     this.menuStrip1.TabIndex = 5;
     this.menuStrip1.Text = "menuStrip1";
     //
     // gameToolStripMenuItem
     //
     this.gameToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.newGameToolStripMenuItem,
     this.toolStripSeparator1,
     this.timePerMoveToolStripMenuItem,
     this.difficultyToolStripMenuItem});
     this.gameToolStripMenuItem.Name = "gameToolStripMenuItem";
     this.gameToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
     this.gameToolStripMenuItem.Text = "Game";
     //
     // newGameToolStripMenuItem
     //
     this.newGameToolStripMenuItem.Name = "newGameToolStripMenuItem";
     this.newGameToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
     this.newGameToolStripMenuItem.Text = "New Game";
     //
     // toolStripSeparator1
     //
     this.toolStripSeparator1.Name = "toolStripSeparator1";
     this.toolStripSeparator1.Size = new System.Drawing.Size(152, 6);
     //
     // timePerMoveToolStripMenuItem
     //
     this.timePerMoveToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.timePerMoveToolStripComboBox});
     this.timePerMoveToolStripMenuItem.Name = "timePerMoveToolStripMenuItem";
     this.timePerMoveToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
     this.timePerMoveToolStripMenuItem.Text = "Time Per Move";
     //
     // timePerMoveToolStripComboBox
     //
     this.timePerMoveToolStripComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.timePerMoveToolStripComboBox.Name = "timePerMoveToolStripComboBox";
     this.timePerMoveToolStripComboBox.Size = new System.Drawing.Size(121, 21);
     //
     // difficultyToolStripMenuItem
     //
     this.difficultyToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.difficultyToolStripComboBox});
     this.difficultyToolStripMenuItem.Name = "difficultyToolStripMenuItem";
     this.difficultyToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
     this.difficultyToolStripMenuItem.Text = "Difficulty";
     //
     // difficultyToolStripComboBox
     //
     this.difficultyToolStripComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.difficultyToolStripComboBox.Name = "difficultyToolStripComboBox";
     this.difficultyToolStripComboBox.Size = new System.Drawing.Size(121, 21);
     //
     // ticTacToeBoard
     //
     this.ticTacToeBoard.BackColor = System.Drawing.Color.Black;
     this.ticTacToeBoard.Dock = System.Windows.Forms.DockStyle.Fill;
     this.ticTacToeBoard.Location = new System.Drawing.Point(127, 24);
     this.ticTacToeBoard.Name = "ticTacToeBoard";
     this.ticTacToeBoard.Size = new System.Drawing.Size(309, 270);
     this.ticTacToeBoard.TabIndex = 4;
     this.ticTacToeBoard.ViewModel = null;
     //
     // playerOInformationPanel
     //
     this.playerOInformationPanel.BackColor = System.Drawing.Color.MidnightBlue;
     this.playerOInformationPanel.Dock = System.Windows.Forms.DockStyle.Right;
     this.playerOInformationPanel.Location = new System.Drawing.Point(436, 24);
     this.playerOInformationPanel.Name = "playerOInformationPanel";
     this.playerOInformationPanel.Player = TicTacToe.Engine.Piece.O;
     this.playerOInformationPanel.Size = new System.Drawing.Size(127, 270);
     this.playerOInformationPanel.TabIndex = 3;
     this.playerOInformationPanel.ViewModel = null;
     //
     // playerXInformationPanel
     //
     this.playerXInformationPanel.BackColor = System.Drawing.Color.MidnightBlue;
     this.playerXInformationPanel.Dock = System.Windows.Forms.DockStyle.Left;
     this.playerXInformationPanel.Location = new System.Drawing.Point(0, 24);
     this.playerXInformationPanel.Name = "playerXInformationPanel";
     this.playerXInformationPanel.Player = TicTacToe.Engine.Piece.X;
     this.playerXInformationPanel.Size = new System.Drawing.Size(127, 270);
     this.playerXInformationPanel.TabIndex = 2;
     this.playerXInformationPanel.ViewModel = null;
     //
     // TicTacToeForm
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.BackColor = System.Drawing.Color.MidnightBlue;
     this.ClientSize = new System.Drawing.Size(563, 316);
     this.Controls.Add(this.ticTacToeBoard);
     this.Controls.Add(this.playerOInformationPanel);
     this.Controls.Add(this.playerXInformationPanel);
     this.Controls.Add(this.statusStrip);
     this.Controls.Add(this.menuStrip1);
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MainMenuStrip = this.menuStrip1;
     this.Name = "TicTacToeForm";
     this.Text = "fun : \'tic -> \'tac -> \'toe";
     this.statusStrip.ResumeLayout(false);
     this.statusStrip.PerformLayout();
     this.menuStrip1.ResumeLayout(false);
     this.menuStrip1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Exemple #50
0
	public void testGameStateEquality() {
		TicTacToeBoard tb1 = new TicTacToeBoard();
		TicTacToeBoard tb2 = new TicTacToeBoard();
		GameState gs1 = new GameState();
		GameState gs2 = new GameState();
		gs1.put("board", tb1);
		gs2.put("board", tb2);
		Assert.assertEquals(gs1, gs2);
		gs1.put("minimaxValue", new Integer(3));
		Assert.assertTrue(!(gs1.equals(gs2)));
	}
Exemple #51
0
	public void setUp() {
		tb = new TicTacToeBoard();
	}