コード例 #1
0
ファイル: N6.cs プロジェクト: ngthuc/Learn_NienLuanCS
        private void btnGo_Click(object sender, EventArgs e)
        {
            this.N6_Load(sender, e);
            Class6 n6 = new Class6();

            //Nạp ma trận lên và hiển thị hình ảnh
            TextBox[,] lbl = n6.clickMove81toArray(
                lbl11, lbl12, lbl13, lbl14, lbl15, lbl16,
                lbl21, lbl22, lbl23, lbl24, lbl25, lbl26,
                lbl31, lbl32, lbl33, lbl34, lbl35, lbl36,
                lbl41, lbl42, lbl43, lbl44, lbl45, lbl46,
                lbl51, lbl52, lbl53, lbl54, lbl55, lbl56,
                lbl61, lbl62, lbl63, lbl64, lbl65, lbl66,
                nb);
            if (n6.checkFeasible(nb, 6) == false)
            {
                MessageBox.Show("Can't play this! You must clear and replay", "Check Maxtrix", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                // Giải ma trận rỗng một cách ngẫu nhiên
                n6.solveSudoku(nb, 0, 0, 6);
                for (int i = 0; i < 6; i++)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        lbl[i, j].Text = nb[i, j].Value.ToString();
                    }
                }
            }
        }
コード例 #2
0
ファイル: N6.cs プロジェクト: ngthuc/Learn_NienLuanCS
        private void Check_Click(object sender, EventArgs e)
        {
            Class6 n6 = new Class6();

            //Nạp ma trận lên và hiển thị hình ảnh
            TextBox[,] lbl = n6.clickMove81toArray(
                lbl11, lbl12, lbl13, lbl14, lbl15, lbl16,
                lbl21, lbl22, lbl23, lbl24, lbl25, lbl26,
                lbl31, lbl32, lbl33, lbl34, lbl35, lbl36,
                lbl41, lbl42, lbl43, lbl44, lbl45, lbl46,
                lbl51, lbl52, lbl53, lbl54, lbl55, lbl56,
                lbl61, lbl62, lbl63, lbl64, lbl65, lbl66,
                nb);
            if (n6.checkFeasible(nb, 6) == false)
            {
                MessageBox.Show("Can't play this! You must clear and replay", "Check Maxtrix", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("It all ok ! You can continue", "Check Maxtrix", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }