示例#1
0
        private void buttonCheckResolving_Click(object sender, EventArgs e)
        {
            if (gameState < 0)                  //	0=not playing / 1=playing / -1-play stopped
            {
                return;
            }
            int ret = AnalyzeResult(solvetype.TESTRESULTS);

            if (ret > 1)
            {
                diffList = new List <int[]>();
                int size  = gameTable.boardsize;
                int difnb = resultList.gameTableList.Count;
                for (int nn = 0; nn < size; nn++)
                {
                    GameTable firstTable = resultList.gameTableList[0];
                    gameTable.cell(nn).canresmask = 0;
                    if (firstTable.cell(nn).orig == 1)
                    {
                        continue;
                    }
                    int num = 1 << (firstTable.cell(nn).fixNum - 1);
                    for (int jj = 1; jj < difnb; jj++)
                    {
                        int numx = 1 << ((resultList.gameTableList[jj].cell(nn)).fixNum - 1);
                        num |= numx;
                    }
                    int numnb = CountBits(num);
                    if (numnb < 2)
                    {
                        continue;
                    }
                    gameTable.cell(nn).canresmask = num;
                    diffList.Add(new int[] { nn, num });
                }
            }
        }
示例#2
0
 private void buttonStartGame_Click(object sender, EventArgs e)
 {
     if (gameState == 0)                         //	0=not playing / 1=playing / -1-play stopped
     //	not playing - check game
     {
         int nerr = gameTable.CheckTable(true);
         if (nerr > 0)
         {
             string msgid   = chlang.GetLocalizedString("MB_msg_errtable");
             string msgtype = chlang.GetLocalizedString("MB_caption_err");
             MessageBox.Show(msgid, msgtype, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         //	not playing - start game
         buttonStartGame.Text                = "Játék leállítása";
         buttonClearGame.Text                = "Lépés törlése";
         buttonFillGame.Text                 = "Lejátszás törlése";
         buttonSaveGame.Text                 = "Megállítás";
         comboGameType.Enabled               =
             numericLevel.Enabled            =
                 comboGameName.Enabled       =
                     textGameComment.Enabled = false;
         buttonList = new List <int[]>();
         gameTable.ClearSelects();
         gameState = 1;
     }
     else
     {
         //	playing - stop game
         buttonStartGame.Text                = "--> Játék indítása";
         buttonClearGame.Text                = "Tábla törlése";
         buttonFillGame.Text                 = "Tábla kitöltése";
         buttonSaveGame.Text                 = "Játék mentése";
         comboGameType.Enabled               =
             numericLevel.Enabled            =
                 comboGameName.Enabled       =
                     textGameComment.Enabled = true;
         //	remove gamed cells
         int count = buttonList.Count;
         for (int ii = 0; ii < count; ii++)
         {
             gameTable.cell(buttonList[ii][0], buttonList[ii][1]).fixNum = 0;
         }
         pictureTable_Resize(null, null);
         gameState = 0;
     }
 }