コード例 #1
0
 private void findWhiteKingPaths()
 {
     whiteKing.GeneratePathsWithDIrection();
     whiteKingPaths = new List <int[]>();
     whiteKing.possiblePaths.ForEach(i =>
     {
         bool contains = false;
         if (radioButton2.Checked)
         {
             PATHS.ForEach(q => { if (q[0] == i[0] && q[1] == i[1])
                                  {
                                      contains = true;
                                  }
                           });                                                                                 //d) Nekerta juodu
         }
         else if (radioButton1.Checked)
         {
             PATHS.ForEach(q => { if (q[0] == i[0] && q[1] == i[1])
                                  {
                                      if (A[i[0], i[1]] == 1 || q[2] == 1)
                                      {
                                          contains = true;
                                      }
                                  }
                                  ; });                                                                                                                       //c) Kerta juodus, iskyrus karaliu
         }
         if (!contains)
         {
             whiteKingPaths.Add(i);
         }
     });
     //---
     //whiteKingPaths.ForEach(i => richTextBox1.AppendText(string.Format("Possible: {0} {1}, direction: {2}\n", i[0], i[1], i[2])));
     //richTextBox1.AppendText("\n");
 }