Example #1
0
        public MutexTable(int size, int wolfRange, int sheepRange, Grid drawingGrid, int tickTime)
        {
            _table = new MutexCell[size, size];

            for (int i = 0; i < _table.GetLength(0); i++)
            {
                for (int j = 0; j < _table.GetLength(1); j++)
                {
                    _table[i, j] = new MutexCell();
                }
            }

            _wolfRange  = wolfRange;
            _sheepRange = sheepRange;

            _wolves = new List <Wolf>();
            _sheep  = new List <Sheep>();

            _drawingGrid = drawingGrid;

            for (int i = 0; i < size; i++)
            {
                _drawingGrid.ColumnDefinitions.Add(new ColumnDefinition());
                _drawingGrid.RowDefinitions.Add(new RowDefinition());
            }

            _sheepTickTimeMsec = _wolfTickTimeMsec = tickTime;
            _windowThread      = Thread.CurrentThread;
        }
        public MutexTable(int size, int wolfRange, int sheepRange, Grid drawingGrid, int tickTime)
        {
            _table = new MutexCell[size, size];

            for (int i = 0; i < _table.GetLength(0); i++)
                for (int j = 0; j < _table.GetLength(1); j++)
                {
                    _table[i, j] = new MutexCell();
                }

            _wolfRange = wolfRange;
            _sheepRange = sheepRange;

            _wolves = new List<Wolf>();
            _sheep = new List<Sheep>();

            _drawingGrid = drawingGrid;

            for (int i = 0; i < size; i++)
            {
                _drawingGrid.ColumnDefinitions.Add(new ColumnDefinition());
                _drawingGrid.RowDefinitions.Add(new RowDefinition());
            }

            _sheepTickTimeMsec = _wolfTickTimeMsec = tickTime;
            _windowThread = Thread.CurrentThread;
        }