private IEnumerable <CellConnection> GetNeighbors(int cellX, int cellY, CellConnections[,] cells, int gridWidth, int gridHeight) { if (cellX > 0) { CellConnections neighbor = cells[cellX - 1, cellY]; yield return(new RightNeighbor(neighbor)); } if (cellX < gridWidth - 1) { CellConnections neighbor = cells[cellX + 1, cellY]; yield return(new LeftNeighbor(neighbor)); } if (cellY > 0) { CellConnections neighbor = cells[cellX, cellY - 1]; yield return(new DownNeighbor(neighbor)); } if (cellY < gridHeight - 1) { CellConnections neighbor = cells[cellX, cellY + 1]; yield return(new UpNeighbor(neighbor)); } }
public CellState(IEnumerable <Tile> remainingOptions, CellConnections connections) { Connections = connections; RemainingOptions = remainingOptions.ToList().AsReadOnly(); CurrentChoice = RemainingOptions[0]; }
internal CellState GetCellState(CellConnections connections) { return(cellStateLookup[connections]); }
public CellConnection(CellConnections cell, Func <Tile, Tile, bool> comparisonFunction) { Cell = cell; this.comparisonFunction = comparisonFunction; }
public DownNeighbor(CellConnections neighborCell) : base(neighborCell, Connects) { }
public RightNeighbor(CellConnections neighborCell) : base(neighborCell, Connects) { }