Пример #1
0
        public void FindsDroppablesAboveDouble()
        {
            var board       = builder.FromTypeGrid("0101 1101 1100 1110");
            var logic       = new PlayLogic(board);
            var expected    = Coord.SquareRange(c02, 2).Select(c => board.Get(c));
            var pieceCoords = Coord.SquareRange(c00, 2);

            foreach (var coord in pieceCoords)
            {
                var droppables = logic.GetDroppablesAbove(board.Get(coord));
                CollectionAssert.AreEquivalent(expected, droppables);
            }
        }
Пример #2
0
        public void NotDroppableIfNotAligned()
        {
            var board = builder.FromTypeGrid(new int[, ] {
                { 0, 1, 2, 2 },
                { 1, 1, 2, 2 },
                { 1, 0, 0, 1 },
                { 0, 0, 0, 1 }
            });
            var logic    = new PlayLogic(board);
            var bigPiece = board.Get(c22);

            foreach (var piece in board.GetAll(c10, c20, c11, c21))
            {
                var droppables = logic.GetDroppablesAbove(piece);
                CollectionAssert.DoesNotContain(droppables, bigPiece);
            }
        }
Пример #3
0
        public void FindsDroppablesAbove()
        {
            var board = builder.FromTypeGrid(new int[, ] {
                { 0, 1, 2, 0 },
                { 1, 1, 0, 2 },
                { 1, 2, 1, 1 },
                { 0, 1, 1, 1 }
            });
            var logic = new PlayLogic(board);
            var tests = new Dictionary <Coord, Coord[]> {
                { c00, new Coord[] { c01, c02, c03 } },
                { c02, new Coord[] { c03 } },
                { c11, new Coord[] { c12, c13 } },
                { c20, new Coord[] { c22, c23, c32, c33 } }
            };

            foreach (var coord in tests.Keys)
            {
                var droppables = logic.GetDroppablesAbove(board.Get(coord));
                var expected   = board.GetAll(tests[coord]);
                CollectionAssert.AreEquivalent(expected, droppables);
            }
        }