Banker / Banker / Form1.cs

The default branch has multiple heads

/*
 Программа реализующая алгоритм Банкира
 Куликов Александр ист-08
 
 */

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Banker
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        DataGridView table1;  // таблица прцессов
        DataGridView table2;  // таблица резерва

        Stack<int> blockProc=new Stack<int>(); // стек содержащий индексы выполненых процессов
        Stack<int> blockRes = new Stack<int>();  // стек содержащий индексы ресурсов выполненых процессов

        int proc = 0; // индекс процесса
        int res = 0; // индекса ресурса

        int[,] _temp = new int[5, 3]; // массив занимаемых ресурсов процессов
        int[,] _max = new int[5, 3]; // массив максимальных значений процессов

        public int[,] temp
        {
            get { return _temp; }
            set { _temp = value;  }
        }
        public int[,] max
        {
            get { return _max; }
            set { _max = value; }
        }

        Random rnd = new Random(); // генератор случайных чисел

        string GUID = "aa645ec4-0781-4a99-9e0d-b1006f33b866";

        class Var
        {
            int[,] t;
            int[] m;
            
          public  Var(int[,] t, int[] m)
          {
              this.t = t; 
              this.m = m; 
          }

            
        }
        Var[] var1 = new Var[9] 
        {   new Var(new int[,] { {3, 4, 5} },new int[]{ 5}),
            new Var(new int[,] { {4, 4, 5} }, new int[]{ 5}),
            new Var(new int[,] { {5, 4, 5} }, new int[]{ 5}),
            new Var(new int[,] { {4, 5, 4} }, new int[]{ 5}),
            new Var(new int[,] { {5, 4, 5} }, new int[]{ 5}),
            new Var(new int[,] { {4, 5, 5} }, new int[]{ 5}),
            new Var(new int[,] { {5, 4, 5} }, new int[]{ 5}),
            new Var(new int[,] { {5, 5, 5} }, new int[]{ 5}),
            new Var(new int[,] { {5, 5, 4} }, new int[]{ 5}),
            
        };

        Var[] var2 = new Var[9] 
        {   new Var(new int[,] { {3, 6, 4, 5},{5, 1, 4, 5} }, new int[]{6, 5}),
            new Var(new int[,] { {},{} }, new int[]{ 5,6}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} }, new int[]{ 6,5}),
            
        };

        Var[] var3 = new Var[9] 
        {   new Var(new int[,] { {},{},{} }, new int[]{6, 5}),
            new Var(new int[,] { {},{},{} }, new int[]{ 5,6}),
            new Var(new int[,] { {},{},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{} ,{}}, new int[]{ 6,5}),
            new Var(new int[,] { {},{} ,{}}, new int[]{ 6,5}),
            new Var(new int[,] { {},{} ,{}}, new int[]{ 6,5}),
            new Var(new int[,] { {},{},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{},{} }, new int[]{ 6,5}),
            new Var(new int[,] { {},{},{} }, new int[]{ 6,5}),
            
        };
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.