private void InitGameField(Dictionary<string, Cell> grid)
 {
     for (int r = 0; r < gridHeight; r += cellSize)
     {
         for (int c = 0; c < gridWidth; c += cellSize)
         {
             Cell newCell = new Cell(c, r);
             grid.Add(string.Format("{0} {1}", c, r), newCell);
         }
     }
 }
 private void HandleAngleUL(Cell root, sbyte value)
 {
     root.AdjustResidents(value);
     root.TopNeighbour.AdjustResidents(value);
     root.LeftNeighbour.AdjustResidents(value);
 }
 private void HandleAngleDR(Cell root, sbyte value)
 {
     root.AdjustResidents(value);
     root.BottomNeighbour.AdjustResidents(value);
     root.RightNeighbour.AdjustResidents(value);
 }
 private void HandleHline(Cell root, sbyte value)
 {
     root.AdjustResidents(value);
     root.LeftNeighbour.AdjustResidents(value);
     root.RightNeighbour.AdjustResidents(value);
 }
 private void HandleVline(Cell root, sbyte value)
 {
     root.AdjustResidents(value);
     root.TopNeighbour.AdjustResidents(value);
     root.BottomNeighbour.AdjustResidents(value);
 }
 private void HandlePlus(Cell root, sbyte value)
 {
     root.AdjustResidents(value);
     root.TopNeighbour.AdjustResidents(value);
     root.BottomNeighbour.AdjustResidents(value);
     root.LeftNeighbour.AdjustResidents(value);
     root.RightNeighbour.AdjustResidents(value);
 }
 private void HandleNinetile(Cell root, sbyte value)
 {
     root.AdjustResidents(value);
     root.TopNeighbour.AdjustResidents(value);
     root.BottomNeighbour.AdjustResidents(value);
     root.LeftNeighbour.AdjustResidents(value);
     root.RightNeighbour.AdjustResidents(value);
     root.TopLeftNeighbour.AdjustResidents(value);
     root.TopRightNeighbour.AdjustResidents(value);
     root.BottomLeftNeighbour.AdjustResidents(value);
     root.BottomRightNeighbour.AdjustResidents(value);
 }
        private KeyValuePair<sbyte[], bool> CheckOverlapsState(Cell[] allCells)
        {
            bool levelCompleted = true;

            List<sbyte> overlapsChart = new List<sbyte>();
            foreach (Cell cell in allCells)
            {
                sbyte currentCellTilesCount = cell.ResidentTilesCount;
                if (currentCellTilesCount > 1)
                {
                    levelCompleted = false;
                }

                overlapsChart.Add(currentCellTilesCount);
            }

            return new KeyValuePair<sbyte[],bool>(overlapsChart.ToArray(), levelCompleted);
        }