Example #1
0
    void DoHorizontalTests()
    {
        for (int y = 0; y < ConnectFour.BOARD_HEIGHT; y++)
        {
            // Create a board where we shift the four occupied cells right each loop until they no longer fit
            for (int startX = 0; startX <= ConnectFour.BOARD_WIDTH - ConnectFour.SEQ_COUNT; startX++)
            {
                byte[,] board = new byte[ConnectFour.BOARD_WIDTH, ConnectFour.BOARD_HEIGHT];

                for (int x = 0; x < ConnectFour.SEQ_COUNT; x++)
                {
                    board[startX + x, y] = 1;
                }

                // Set the board directly
                connectFour.SetBoard(board);

                // Print the board
                connectFour.PrintBoard();

                // Try to solve the board in its entirity
                connectFour.CheckForWin(1);

                // Try to solve just the row
                connectFour.CheckForWinIncremental(1, new Vector2Int(0, y));
            }
        }
    }