public void MixedAllVertical() { var board = BoardSamples.Board1 .ApplyChanges( new BoardChange(0, 0, CellState.Filled), new BoardChange(0, 1, CellState.Filled), new BoardChange(0, 3, CellState.Filled), new BoardChange(0, 4, CellState.Blocked) ); var verticalGroup = SimpleGrouper.GroupVertical(board, 0); var expected = new List <Group> { new Group(CellState.Filled, 0, 2), new Group(CellState.None, 2, 1), new Group(CellState.Filled, 3, 1), new Group(CellState.Blocked, 4, 1) }; Assert.Equal(expected, verticalGroup.Groups); var horizontalGroup = SimpleGrouper.GroupHorizontal(board, 4); var expectedHorizontal = new List <Group> { new Group(CellState.Blocked, 0, 1), new Group(CellState.None, 1, 4) }; Assert.Equal(expectedHorizontal, horizontalGroup.Groups); }
public void EmptyBoardHorizontal() { var board = BoardSamples.Board1; var horizontalGroup = SimpleGrouper.GroupHorizontal(board, 0); var expected = new List <Group> { new Group(CellState.None, 0, 5) }; Assert.Equal(expected, horizontalGroup.Groups); }
private static void HorizontalRulesCheck(IBoard board, HashSet <BoardChange> changes) { for (int y = 0; y < board.Height; y++) { GroupCollection?groups = SimpleGrouper.GroupHorizontal(board, y); IRuleLine? ruleLine = board.LeftRules[y]; if (groups.ContainsNones && groups.SatisfiesRuleLine(ruleLine)) { for (int x = 0; x < board.Width; x++) { CellState state = board[x, y]; if (state == CellState.None) { changes.Add(BoardChange.Blocked(x, y)); } } } } }