コード例 #1
0
ファイル: TableQueue.cs プロジェクト: mnandi/SuDokuGit
 public int Push(GameTable table)
 {
     gameTableList.Add(table.DeepClone<GameTable>(table));
     return gameTableList.Count;
 }
コード例 #2
0
ファイル: SuDokuMainForm.cs プロジェクト: mnandi/SuDokuGit
        private int AnalyzeResult(solvetype type)
        {
            GameTable gameTableSave = gameTable.DeepClone(gameTable);
            sresult   sret          = SuSolve(type);
            //		-1	- no solution
            //		 0	- solved
            //		>0	- other solve error
            string msgid;
            string msgtype;

            switch (sret)
            {
            case sresult.SOLVE_FEWDATA:
                msgid   = chlang.GetLocalizedString("MB_msg_errfill");
                msgtype = chlang.GetLocalizedString("MB_caption_err");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case sresult.SOLVE_IMPOSSIBLE:                      //		"Lehetetlen megoldás"
                msgid   = chlang.GetLocalizedString("MB_msg_NOresult");
                msgtype = chlang.GetLocalizedString("MB_caption_err");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case sresult.SOLVE_CANCELLED:
                msgid   = chlang.GetLocalizedString("MB_msg_stopped");
                msgtype = chlang.GetLocalizedString("MB_caption_err");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case sresult.SOLVE_OK:                                      //	-1	"Jó megoldás !"
                //	Returns:
                if (type == solvetype.MAKERESULT)
                {
                    pictureTable_Resize(null, null);
                    msgid   = chlang.GetLocalizedString("MB_msg_result");
                    msgtype = chlang.GetLocalizedString("MB_caption_result");
                }
                else
                {
                    msgid   = chlang.GetLocalizedString("MB_msg_solvable");
                    msgtype = chlang.GetLocalizedString("MB_caption_result");
                }
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            case sresult.SOLVE_NORESULT:                        //	 0	"Hiba, nincs megoldás"
                msgid   = chlang.GetLocalizedString("MB_msg_NOresult");
                msgtype = chlang.GetLocalizedString("MB_caption_err");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case sresult.SOLVE_ONERESULT:                       //	1	"1 megoldás"
                msgid   = chlang.GetLocalizedString("MB_msg_1result");
                msgtype = chlang.GetLocalizedString("MB_caption_result");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            case sresult.SOLVE_MORERESULT:                      //	>15	"Több megoldás"
                msgid   = string.Format(chlang.GetLocalizedString("MB_msg_MANYresult"), (int)sret);
                msgtype = chlang.GetLocalizedString("MB_caption_result");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            default:                                                                    //	<15	"Több megoldás"
                msgid   = string.Format(chlang.GetLocalizedString("MB_msg_NBresult"), (int)sret);
                msgtype = chlang.GetLocalizedString("MB_caption_result");
                MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;
            }
            gameTable     = gameTableSave;
            gameTableSave = null;
            gameTable.ClearSelects();
            pictureTable_Resize(null, null);
            return((int)sret);
        }