public bool IsAdjacentTo(Position position) { //TODO: figure out a more functional way of doing this (e.g. one-line predicate for x and y) return (position.x == x - 1 && position.y == y - 1) || (position.x == x - 1 && position.y == y) || (position.x == x - 1 && position.y == y + 1) || (position.x == x && position.y == y - 1) || (position.x == x && position.y == y + 1) || (position.x == x + 1 && position.y == y - 1) || (position.x == x + 1 && position.y == y) || (position.x == x + 1 && position.y == y + 1); }
public Cell(Position position, State state) { Position = position; State = state; }
public Cell GetCellAt(Position position) { return cells.SingleOrDefault(cell => cell.Position.Equals(position)); }