Exemplo n.º 1
0
        public TicTacToe(TicTacToe clone)
        {
            Board    = new SqrState[ROWS, COLS];
            Moves    = clone.Moves;
            GameTurn = clone.GameTurn;
            Winner   = clone.Winner;
            LastMove = new int[] { clone.LastMove[0], clone.LastMove[1] };

            for (int row = 0; row < ROWS; ++row)
            {
                for (int col = 0; col < COLS; ++col)
                {
                    Board[row, col] = clone.Board[row, col];
                }
            }
        }
Exemplo n.º 2
0
        public UltimateTicTacToe(UltimateTicTacToe clone)
        {
            Boards         = new TicTacToe[ROWS, COLS];
            PlayableBoards = new bool[ROWS, COLS];
            Winner         = clone.Winner;
            GameTurn       = clone.GameTurn;
            LastMove       = new int[] { clone.LastMove[0], clone.LastMove[1] };

            for (int row = 0; row < ROWS; ++row)
            {
                for (int col = 0; col < COLS; ++col)
                {
                    Boards[row, col]         = clone.Boards[row, col].Clone;
                    PlayableBoards[row, col] = clone.PlayableBoards[row, col];
                }
            }
        }
Exemplo n.º 3
0
        private void MouseMoved(object sender, MouseEventArgs e)
        {
            int row = e.Y / (Height / TicTacToe.ROWS);
            int col = e.X / (Width / TicTacToe.COLS);

            if (!TicTacToe.GameOver && TicTacToe.InBounds(row, col) && TicTacToe.Board[row, col] == TicTacToe.SqrState.Empty)
            {
                if (sqrMouse.X != row || sqrMouse.Y != col)
                {
                    sqrMouse = new Point(row, col);
                    mouseOn.Start();
                }
            }
            else
            {
                sqrMouse.X = -1;
            }
        }
Exemplo n.º 4
0
 public TicTacToeGui(TicTacToe board, bool goBackButton = true) : this(goBackButton)
 {
     TicTacToe = board;
 }