Commits

Alex Kulikoff committed 092fdc2

Да! прога ключит, но ничего лучше сделать не смог. Начинай делать второй уровень

Comments (0)

Files changed (7)

src/Banker/Banker.suo

Binary file modified.

src/Banker/Banker/Form1.cs

 
         Var[] var2 = new Var[9] 
         {   new Var(new int[3,5] { {3, 6, 4, 5,0},{2, 5, 3, 4,0},{0,0,0,0,0} }, new int[]{6, 5,0}),
-            new Var(new int[3,5] { {5, 6, 4, 5,0},{3, 5, 4, 5,0},{0,0,0,0,0} }, new int[]{ 6,5,0}),
+            new Var(new int[3,5] { {5, 6, 4, 5,0},{2, 5, 4, 5,0},{0,0,0,0,0} }, new int[]{ 6,5,0}),
             new Var(new int[3,5] { {3, 6, 4, 5,0},{5, 1, 5, 5,0},{0,0,0,0,0} }, new int[]{ 6,5,0}),
             new Var(new int[3,5] { {4, 6, 5, 3,0},{5, 2, 4, 5,0} ,{0,0,0,0,0}}, new int[]{ 6,5,0}),
-            new Var(new int[3,5] { {2, 6, 5, 5,0},{4, 1, 4, 5,0},{0,0,0,0,0} }, new int[]{ 6,5,0}),
+            new Var(new int[3,5] { {2, 6, 5, 5,0},{4, 1, 4, 4,0},{0,0,0,0,0} }, new int[]{ 6,5,0}),
             new Var(new int[3,5] { {2, 6, 5, 6,0},{5, 1, 4, 5,0} ,{0,0,0,0,0}}, new int[]{ 6,5,0}),
             new Var(new int[3,5] { {2, 6, 5, 5,0},{5, 0 ,4, 5,0},{0,0,0,0,0} }, new int[]{ 6,5,0}),
             new Var(new int[3,5] { {3, 5, 4, 5,0},{5, 2, 4, 5,0} ,{0,0,0,0,0}}, new int[]{ 6,5,0}),
-            new Var(new int[3,5] { {3, 5, 4, 5,0},{5, 2, 4, 5,0} ,{0,0,0,0,0}}, new int[]{ 6,5,0}),
+            new Var(new int[3,5] { {3, 5, 4, 5,0},{4, 2, 4, 5,0} ,{0,0,0,0,0}}, new int[]{ 6,5,0}),
             
         };
 
         } 
         void level2(Var var) // Второй уровень, var - вариант задания
         {
+            blockProc.Clear(); blockRes.Clear();
             cur = var;
             table1.Rows[3].Visible = true;
             table1.Rows[4].Visible = false;
         }
         void level3(Var var) // Третий уровень, var - вариант задания
         {
+            blockProc.Clear(); blockRes.Clear(); endStack.Clear();
             cur = var;
             table1.Rows[3].Visible = true;
             table1.Rows[4].Visible = true;
                     } break;
                 case 2:
                     {
-                        if ((temp[0, proc - 1] + rezerv[0] >= max[0, proc - 1]) && (temp[1, proc - 1] + rezerv[1] >= max[1, proc - 1])) return true;
+                        for (int j = 0; j < 4; j++) if (isBlock(res, j + 1)&&!endStack.Contains(j)) return true;
+
+                            if ((temp[0, proc - 1] + rezerv[0] >= max[0, proc - 1]) && (temp[1, proc - 1] + rezerv[1] >= max[1, proc - 1])) return true;
                         for (int i = 0; i < 4; i++)
                             if (!isBlock(i + 1, 1))
                             {
                             }
                         if ((rezerv[0] == 0) || (rezerv[1] == 0)) return false;
                         
-                    } break;
+                    } 
+                    
+                    break;
                 case 3: 
                     {
 
 
                 return k;
         }
-
+       
         bool isBad()
         {
             if (isBlock()) return true;
 
             switch(level){
                 case 2:
-                    //for (int j = 0; j < 4; j++)
-                    //{
-                    //    if (!isBlock(j + 1, 1)) if (max[0, j] - temp[0, j] < max[0, max1] - temp[0, max1]) max1 = j;
-                    //    if (!isBlock(j + 1, 2)) if (max[1, j] - temp[1, j] < max[1, max2] - temp[1, max2]) max2 = j;
-                    //}
-                    //if (res == 1) { if (proc == max1 + 1)return false; } else { if (proc == max2 + 1)return false; }
-                    //if (res == 1) { if (temp[0, proc - 1] + max[0, max1] >= max[0, proc - 1])return false; } else { if (temp[1, proc - 1] + max[1, max2] >= max[1, proc - 1])return false; }
+                    
+                 
 
                     for (int j = 0; j < 4; j++)
                     {
-                      if(!endStack.Contains(j))  if (max[0, j] - temp[0, j] <= max[0, max1] - temp[0, max1]&&max[1, j] - temp[1, j] <= max[1, max1] - temp[1, max1])  max1 = j;
+                      if(!endStack.Contains(j))  if (max[0, j] - temp[0, j] < max[0, max1] - temp[0, max1]&&max[1, j] - temp[1, j] < max[1, max1] - temp[1, max1])  max1 = j;
                          
                     }
-                    if (proc - 1 == max1 || (temp[0, proc - 1] + max[0, max1]+1 >= max[0, proc - 1]) && (temp[1, proc - 1] + max[1, max1] >= max[1, proc - 1])) return false;
+
+
+                    if (proc - 1 == max1 || (temp[0, proc - 1] + max[0, max1] >= max[0, proc - 1]) && (temp[1, proc - 1] + max[1, max1] >= max[1, proc - 1])) return false;
+                   
                     break;
         }
                 return true;
             {
                 MessageBox.Show("Ресурс не выделен");
                 temp = new int[3, 5] { { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } };
-                max=cur.t;
+                copy(max, cur.t);
                 cur.m.CopyTo(rezerv, 0);
                 blockProc.Clear(); blockRes.Clear(); endStack.Clear();
                 reSet();

src/Banker/Banker/Form2.Designer.cs

             this.domainUpDown2.Items.Add("6");
             this.domainUpDown2.Items.Add("7");
             this.domainUpDown2.Items.Add("8");
+            this.domainUpDown2.Items.Add("9");
             this.domainUpDown2.Location = new System.Drawing.Point(48, 39);
             this.domainUpDown2.Name = "domainUpDown2";
             this.domainUpDown2.Size = new System.Drawing.Size(120, 20);

src/Banker/Banker/bin/Debug/Banker.exe

Binary file modified.

src/Banker/Banker/bin/Debug/Banker.pdb

Binary file modified.

src/Banker/Banker/obj/x86/Debug/Banker.exe

Binary file modified.

src/Banker/Banker/obj/x86/Debug/Banker.pdb

Binary file modified.