Ejemplo n.º 1
0
        public void GenerateOneTypeOnly()
        {
            var types = new PieceType[] { t0 };
            var board = generator.GenerateRandom(8, types);

            Assert.IsTrue(board.IsFull());
            board.AllCoords.ToList().ForEach(c =>
                                             Assert.IsTrue(t0.Matches(board.Get(c).type)));
        }
Ejemplo n.º 2
0
        public void CanAlwaysSimulateAvailableMovesRnd()
        {
            for (int i = 0; i < 10; i++)
            {
                var board = generator.GenerateRandom(8, 3);
                var game  = new Game(board, GameRules.ClassicRules, PieceType.GetRange(0, 3));

                var logic = new PlayLogic(board);
                var moves = logic.AvailableMoves();
                foreach (var move in moves)
                {
                    var simulator = MoveSimulator.FromPotentialMove(board, move, game.NextPieceIfPlaying(move));
                    simulator.Simulate();
                    Assert.IsTrue(simulator.IsMovePossible());
                }
            }
        }
Ejemplo n.º 3
0
        public void AreEmptyDetectsNonEmpty()
        {
            var board = boardGen.GenerateRandom(4, 3);

            Assert.IsFalse(board.AllEmpty(new Coord[] { c00, c11 }));
            board.Remove(c00);
            Assert.IsFalse(board.AllEmpty(new Coord[] { c00, c11 }));
        }
Ejemplo n.º 4
0
        public void MovesSearchDoesNotChangeBoard()
        {
            var board = boardGen.GenerateRandom(8, 4);
            var logic = new PlayLogic(board);

            var clone = board.Clone();

            logic.AvailableMoves();
            Assert.IsTrue(clone.Matches(board), "board matches after searching for available moves");
        }