private void STATE_SOLVING(Request theRequest)
        {
            myState = solverState.SOLVING;

            SudokuLibApi.EnableGuessing();

            myMainWindow.DisableClearButton();
            myMainWindow.DisableExitButton();

            // Convert the user input to a byte array to send to the Sudoku API

            byte[] myBytes = new byte[81];

            int byteIdx = 0;

            for (int i = 1; i <= 9; ++i)
            {
                for (int j = 1; j <= 9; ++j)
                {
                    if (myMainWindow.myInputBoxes[i, j].Text != string.Empty)
                    {
                        if (myMainWindow.myInputBoxes[i, j].Text == "?")
                        {
                            myBytes[byteIdx] = Convert.ToByte(0);
                        }
                        else
                        {
                            myBytes[byteIdx] = Convert.ToByte(Int32.Parse(myMainWindow.myInputBoxes[i, j].Text));
                        }
                        ++byteIdx;
                    }
                    else
                    {
                        myBytes[byteIdx] = Convert.ToByte(0);
                        ++byteIdx;
                    }
                }
            }

            // Call the Sudoko API to initialize the board
            SudokuLibApi.Reset();
            SudokuLibApi.Initialize(myBytes);

            EventOccured(SolverFSM.transitionEvent.WAIT_FOR_RESPONSE, null);
        }
Beispiel #2
0
 private void enableGuessingButton_Click(object sender, EventArgs e)
 {
     SudokuLibApi.EnableGuessing();
 }