Ejemplo n.º 1
0
        internal void MakeMove(bool isYellow, int columnNumber)
        {
            var boardAPI = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS);

            boardAPI.MakeMove(this.Cells, columnNumber, isYellow);


            if (boardAPI.WasWinningMove(this.Cells, columnNumber, isYellow))
            {
                // Someone just won.
                this.CurrentState = isYellow ? GameState.YellowWon : GameState.RedWon;
            }
            else if (boardAPI.IsBoardFull(this.Cells))
            {
                // Draw
                this.CurrentState = GameState.Draw;
            }
            else
            {
                // Other players turn
                this.CurrentState = isYellow ? GameState.RedToPlay : GameState.YellowToPlay;
            }
        }
Ejemplo n.º 2
0
        internal bool IsMoveAllowed(int columnNumber)
        {
            var boardAPI = new BoardAPI(Game.NUMBER_OF_COLUMNS, Game.NUMBER_OF_ROWS);

            return(boardAPI.IsMoveAllowed(this.Cells, columnNumber));
        }