Exemple #1
0
        private static void MinimusMaximus_Vs_RandBot()
        {
            Console.WriteLine("MinimusMaximus vs RandBot:");
            Console.WriteLine($"  MinimusMaximus - Blue");
            Console.WriteLine($"  RandBot - Red");
            Console.WriteLine();

            var minimusMaximus = new MinimusMaximus.TronBot();
            var randBot        = new RandBot.TronBot();

            var statistics = Duel.RunMultipleParallel(minimusMaximus, randBot, TronString.Create(), 100);

            Console.WriteLine(statistics);
            Console.WriteLine();
        }
Exemple #2
0
        public void Create_ShouldCreateBoardBasedOnTronString()
        {
            // Arrange
            const string rawTronString = "oooooo/orrr1o/o2R1o/o1Bbbo/o3bo/oooooo";

            // Act
            var parsedTronString = new TronString(rawTronString);

            // Assert
            var board = parsedTronString.Create();

            Assert.That(board.Width, Is.EqualTo(6));
            Assert.That(board.Height, Is.EqualTo(6));

            Assert.That(board.GetField(0, 0), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(1, 0), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(2, 0), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(3, 0), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(4, 0), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(5, 0), Is.EqualTo(Field.Obstacle));

            Assert.That(board.GetField(0, 1), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(1, 1), Is.EqualTo(Field.RedTail));
            Assert.That(board.GetField(2, 1), Is.EqualTo(Field.RedTail));
            Assert.That(board.GetField(3, 1), Is.EqualTo(Field.RedTail));
            Assert.That(board.GetField(4, 1), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(5, 1), Is.EqualTo(Field.Obstacle));

            Assert.That(board.GetField(0, 2), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(1, 2), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(2, 2), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(3, 2), Is.EqualTo(Field.RedHead));
            Assert.That(board.GetField(4, 2), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(5, 2), Is.EqualTo(Field.Obstacle));

            Assert.That(board.GetField(0, 3), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(1, 3), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(2, 3), Is.EqualTo(Field.BlueHead));
            Assert.That(board.GetField(3, 3), Is.EqualTo(Field.BlueTail));
            Assert.That(board.GetField(4, 3), Is.EqualTo(Field.BlueTail));
            Assert.That(board.GetField(5, 3), Is.EqualTo(Field.Obstacle));

            Assert.That(board.GetField(0, 4), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(1, 4), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(2, 4), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(3, 4), Is.EqualTo(Field.Empty));
            Assert.That(board.GetField(4, 4), Is.EqualTo(Field.BlueTail));
            Assert.That(board.GetField(5, 4), Is.EqualTo(Field.Obstacle));

            Assert.That(board.GetField(0, 5), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(1, 5), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(2, 5), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(3, 5), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(4, 5), Is.EqualTo(Field.Obstacle));
            Assert.That(board.GetField(5, 5), Is.EqualTo(Field.Obstacle));
        }
Exemple #3
0
        public void Create_ShouldCreateBoard_GivenTronStringWithMultiDigitNumbers()
        {
            // Arrange
            const string rawTronString = "o27o/o26oo";

            // Act
            var parsedTronString = new TronString(rawTronString);

            // Assert
            var board = parsedTronString.Create();

            Assert.That(board.Width, Is.EqualTo(29));
            Assert.That(board.Height, Is.EqualTo(2));
        }
Exemple #4
0
 public void MinimusMaximus()
 {
     _minimusMaximus.FindMove(_tronString.Create(), Color);
 }