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); }
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); }
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()); }
public static void TestShooting() { s = new StateEngine(@"../../output/Tests/TryShootSuccessfully/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, shot moving right (Expected: Shoot) - " + result); //Shoot, aliens move right, success if (!result.Equals("Shoot")) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootFail/state.json"); result = s.TryShoot(); Console.WriteLine("Shoot, aliens move right, fail (Expected: null) - " + result); // Shoot, aliens move right, fail if (result != null) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootFailWhenMoveDown/state.json"); result = s.TryShoot(); Console.WriteLine("Shoot, aliens move down, fail - " + result); // Shoot, aliens move down, fail if (result != null) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootFailWhenMoveLeft/state.json"); result = s.TryShoot(); Console.WriteLine("Shoot, aliens move left, fail - " + result); // Shoot, aliens move left, fail if (result != null) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootSuccessfullyWhenMoveDown/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, shot moving right - " + result); // Shoot, aliens move down, success if (!result.Equals("Shoot")) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootSuccessfullyMoveLeft/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, shot moving right (Expected: Shoot) - " + result); if (!result.Equals("Shoot")) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBest/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, but rather wait for another one (Expected: null) - " + result); if (result != null) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBestButDanger/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, wait for another, but danger (Expected: Shoot) - " + result); if (!result.Equals("Shoot")) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBestTwoRounds/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, but rather wait for another two rounds (Expected: null) - " + result); if (result != null) Debugger.Break(); s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBad/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, but rather wait for another one, but shouldn't because that's worse (Expected: Shoot) - " + result); if (!result.Equals("Shoot")) Debugger.Break(); }
public static void TestShooting() { s = new StateEngine(@"../../output/Tests/TryShootSuccessfully/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, shot moving right (Expected: Shoot) - " + result); //Shoot, aliens move right, success if (!result.Equals("Shoot")) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootFail/state.json"); result = s.TryShoot(); Console.WriteLine("Shoot, aliens move right, fail (Expected: null) - " + result); // Shoot, aliens move right, fail if (result != null) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootFailWhenMoveDown/state.json"); result = s.TryShoot(); Console.WriteLine("Shoot, aliens move down, fail - " + result); // Shoot, aliens move down, fail if (result != null) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootFailWhenMoveLeft/state.json"); result = s.TryShoot(); Console.WriteLine("Shoot, aliens move left, fail - " + result); // Shoot, aliens move left, fail if (result != null) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootSuccessfullyWhenMoveDown/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, shot moving right - " + result); // Shoot, aliens move down, success if (!result.Equals("Shoot")) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootSuccessfullyMoveLeft/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, shot moving right (Expected: Shoot) - " + result); if (!result.Equals("Shoot")) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBest/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, but rather wait for another one (Expected: null) - " + result); if (result != null) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBestButDanger/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, wait for another, but danger (Expected: Shoot) - " + result); if (!result.Equals("Shoot")) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBestTwoRounds/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, but rather wait for another two rounds (Expected: null) - " + result); if (result != null) { Debugger.Break(); } s = new StateEngine(@"../../output/Tests/TryShootWaitWouldBeBad/state.json"); result = s.TryShoot(); Console.WriteLine("Try shoot successfully, but rather wait for another one, but shouldn't because that's worse (Expected: Shoot) - " + result); if (!result.Equals("Shoot")) { Debugger.Break(); } }