예제 #1
0
        public SolutionStateForFlat(VisualsSolution solver, MainGrid grid)
            : base()
        {
            Dictionary <CellConnections, CellState> initialLookup = new Dictionary <CellConnections, CellState>();

            CellConnectionsForFlat[,] asGrid = new CellConnectionsForFlat[grid.Width, grid.Height];

            for (int x = 0; x < grid.Width; x++)
            {
                for (int y = 0; y < grid.Height; y++)
                {
                    GridCell item = grid.Cells[x, y];
                    CellConnectionsForFlat solverCell = new CellConnectionsForFlat(x, y);
                    asGrid[item.X, item.Y] = solverCell;
                }
            }
            for (int x = 0; x < grid.Width; x++)
            {
                for (int y = 0; y < grid.Height; y++)
                {
                    CellConnectionsForFlat connections = asGrid[x, y];
                    connections.SetNeighbors(x, y, asGrid, grid.Width, grid.Height);
                    IEnumerable <Tile> options   = grid.Cells[x, y].OptionsFromDesignation;
                    CellState          cellState = new CellState(options, connections);
                    initialLookup.Add(connections, cellState);
                }
            }
            this.cellStateLookup = initialLookup;
            foreach (CellState cellState in Cells)
            {
                cellState.SetStatus(this);
            }
        }
예제 #2
0
 private void ToggleCell(TileInteractionBehavior cell)
 {
     MainGrid.Designations.ToggleGridpoint(cell.X, cell.Y);
     foreach (GridCell item in cell.ConnectedCells)
     {
         item.ResetDesignationOptions();
     }
     solver = new VisualsSolution(MainGrid);
     DisplaySolve();
 }