Exemple #1
0
        private static void TestHolder()
        {
            s = new StateEngine(@"../../output/Tests/Test/state.json");

            string move = s.TryDodge();
            Console.WriteLine("Dodge: " + move);
            move = s.TryShoot();
            Console.WriteLine("Shoot: " + move);
            move = s.TryBuild();
            Console.WriteLine("Build: " + move);
            move = s.TryPlace();
            Console.WriteLine("Place: " + move);
            move = s.TryShift();
            Console.WriteLine("Shift: " + move);
        }
Exemple #2
0
        private static void TestHolder()
        {
            s = new StateEngine(@"../../output/Tests/Test/state.json");

            string move = s.TryDodge();

            Console.WriteLine("Dodge: " + move);
            move = s.TryShoot();
            Console.WriteLine("Shoot: " + move);
            move = s.TryBuild();
            Console.WriteLine("Build: " + move);
            move = s.TryPlace();
            Console.WriteLine("Place: " + move);
            move = s.TryShift();
            Console.WriteLine("Shift: " + move);
        }
Exemple #3
0
        private string CreateMove()
        {
            if (state.Deity == null)
            {
                return("Nothing");
            }

            string move = state.TryDodge();

            if (move != null)
            {
                return(move);
            }

            move = state.TryShoot();

            if (move != null)
            {
                return(move);
            }

            move = state.TryBuild();

            if (move != null)
            {
                return(move);
            }

            move = this.state.TryPlace();

            if (move != null)
            {
                return(move);
            }

            move = this.state.TryShift();

            if (move != null)
            {
                return(move);
            }

            //move = state.TryBuild();
            //return GetRandomMove();
            return(CharonBot.Moves.Nothing.ToString());
        }
Exemple #4
0
        public static void TestDanger()
        {
            // N.B. Due to incorrect logic at the beginning, the names of some test cases are wrong. Test one above is really two above, and test two above is really three above.
            s = new StateEngine(@"../../output/Tests/TestDangerOneAboveBulletLeft/state.json");
            result = s.TryDodge();
            Console.WriteLine("Bullet one above left (Expected: MoveRight) - " + result); //Testing when danger is one above through a bullet to left. Expected: MoveRight
            if (!result.Equals("MoveRight")) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerOneAboveMissileRight/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile one above right (Expected: MoveLeft) - " + result); //Testing when danger is one above through a missile to right. Expected: MoveLeft
            if (!result.Equals("MoveLeft")) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerOneAboveMissileMiddle/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile one above middle (Expected: Shoot) - " + result); //Testing when danger is one above through a missile. Expected: Shoot
            if (!result.Equals("Shoot")) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerOneAboveMissileMiddleCantShoot/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile one above middle can't shoot (Expected: null) - " + result); //Testing when danger is one above through a missile. Expected: null
            if (result != null) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerTwoAboveBulletLeft/state.json");
            result = s.TryDodge();
            Console.WriteLine("Bullet two above left (Expected: null) - " + result); //Testing when danger is two above through a bullet to left. Expected: null
            if (result != null) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileRight/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above right (Expected: null) - " + result); //Testing when danger is two above through a missile to right. Expected: null
            if (result != null) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileMiddle/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above middle (Expected: MoveRight) - " + result); //Testing when danger is two above through a missile. Expected: MoveRight
            if (!result.Equals("MoveRight")) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileMiddleCantShoot/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above middle can't shoot (Expected: null) - " + result); //Testing when danger is two above through a missile. Expected: null
            if (result != null) Debugger.Break();

            s = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileMiddleCantMove/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above middle can't move (Expected: Shoot) - " + result); //Testing when danger is two above through a missile. Expected: shoot
            if (!result.Equals("Shoot")) Debugger.Break();
        }
Exemple #5
0
        public static void TestDanger()
        {
            // N.B. Due to incorrect logic at the beginning, the names of some test cases are wrong. Test one above is really two above, and test two above is really three above.
            s      = new StateEngine(@"../../output/Tests/TestDangerOneAboveBulletLeft/state.json");
            result = s.TryDodge();
            Console.WriteLine("Bullet one above left (Expected: MoveRight) - " + result); //Testing when danger is one above through a bullet to left. Expected: MoveRight
            if (!result.Equals("MoveRight"))
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerOneAboveMissileRight/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile one above right (Expected: MoveLeft) - " + result); //Testing when danger is one above through a missile to right. Expected: MoveLeft
            if (!result.Equals("MoveLeft"))
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerOneAboveMissileMiddle/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile one above middle (Expected: Shoot) - " + result); //Testing when danger is one above through a missile. Expected: Shoot
            if (!result.Equals("Shoot"))
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerOneAboveMissileMiddleCantShoot/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile one above middle can't shoot (Expected: null) - " + result); //Testing when danger is one above through a missile. Expected: null
            if (result != null)
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerTwoAboveBulletLeft/state.json");
            result = s.TryDodge();
            Console.WriteLine("Bullet two above left (Expected: null) - " + result); //Testing when danger is two above through a bullet to left. Expected: null
            if (result != null)
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileRight/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above right (Expected: null) - " + result); //Testing when danger is two above through a missile to right. Expected: null
            if (result != null)
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileMiddle/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above middle (Expected: MoveRight) - " + result); //Testing when danger is two above through a missile. Expected: MoveRight
            if (!result.Equals("MoveRight"))
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileMiddleCantShoot/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above middle can't shoot (Expected: null) - " + result); //Testing when danger is two above through a missile. Expected: null
            if (result != null)
            {
                Debugger.Break();
            }

            s      = new StateEngine(@"../../output/Tests/TestDangerTwoAboveMissileMiddleCantMove/state.json");
            result = s.TryDodge();
            Console.WriteLine("Missile two above middle can't move (Expected: Shoot) - " + result); //Testing when danger is two above through a missile. Expected: shoot
            if (!result.Equals("Shoot"))
            {
                Debugger.Break();
            }
        }