Class Homework Assignment for INTRO COMP SCI

I have a peculiar case with mine that its 75% complete but I can't figure out the last 25% of the code (it has been pointed out in a screenshot what needs to be fixed from my professor and a Results.txt for what the problem are. Also how to compile the code is attached In a screenshot as well) Also, we are given an AssignmentTest code to help check our progress to see what we are getting and what we are not getting this is for Java, and it's due tonight at 11:59 pm. The puzzle is basically almost done I just need you to finish the last 25% I'd pay somewhere around $30-$50 if you can pull it off {most details are in zip file attached} It's a doom bot should mention its 11:59pm EST

Get Help With a similar task to - Class Homework Assignment for INTRO COMP SCI

Login to view and/or buy answers.. or post an answer
Additional Instructions:

Assignment9Tests.java Assignment9Tests.java package edu.yu.cs.intro.doomGame; import edu.yu.cs.intro.TestHelper; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.*; public class Assignment9Tests {     class IncorrectBehaviorException extends RuntimeException{         public IncorrectBehaviorException(String message){             super(message);         }     };     private TestHelper helper;     private String output;     private int pointsEarned;     private int possiblePoints;     protected static final String PASSED = "+++++TEST PASSED+++++\n\n";     protected static final String FAILED = "+++++TEST FAILED+++++\n\n";     public static void main(String[] args) throws IOException {         Assignment9Tests a8t = new Assignment9Tests();         a8t.runTests();         writeResultsToFile(a8t.pointsEarned,a8t.possiblePoints,a8t.output);     }     protected static void writeResultsToFile(int pointsEarned, int possiblePoints, String output) throws IOException{         //write points file         File pointsFile = new File("grade.txt");         pointsFile.createNewFile();         PrintWriter writer = new PrintWriter(pointsFile);         writer.println(pointsEarned);         writer.flush();         writer.close();         //write details file         File details = new File("results.txt");         details.createNewFile();         writer = new PrintWriter(details);         writer.println("YOUR SCORE: " + pointsEarned + " out of " + possiblePoints + "\n");         writer.println(output);         writer.flush();         writer.close();     }     public Assignment9Tests() {         this.helper = new TestHelper();         this.helper.setCharDifLimit(12);         this.output = "";         this.pointsEarned = 0;         this.possiblePoints = 0;     }     private void runTest(String name, String description) {         this.runTest(12,name,description);     }     private void runTest(int points, String name, String description){         try {             this.output += "TEST NAME: " + name + "\n";             this.output += "TEST DESCRIPTION: " + description + "\n";             this.output += "TEST POINT VALUE: " + points + "\n";             this.possiblePoints += points;             this.helper.runMethod(Assignment9Tests.class,this,name);             this.output += PASSED;             this.pointsEarned += points;         }         catch (Throwable e) {             this.output += this.helper.getExceptionOutput(e.getCause());             this.output += FAILED;         }     }     public void runTests() {         //tests on Monster         this.runTest("testAttackWithInsufficientWeapon", "Monster: does monster.attack throw an IllegalArgumentException when attacked with an insufficient weapon?");         this.runTest("testAttackWithNoAmmo", "Monster: does monster.attack throw an IllegalArgumentException when attacked with no ammunition?");         this.runTest("testAttackDeadMonster", "Monster: does Monster.attack throw an IllegalStateException when the monster was attacked when it was already dead?");         this.runTest("testAttackMonsterButDontKillMonster", "Monster: Monster.isDead should return false after being attacked with less than ammunitionCountNeededToKill");         this.runTest("testKillMonsterInTwoPasses", "Monster: Monster attacked with ammunitionCountNeededToKill over the course of 2 calls on monster.attack should be dead, i.e. should return true from isDead()");         this.runTest("testGetDefaultProtector", "Monster: Monster with no custom protector should return the protector of its monster type from Monster.getProtectedBy()");         this.runTest("testGetCustomProtector", "Monster: Monster with custom protector should return the custom protector from Monster.getProtectedBy()");         this.runTest("testMonsterCompareTo", "Monster: test Monster.compareTo");         //tests on player         this.runTest("testPlayerDeath", "Player: Does Player.isDead return true when health is == 0?");         this.runTest("testPlayerAlive", "Player: Does Player.isDead return false when health is == 100?");         this.runTest("testChangePlayerHealth", "Player: Does Player.changeHealth result in health changing as expected?");         this.runTest("testReducePlayerHealth", "Player: Does Player.changeHealth, with a negative number, result in health changing as expected?");         this.runTest("testAddAmmo", "Player: Does Player.addAmmunition result in ammunition count changing as expected?");         this.runTest("testChangeAmmo", "Player: Does Player.changeAmmunitionRoundsForWeapon result in ammunition count changing as expected?");         this.runTest("testReduceAmmo", "Player: Does Player.changeAmmunitionRoundsForWeapon result in ammunition count beign reduced as expected?");         this.runTest("testHasWeapon", "Player: Does Player.hasWeapon return what is expected based on what weapons we have given him?");         this.runTest("testPlayerCompareTo", "Player: Does Player.compareTo return what is expected?");         //tests on Room         this.runTest("testRoomDangerLevel", "Room: Danger level should equal ordinal+1 values of all monsters combined");         this.runTest("testRoomCompareTo", "Room: compareTo should compare based on danger level");         this.runTest("testGetWeaponsWonUponCompletion", "Room: did not get expected set of weapons won upon completion");         this.runTest("testGetWeaponsWonUponCompletion", "Room: check keys and values of room.getAmmoWonUponCompletion()");         //tests on GameBot         this.runTest(36,"testSinglePlayerSuccessGame", "GameBot: Play Single Player Success");         this.runTest(36,"testSinglePlayerFailureGame", "GameBot: Play Single Player Failure");         this.runTest(36,"testMultiPlayerSuccessGame", "GameBot: Play Multi-Player Success");         this.runTest(36,"testMultiPlayerFailureGame", "GameBot: Play Multi-Player Failure");         this.runTest(36,"testReapCompletionRewards", "GameBot: Check that player reaps the rewards of completing a room: GameBot.reapCompletionRewards()");         this.runTest(36,"testKillMonster", "GameBot: Check that killMonster kills the right set of monsters and results in the correct changes to the player");         this.runTest("testGetCompletedRooms", "GameBot: Check that Gamebot.getCompletedRooms() returns all completed rooms, and no other rooms");         this.runTest("testGetLivePlayers", "GameBot: Check that Gamebot.getLivePlayers() returns all live players, and no other players");         this.runTest("testGetLivePlayersWithWeaponAndAmmunition", "GameBot: Check that Gamebot.getLivePlayersWithWeaponAndAmmunition() returns the correct set of players");         this.runTest(24, "testGetAllProtectorsInRoom", "GameBot: Check that Gamebot.getAllProtectorsInRoom() returns the correct set of monsters");         this.runTest(36, "testCanKill", "GameBot: Check that Gamebot.canKill() responds correctly");     }     //***************test the GameBot class***************     public void testCanKill(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> group = new TreeSet<>();         group.add(baron);         group.add(imp);         group.add(spectre);         group.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room fearsome = new Room(group,weapons,ammoWonUponCompletion,0,"Fearsome Foursome");         Player p = new Player("test dummy", 100);         if(!GameBot.canKill(p,imp,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned false for a healthy player being able to kill an imp");         }         p = new Player("test dummy", 0);         if(GameBot.canKill(p,imp,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned true for a dead player being able to kill an imp");         }         p = new Player("test dummy", 100);         p.addWeapon(Weapon.CHAINSAW);         if(GameBot.canKill(p,demon,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned true for a player with the chainsaw and 5 rounds of ammo being able to kill the demon even through he doesn't have the shotgun to kill his protector, the baron of hell");         }         p.addWeapon(Weapon.SHOTGUN);         p.addAmmunition(Weapon.SHOTGUN,7);         if(GameBot.canKill(p,demon,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned true for a player being able to kill a demon even though he doesn't have the pistol to kill the protector's protector, i.e. spectre" );         }         p.addWeapon(Weapon.PISTOL);         if(GameBot.canKill(p,demon,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned true for a player being able to kill a demon even though he doesn't have enough pistol ammo to kill the protector's protector, i.e. spectre" );         }         p.addAmmunition(Weapon.PISTOL,1);         if(!GameBot.canKill(p,demon,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned false for a player being able to kill a demon even though he should be able to");         }         p.setHealth(10);         if(GameBot.canKill(p,demon,fearsome)){             throw new IncorrectBehaviorException("GameBot.canKill returned true for a player being able to kill a demon even though he will run out of health before killing the demon");         }     }     public void testGetAllProtectorsInRoom(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> group = new TreeSet<>();         group.add(baron);         group.add(imp);         group.add(spectre);         group.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room fearsome = new Room(group,weapons,ammoWonUponCompletion,0,"Fearsome Foursome");         SortedSet<Monster> protectors = GameBot.getAllProtectorsInRoom(imp,fearsome);         if(protectors.size() != 0){             throw new IncorrectBehaviorException("GameBot.getAllProtectorsInRoom returned at least one protector for a monster that had none");         }         protectors = GameBot.getAllProtectorsInRoom(demon,fearsome);         if(protectors.size() != 2 || !protectors.contains(spectre) || !protectors.contains(baron)){             throw new IncorrectBehaviorException("GameBot.getAllProtectorsInRoom did not return the two protectors of the demon");         }         protectors = GameBot.getAllProtectorsInRoom(baron,fearsome);         if(protectors.size() != 1 || !protectors.contains(spectre)){             throw new IncorrectBehaviorException("GameBot.getAllProtectorsInRoom did not return the one protector of the baron of hell");         }     }     public void testGetLivePlayersWithWeaponAndAmmunition(){         Player p1 = new Player("p1", 100);         p1.addWeapon(Weapon.PISTOL);         p1.addAmmunition(Weapon.PISTOL,12);         p1.addWeapon(Weapon.SHOTGUN);         p1.addAmmunition(Weapon.SHOTGUN,12);         Player p2 = new Player("p2", 100);         p2.addWeapon(Weapon.PISTOL);         p2.addAmmunition(Weapon.PISTOL,15);         Player p3 = new Player("p3", 100);         p3.addWeapon(Weapon.SHOTGUN);         p3.addAmmunition(Weapon.SHOTGUN,18);         Player p4 = new Player("p4", 100);         p4.addWeapon(Weapon.CHAINSAW);         p4.addAmmunition(Weapon.CHAINSAW,12);         TreeSet<Player> players = new TreeSet<>();         players.add(p1);         players.add(p2);         players.add(p3);         players.add(p4);         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(createEasyImpsRoom());         GameBot bot = new GameBot(rooms,players);         //one player out of two with the given weapon has enough ammo         Set<Player> armed = bot.getLivePlayersWithWeaponAndAmmunition(Weapon.PISTOL,19);         if(armed.size() != 1 || !armed.contains(p2)){             throw new IncorrectBehaviorException("bot.getLivePlayersWithWeaponAndAmmunition did not return the expected player (p2)");         }         //two players with weapon and enough ammo         armed = bot.getLivePlayersWithWeaponAndAmmunition(Weapon.PISTOL,17);         if(armed.size() != 2 || !armed.contains(p2) || !armed.contains(p1) ){             throw new IncorrectBehaviorException("bot.getLivePlayersWithWeaponAndAmmunition did not return the expected players (p1,p2)");         }         //one player with the weapon & ammo         armed = bot.getLivePlayersWithWeaponAndAmmunition(Weapon.CHAINSAW,17);         if(armed.size() != 1 || !armed.contains(p4)){             throw new IncorrectBehaviorException("bot.getLivePlayersWithWeaponAndAmmunition did not return the expected players (p4)");         }         //NO player with the weapon & ammo         armed = bot.getLivePlayersWithWeaponAndAmmunition(Weapon.SHOTGUN,100);         if(armed.size() != 0 ){             throw new IncorrectBehaviorException("bot.getLivePlayersWithWeaponAndAmmunition did not return the expected players (none!)");         }         //ALL players with the weapon & ammo         armed = bot.getLivePlayersWithWeaponAndAmmunition(Weapon.FIST,1000);         if(armed.size() != 4 ){             throw new IncorrectBehaviorException("bot.getLivePlayersWithWeaponAndAmmunition did not return the expected players (all players)");         }     }     public void testGetLivePlayers(){         Player p1 = new Player("p1", 100);         Player p2 = new Player("p2", 101);         Player p3 = new Player("p3", 102);         Player p4 = new Player("p4", 103);         TreeSet<Player> players = new TreeSet<>();         players.add(p1);         players.add(p2);         players.add(p3);         players.add(p4);         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(createEasyImpsRoom());         GameBot bot = new GameBot(rooms,players);         p2.setHealth(0);         p4.setHealth(0);         Set<Player> live = bot.getLivePlayers();         if(live.size()!= 2 || !live.contains(p1) || !live.contains(p3)){             throw new IncorrectBehaviorException("A Player which was alive was missing in the set returned by GameBot.getLivePlayers() or there was the wrong number elements in the set");         }     }     public void testGetCompletedRooms(){         GameBot bot = createSinglePlayerFailure();         bot.play();         Set<Room> rooms = bot.getCompletedRooms();         if(rooms.size() != 2 ||                 findRoomByName(rooms,"Easy Imps") == null ||                 findRoomByName(rooms,"Double Demonic") == null){             throw new IncorrectBehaviorException("A Room which was completed was missing in the set returned by GameBot.getCompletedRooms() or there was the wrong number elements in the set");         }     }     private Room findRoomByName(Set<Room> rooms, String name){         for(Room room : rooms){             if(room.getName().equals(name)){                 return room;             }         }         return null;     }     public void testKillMonster(){         //setup the room         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> monsters = new TreeSet<>();         monsters.add(baron);         monsters.add(imp);         monsters.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"test room");         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(room);         //setup the player         TreeSet<Player> players = new TreeSet<>();         int initialhealth = 100;         Player p = new Player("test man",initialhealth);         p.addWeapon(demon.getMonsterType().weaponNeededToKill);         if(demon.getMonsterType().ammunitionCountNeededToKill > 5){             p.addAmmunition(demon.getMonsterType().weaponNeededToKill,demon.getMonsterType().ammunitionCountNeededToKill - 5);         }         p.addWeapon(baron.getMonsterType().weaponNeededToKill);         if(baron.getMonsterType().ammunitionCountNeededToKill > 5){             p.addAmmunition(baron.getMonsterType().weaponNeededToKill,baron.getMonsterType().ammunitionCountNeededToKill - 5);         }         players.add(p);         //test the gameBot's changes to a player after monsters are killed         GameBot g = new GameBot(rooms,players);         g.killMonster(p,room,demon);         //check that monsters are dead         if(!baron.isDead()){             throw new IncorrectBehaviorException("after killMonster was called on demon, baronOfHell should be dead as well");         }         if(!demon.isDead()){             throw new IncorrectBehaviorException("after killMonster was called on demon, demon should be dead");         }         //check that ammunition has been reduced         if(p.getAmmunitionRoundsForWeapon(baron.getMonsterType().weaponNeededToKill) != 0){             throw new IncorrectBehaviorException("killing the baron of hell should've used up all the ammunition for the weapon needed to kill it");         }         if(p.getAmmunitionRoundsForWeapon(demon.getMonsterType().weaponNeededToKill) != 4){             throw new IncorrectBehaviorException("killing the demon should've used up one round of chainsaw ammo, leaving 4");         }         //check that health has been reduced         int expectedReduction = (demon.getMonsterType().playerHealthLostPerExposure * 2) + baron.getMonsterType().playerHealthLostPerExposure + (imp.getMonsterType().playerHealthLostPerExposure * 2);         if(p.getHealth() != initialhealth - expectedReduction){             throw new IncorrectBehaviorException("Player health was nto reduced by expected amount when killing a monster");         }     }     public void testReapCompletionRewards(){         TreeSet<Monster> monsters = new TreeSet<>();         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.PISTOL);         weapons.add(Weapon.SHOTGUN);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.PISTOL,10);         ammoWonUponCompletion.put(Weapon.CHAINSAW,10);         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"test room");         Player p = new Player("test man",10);         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(room);         TreeSet<Player> players = new TreeSet<>();         players.add(p);         GameBot g = new GameBot(rooms,players);         g.reapCompletionRewards(p,room);         if(!p.hasWeapon(Weapon.PISTOL)  || p.getAmmunitionRoundsForWeapon(Weapon.PISTOL)!= 15){             throw new IncorrectBehaviorException("Player should have the pistol and 15 rounds of ammunition");         }         if(!p.hasWeapon(Weapon.SHOTGUN)  || p.getAmmunitionRoundsForWeapon(Weapon.SHOTGUN)!= 5){             throw new IncorrectBehaviorException("Player should have the shotgun and 5 rounds of ammunition");         }         if(p.getAmmunitionRoundsForWeapon(Weapon.CHAINSAW)!= 10){             throw new IncorrectBehaviorException("Player should have 5 rounds of ammunition for the shotgun");         }         if(p.getHealth()!= 30){             throw new IncorrectBehaviorException("Player should have 30 health units");         }     }     public void testMultiPlayerFailureGame(){         String gameName = "Multi-Player Failure";         boolean success = playAndReport(createMultiPlayerFailure(),"Multi-Player Failure");         if(success){             throw new IncorrectBehaviorException("The test game " + gameName + " succeeded, although it was expected to fail");         }     }     public void testMultiPlayerSuccessGame(){         String gameName = "Multi-Player Success";         boolean success = playAndReport(createMultiPlayerSuccess(),"Multi-Player Success");         if(!success){             throw new IncorrectBehaviorException("The test game " + gameName + " failed, although it was expected to succeed");         }     }     public void testSinglePlayerFailureGame(){         String gameName = "Single Player Failure";         boolean success = playAndReport(createSinglePlayerFailure(),"Single Player Failure");         if(success){             throw new IncorrectBehaviorException("The test game " + gameName + " succeeded, although it was expected to fail");         }     }     public void testSinglePlayerSuccessGame(){         String gameName = "Single Player Success";         boolean success = playAndReport(createSinglePlayerSuccess(),gameName);         if(!success){             throw new IncorrectBehaviorException("The test game " + gameName + " failed, although it was expected to succeed");         }     }     //***************test the Room class***************     public void testGetPlayerHealthLostPerEncounter(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> monsters = new TreeSet<>();         monsters.add(baron);         monsters.add(imp);         monsters.add(spectre);         monsters.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"Fearsome Foursome");         int healthLost = 0;         for(Monster m : monsters){             healthLost += m.getMonsterType().playerHealthLostPerExposure;         }         if(healthLost != room.getPlayerHealthLostPerEncounter()){             throw new IncorrectBehaviorException("room.getPlayerHealthLostPerEncounter() should equal the sum of playerHealthLostPerExposure values of all live monsters combined. Expected: " + healthLost + ". Actual: " + room.getPlayerHealthLostPerEncounter());         }     }     public void testResultsOfMonsterDeath(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> monsters = new TreeSet<>();         monsters.add(baron);         monsters.add(imp);         monsters.add(spectre);         monsters.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"Fearsome Foursome");         baron.attack(baron.getMonsterType().weaponNeededToKill,baron.getMonsterType().ammunitionCountNeededToKill);         room.monsterKilled(baron);         if(room.isCompleted()){             throw new IncorrectBehaviorException("Room is not considered completed until all monsters are dead");         }         if(room.getMonsters().size() != 4){             throw new IncorrectBehaviorException("size of room.getMonsters() is not the expected size");         }         if(room.getLiveMonsters().size() != 3){             throw new IncorrectBehaviorException("size of room.getLiveMonsters() is not the expected size");         }         if(room.getDeadMonsters().size() != 1){             throw new IncorrectBehaviorException("size of room.getDeadMonsters() is not the expected size");         }     }     public void testGetAmmoWonUponCompletion(){         TreeSet<Monster> monsters = new TreeSet<>();         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.CHAINSAW);         weapons.add(Weapon.PISTOL);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"Fearsome Foursome");         if(!room.getWeaponsWonUponCompletion().contains(Weapon.CHAINSAW) || !room.getWeaponsWonUponCompletion().contains(Weapon.PISTOL) || room.getWeaponsWonUponCompletion().size() != 2){             throw new IncorrectBehaviorException("did not get expected set of weapons won upon completion");         }     }     public void testGetWeaponsWonUponCompletion(){         TreeSet<Monster> monsters = new TreeSet<>();         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.PISTOL,5);         ammoWonUponCompletion.put(Weapon.CHAINSAW,10);         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"Fearsome Foursome");         if(!room.getAmmoWonUponCompletion().keySet().contains(Weapon.PISTOL) || !room.getAmmoWonUponCompletion().keySet().contains(Weapon.CHAINSAW)){             throw new IncorrectBehaviorException("An expected key is missing from the set returned by room.getAmmoWonUponCompletion()");         }         if(room.getAmmoWonUponCompletion().get(Weapon.PISTOL)!=5 || room.getAmmoWonUponCompletion().get(Weapon.CHAINSAW)!=10){             throw new IncorrectBehaviorException("An expected value is wrong in the set returned by room.getAmmoWonUponCompletion()");         }     }     public void testRoomCompareTo(){         Monster imp = new Monster(MonsterType.IMP);         Monster imp2 = new Monster(MonsterType.IMP);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> monsters = new TreeSet<>();         monsters.add(imp);         monsters.add(imp2);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         Room room1 = new Room(monsters,weapons,ammoWonUponCompletion,20,"room1");         TreeSet<Monster> monsters2 = new TreeSet<>();         monsters.add(baron);         Room room2 = new Room(monsters,weapons,ammoWonUponCompletion,20,"room2");         if(room1.compareTo(room2) != -1){             throw new IncorrectBehaviorException("compareTo should compare based on danger level; expected -1, actual return value: " + room1.compareTo(room2));         }         if(room2.compareTo(room1) != 1){             throw new IncorrectBehaviorException("compareTo should compare based on danger level; expected 1, actual return value: " + room2.compareTo(room1));         }     }     public void testRoomDangerLevel(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> monsters = new TreeSet<>();         monsters.add(baron);         monsters.add(imp);         monsters.add(spectre);         monsters.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.CHAINSAW);         weapons.add(Weapon.PISTOL);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.PISTOL,5);         ammoWonUponCompletion.put(Weapon.CHAINSAW,10);         Room room = new Room(monsters,weapons,ammoWonUponCompletion,20,"Fearsome Foursome");         int danger = 0;         for(Monster m : monsters){             danger += m.getMonsterType().ordinal() + 1;         }         if(danger != room.getDangerLevel()){             throw new IncorrectBehaviorException("Danger level should equal ordinal+1 values of all live monsters combined. Expected: " + danger + ". Actual: " + room.getDangerLevel());         }         baron.attack(baron.getMonsterType().weaponNeededToKill,baron.getMonsterType().ammunitionCountNeededToKill);         room.monsterKilled(baron);         spectre.attack(spectre.getMonsterType().weaponNeededToKill,spectre.getMonsterType().ammunitionCountNeededToKill);         room.monsterKilled(spectre);         danger -= (baron.getMonsterType().ordinal()+1 + spectre.getMonsterType().ordinal() +1);         int roomLevel = room.getDangerLevel();         if(danger != roomLevel){             throw new IncorrectBehaviorException("Danger level should equal ordinal+1 values of all live monsters combined. Expected: " + danger + ". Actual: " + roomLevel);         }     }     //***************test the Player class***************     public void testHasWeapon() {         //test has weapon         Player p = new Player("test man",100);         p.addWeapon(Weapon.CHAINSAW);         if(!(p.hasWeapon(Weapon.CHAINSAW) && p.hasWeapon(Weapon.FIST))){             throw new IncorrectBehaviorException("Player.hasWeapon is returning false for a weapon that he should have (either FIRST or one that was added)");         }         if( p.hasWeapon(Weapon.PISTOL) || p.hasWeapon(Weapon.SHOTGUN)){             throw new IncorrectBehaviorException("Player.hasWeapon is returning true for a weapon that he should NOT have");         }     }     public void testPlayerCompareTo(){         //test compareTo - same weapons and ammo         Player p = new Player("test man",100);         Player p2 = new Player("test man2",100);         if(p.compareTo(p2) != 0){             throw new IncorrectBehaviorException("Player.compareTo is not returning 0 for equivalent players");         }         //p has greater weapon         p = new Player("test man",100);         p2 = new Player("test man2",100);         p.addWeapon(Weapon.PISTOL);         p2.addWeapon(Weapon.CHAINSAW);         if(p.compareTo(p2) != 1){             throw new IncorrectBehaviorException("Player.compareTo is not returning 1 when the player on which it is being called has a greater weapon");         }         //same weapon, p2 has more ammo         p = new Player("test man",100);         p2 = new Player("test man2",100);         p.addWeapon(Weapon.PISTOL);         p2.addWeapon(Weapon.PISTOL);         p2.addAmmunition(Weapon.PISTOL,10);         if(p.compareTo(p2) != -1){             throw new IncorrectBehaviorException("Player.compareTo is not returning -1 when the player on which it is being called has less ammunition");         }         //same weapon and ammo, p has more health         p = new Player("test man",110);         p2 = new Player("test man2",100);         p.addWeapon(Weapon.PISTOL);         p2.addWeapon(Weapon.PISTOL);         if(p.compareTo(p2) != 1){             throw new IncorrectBehaviorException("Player.compareTo is not returning 1 when the player on which it is being called has more health");         }     }     public void testChangeAmmo() {         //test change ammo, positive         Player p = new Player("test man",100);         p.addWeapon(Weapon.CHAINSAW);         p.changeAmmunitionRoundsForWeapon(Weapon.CHAINSAW,10);         if(p.getAmmunitionRoundsForWeapon(Weapon.CHAINSAW) != 15){             throw new IncorrectBehaviorException("Player.changeAmmunitionRoundsForWeapon did not result in ammunition count changing as expected");         }     }     public void testReduceAmmo() {         //test change ammo, negative         Player p = new Player("test man",100);         p.addWeapon(Weapon.CHAINSAW);         p.changeAmmunitionRoundsForWeapon(Weapon.CHAINSAW,-3);         if(p.getAmmunitionRoundsForWeapon(Weapon.CHAINSAW) != 2){             throw new IncorrectBehaviorException("Player.changeAmmunitionRoundsForWeapon did not result in ammunition count beign reduced as expected");         }     }     public void testPlayerDeath() {         //test player death         Player p = new Player("test man", 100);         p.setHealth(0);         if(!p.isDead()){             throw new IncorrectBehaviorException("Player.isDead did not return true when health was == 0");         }     }     public void testPlayerAlive() {         //test set health, non-zero         Player p = new Player("test man", 100);         if(p.isDead()){             throw new IncorrectBehaviorException("Player.isDead did not return false when health was == 100");         }     }     public void testChangePlayerHealth() {         //test change player health, positive         Player p = new Player("test man",100);         p.changeHealth(50);         if(p.getHealth() != 150){             throw new IncorrectBehaviorException("Player.changeHealth did not result in health changing as expected");         }     }     public void testReducePlayerHealth() {         //test change player health, positive         Player p = new Player("test man",100);         p.changeHealth(-50);         if(p.getHealth() != 50){             throw new IncorrectBehaviorException("Player.changeHealth, with a negative number, did not result in health changing as expected");         }     }     public void testAddAmmo() {         //test add ammunition followed by adding the weapon for which the ammo is for         Player p = new Player("test man",100);         p.addAmmunition(Weapon.PISTOL,10);         if(p.getAmmunitionRoundsForWeapon(Weapon.PISTOL)!=10){             throw new IncorrectBehaviorException("Player.addAmmunition did not result in ammunition count changing as expected");         }     }     //***************test the Monster class***************     public void testMonsterCompareTo(){         Monster demon = new Monster(MonsterType.DEMON);         Monster imp = new Monster(MonsterType.IMP);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         Monster imp2 = new Monster(MonsterType.IMP);         int compare = demon.compareTo(demon);         if(compare!=0){             throw new IncorrectBehaviorException("Monster.compareTo should return 0 when compared to itself, but returned " + compare);         }         compare = demon.compareTo(baron);         if(compare!=1){             throw new IncorrectBehaviorException("Monster.compareTo should return 1 when compared to its protector, but instead returned " + compare);         }         compare = baron.compareTo(demon);         if(compare!=-1){             throw new IncorrectBehaviorException("Monster.compareTo should return -1 when compared to a monster it protects, but instead returned " + compare);         }         compare = spectre.compareTo(imp);         if(compare!=1){             throw new IncorrectBehaviorException("Monster.compareTo should return 1 when compared to a monster with a lower ordinal, but instead returned " + compare);         }         compare = imp.compareTo(demon);         if(compare!=-1){             throw new IncorrectBehaviorException("Monster.compareTo should return -1 when compared to a monster with a higher ordinal, but instead returned " + compare);         }         //compare two monsters of the same type, which will be determined by hashCode         int shouldReturn = 0;         if(imp.hashCode() < imp2.hashCode()){             shouldReturn = -1;         }else if(imp.hashCode() > imp2.hashCode()){             shouldReturn = 1;         }         compare = imp.compareTo(imp2);         if(compare!=shouldReturn){             throw new IncorrectBehaviorException("Monster.compareTo should be based on hashCode when comparing two monsters of the same type. Should've returned " + shouldReturn + " but instead returned " + compare);         }         shouldReturn*=-1;         compare = imp2.compareTo(imp);         if(compare!=shouldReturn){             throw new IncorrectBehaviorException("(2) Monster.compareTo should be based on hashCode when comparing two monsters of the same type. Should've returned " + shouldReturn + " but instead returned " + compare);         }     }     public void testGetCustomProtector(){         Monster m = new Monster(MonsterType.DEMON,MonsterType.IMP);         if(m.getProtectedBy() != MonsterType.IMP){             throw new IncorrectBehaviorException("Monster with custom protector did not return the custom protector");         }     }     public void testGetDefaultProtector(){         Monster m = new Monster(MonsterType.DEMON);         if(m.getProtectedBy() != m.getMonsterType().getProtectedBy()){             throw new IncorrectBehaviorException("Monster with no custom protector did not return the protector of its monster type");         }     }     private Room getBlankRoom(){         return new Room(new TreeSet<Monster>(),new HashSet<Weapon>(),new HashMap<Weapon,Integer>(),0,"room");     }     public void testKillMonsterInTwoPasses(){         Monster m = new Monster(MonsterType.SPECTRE);         m.setRoom(getBlankRoom());         try{             m.attack(m.getMonsterType().weaponNeededToKill,m.getMonsterType().ammunitionCountNeededToKill-1);             m.attack(m.getMonsterType().weaponNeededToKill,1);             if(!m.isDead()){                 throw new IncorrectBehaviorException("Monster should be dead but isDead returned false");             }         }catch(IllegalStateException e){}     }     public void testAttackWithInsufficientWeapon(){         Monster m = new Monster(MonsterType.SPECTRE);         try{             m.attack(Weapon.CHAINSAW,m.getMonsterType().ammunitionCountNeededToKill);             throw new IncorrectBehaviorException("When attacked with a CHAINSAW, a SPECTRE should throw an IllegalArgumentException");         }catch(IllegalArgumentException e){}     }     public void testAttackWithNoAmmo(){         Monster m = new Monster(MonsterType.BARON_OF_HELL);         try{             m.attack(m.getMonsterType().weaponNeededToKill,0);             throw new IncorrectBehaviorException("When attacked with a insufficient ammunition, a BARON_OF_HELL should throw an IllegalArgumentException");         }catch(IllegalArgumentException e){}     }     public void testAttackDeadMonster(){         Monster m = new Monster(MonsterType.DEMON);         m.setRoom(getBlankRoom());         try{             m.attack(m.getMonsterType().weaponNeededToKill,m.getMonsterType().ammunitionCountNeededToKill);             m.attack(m.getMonsterType().weaponNeededToKill,1);             throw new IncorrectBehaviorException("Monster.attack did not throw an IllegalStateException when the monster was attacked when it was already dead");         }catch(IllegalStateException e){}     }     public void testAttackMonsterButDontKillMonster(){         Monster m = new Monster(MonsterType.SPECTRE);         try{             m.attack(m.getMonsterType().weaponNeededToKill,m.getMonsterType().ammunitionCountNeededToKill-1);             if(m.isDead()){                 throw new IncorrectBehaviorException("Monster should not be dead but isDead returned true");             }         }catch(IllegalStateException e){}     }     //***********************************************************************************************************     //******************************Methods for creating GameBot Scenarios***************************************     //***********************************************************************************************************     private boolean playAndReport(GameBot bot, String gameName){         System.out.println("Test Game named " + gameName + " now being played");         boolean success = bot.play();         boolean complete = true;         for(Room room : bot.getAllRooms()){             System.out.println("**********************************************");             System.out.println("Room name: " + room.getName());             System.out.println("Room completed: " + room.isCompleted());             if(!room.isCompleted()){                 complete = false;             }             System.out.println("State of Monsters in Room:");             for(Monster m : room.getMonsters()){                 System.out.println(m.getMonsterType().name() + ": is dead - " + m.isDead());                 if(!m.isDead()){                     complete = false;                 }             }         }         return success && complete;     }     public GameBot createMultiPlayerFailure(){         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(this.createEasyImpsRoom());         rooms.add(this.createDoubleDemonicRoom());         rooms.add(this.createFearsomeFoursomeRoom());         Player player1 = new Player("Player 1",5);         Player player2 = new Player("Player 2",10);         player2.addWeapon(Weapon.CHAINSAW);         player2.addWeapon(Weapon.PISTOL);         player2.addWeapon(Weapon.SHOTGUN);         player2.addAmmunition(Weapon.CHAINSAW,1);         player2.addAmmunition(Weapon.PISTOL,6);         TreeSet<Player> players = new TreeSet<>();         players.add(player1);         players.add(player2);         return new GameBot(rooms,players);     }     public GameBot createSinglePlayerFailure(){         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(this.createEasyImpsRoom());         rooms.add(this.createDoubleDemonicRoom());         rooms.add(this.createFearsomeFoursomeRoom());         Player player1 = new Player("Player 1",100);         TreeSet<Player> players = new TreeSet<>();         players.add(player1);         return new GameBot(rooms,players);     }     public GameBot createMultiPlayerSuccess(){         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(this.createEasyImpsRoom());         rooms.add(this.createDoubleDemonicRoom());         rooms.add(this.createFearsomeFoursomeRoom());         Player player1 = new Player("Player 1",9);         Player player2 = new Player("Player 2",100);         player2.addWeapon(Weapon.CHAINSAW);         player2.addWeapon(Weapon.PISTOL);         player2.addWeapon(Weapon.SHOTGUN);         player2.addAmmunition(Weapon.CHAINSAW,2);         player2.addAmmunition(Weapon.PISTOL,7);         player2.addAmmunition(Weapon.SHOTGUN,13);         TreeSet<Player> players = new TreeSet<>();         players.add(player1);         players.add(player2);         return new GameBot(rooms,players);     }     public GameBot createSinglePlayerSuccess(){         TreeSet<Room> rooms = new TreeSet<>();         rooms.add(this.createEasyImpsRoom());         rooms.add(this.createDoubleDemonicRoom());         rooms.add(this.createIDRoom());         rooms.add(this.createTripleThreatRoom());         rooms.add(this.createDemonQuadRoom());         rooms.add(this.createFearsomeFoursomeRoom());         Player player1 = new Player("Player 1",100);         TreeSet<Player> players = new TreeSet<>();         players.add(player1);         return new GameBot(rooms,players);     }     private Room createEasyImpsRoom(){         Monster imp1 = new Monster(MonsterType.IMP);         Monster imp2 = new Monster(MonsterType.IMP);         Monster imp3 = new Monster(MonsterType.IMP);         TreeSet<Monster> group1 = new TreeSet<>();         group1.add(imp1);         group1.add(imp2);         group1.add(imp3);         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.CHAINSAW);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.CHAINSAW,2);         return new Room(group1,weapons,ammoWonUponCompletion,10,"Easy Imps");     }     private Room createDoubleDemonicRoom(){         Monster demon1 = new Monster(MonsterType.DEMON);         Monster demon2 = new Monster(MonsterType.DEMON);         TreeSet<Monster> group1 = new TreeSet<>();         group1.add(demon1);         group1.add(demon2);         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.PISTOL);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.PISTOL,6);         ammoWonUponCompletion.put(Weapon.CHAINSAW,2);         return new Room(group1,weapons,ammoWonUponCompletion,0,"Double Demonic");     }     private Room createIDRoom(){         Monster imp1 = new Monster(MonsterType.IMP);         Monster imp2 = new Monster(MonsterType.IMP);         Monster imp3 = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         TreeSet<Monster> group1 = new TreeSet<>();         group1.add(imp1);         group1.add(imp2);         group1.add(imp3);         group1.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.CHAINSAW);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.PISTOL,6);         return new Room(group1,weapons,ammoWonUponCompletion,0,"I&D");     }     private Room createTripleThreatRoom(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         TreeSet<Monster> group = new TreeSet<>();         group.add(imp);         group.add(demon);         group.add(spectre);         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.SHOTGUN);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.PISTOL,6);         ammoWonUponCompletion.put(Weapon.SHOTGUN,4);         ammoWonUponCompletion.put(Weapon.CHAINSAW,6);         return new Room(group,weapons,ammoWonUponCompletion,0,"Triple Threat");     }     private Room createDemonQuadRoom(){         Monster demon = new Monster(MonsterType.DEMON);         Monster demon1 = new Monster(MonsterType.DEMON);         Monster demon2 = new Monster(MonsterType.DEMON);         Monster demon3 = new Monster(MonsterType.DEMON);         TreeSet<Monster> group = new TreeSet<>();         group.add(demon);         group.add(demon1);         group.add(demon2);         group.add(demon3);         HashSet<Weapon> weapons = new HashSet<>();         weapons.add(Weapon.SHOTGUN);         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         ammoWonUponCompletion.put(Weapon.SHOTGUN,16);         ammoWonUponCompletion.put(Weapon.CHAINSAW,1);         return new Room(group,weapons,ammoWonUponCompletion,0,"Demon Quad");     }     private Room createFearsomeFoursomeRoom(){         Monster imp = new Monster(MonsterType.IMP);         Monster demon = new Monster(MonsterType.DEMON);         Monster spectre = new Monster(MonsterType.SPECTRE);         Monster baron = new Monster(MonsterType.BARON_OF_HELL);         TreeSet<Monster> group = new TreeSet<>();         group.add(baron);         group.add(imp);         group.add(spectre);         group.add(demon);         HashSet<Weapon> weapons = new HashSet<>();         Map<Weapon,Integer> ammoWonUponCompletion = new HashMap<>();         return new Room(group,weapons,ammoWonUponCompletion,0,"Fearsome Foursome");     } } GameBot.class public synchronized class GameBot { private java.util.SortedSet rooms; private java.util.Set players; private java.util.Set deadPlayers; public void GameBot(java.util.SortedSet, java.util.SortedSet); public boolean play(); protected java.util.Set passThroughRooms(); protected void reapCompletionRewards(Player, Room); protected void killMonster(Player, Room, Monster); public java.util.Set getCompletedRooms(); public java.util.SortedSet getAllRooms(); protected java.util.SortedSet getLivePlayers(); protected java.util.SortedSet getLivePlayersWithWeaponAndAmmunition(Weapon, int); protected static java.util.SortedSet getAllProtectorsInRoom(Monster, Room); private static java.util.SortedSet getAllProtectorsInRoom(java.util.SortedSet, Monster, Room); protected static boolean canKill(Player, Monster, Room); private static boolean canKill(Player, Monster, Room, java.util.SortedMap, java.util.Set); } GameBot.java GameBot.java package edu.yu.cs.intro.doomGame; import java.util.SortedSet; import java.util.SortedMap; import java.util.TreeSet; import java.util.TreeMap; import java.util.Map; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.Iterator; import java.util.Collections; /**  * Plays through a given game scenario. i.e. tries to kill all the monsters in all the rooms and thus complete the game, using the given set of players  */ public class GameBot {     private SortedSet<Room> rooms;     private Set<Player> players;         private Set<Player> deadPlayers= new HashSet<Player>();          /**      * Create a new "GameBot", i.e. a program that automatically "plays the game"      * @param rooms the set of rooms in this game      * @param players the set of players the bot can use to try to complete all rooms      */     public GameBot(SortedSet<Room> rooms, SortedSet<Player> players) {         this.rooms =  new TreeSet<Room>(rooms);         this.players = new HashSet<Player>(players);     }     /**      * Try to complete killing all monsters in all rooms using the given set of players.      * It could take multiple passes through the set of rooms to complete the task of killing every monster in every room.      * This method should call #passThroughRooms in some loop that tracks whether all the rooms have been completed OR we      * have reached a point at which no progress can be made. If we are "stuck", i.e. we haven't completed all rooms but      * calls to #passThroughRooms are no longer increasing the number of rooms that have been completed, return false to      * indicate that we can't complete the game. As long as the number of completed rooms continues to rise, keep calling      * #passThroughRooms.      *      * Throughout our attempt/logic to play the game, we rely on and take advantage of the fact that Room, Monster,      * and Player all implement Comparable, and the sets we work with are all SortedSets      *      * @return true if all rooms were completed, false if not      */     public boolean play() {         int completedRooms;         do{             completedRooms=passThroughRooms().size();         }         while(getCompletedRooms().size()>completedRooms);         passThroughRooms();         completedRooms=getCompletedRooms().size();         System.out.println("Complete:"+getCompletedRooms().size()+", Rooms:"+this.rooms.size());         return getCompletedRooms().size()==this.rooms.size();     }     /**      * Pass through the rooms, killing any monsters that can be killed, and thus attempt to complete the rooms      * @return the set of rooms that were completed in this pass      */     protected Set<Room> passThroughRooms() {         //for every room that is not completed,             //for every living monster in that room                 //See if any of your players can kill the monster. If so, have the capable player kill it.                 //The player that causes the room to be completed by killing a monster reaps the rewards for completing that room.         //Return the set of completed rooms.         Set<Room> rooms_=new HashSet<Room>();         /*  Loop kwa room zote*/         for(Room r:getAllRooms())         {                        if(!r.isCompleted())             {                 for(Monster m:r.getLiveMonsters())                 {                     for(Player p:getLivePlayersWithWeaponAndAmmunition(m.getMonsterType().weaponNeededToKill,m.getMonsterType().ammunitionCountNeededToKill))                     {                         if(canKill(p, m,r))                         {                                                        killMonster(p,r,m);                             if(r.isCompleted())                             {                                 reapCompletionRewards(p,r);                                  rooms_.add(r);                             }                         }                                              }                 }             }         }         return rooms_;     }     /**      * give the player the weapons, ammunition, and health that come from completing the given room      * @param player      * @param room      */     protected void reapCompletionRewards(Player player, Room room) {         player.changeHealth(room.getHealthWonUponCompletion());         //.         Set<Weapon> weaponsWon =new HashSet<Weapon>(room.getWeaponsWonUponCompletion());         Map<Weapon,Integer> ammoWon=new HashMap<Weapon,Integer>(room.getAmmoWonUponCompletion());         for(Weapon w:weaponsWon)             player.addWeapon(w);         for(Weapon w:ammoWon.keySet())             player.addAmmunition(w,ammoWon.get(w));     }     /**      * Have the given player kill the given monster in the given room.      * Assume that #canKill was already called to confirm that player's ability to kill the monster      * @param player      * @param room      * @param monsterToKill      */     protected void killMonster(Player player, Room room, Monster monsterToKill) {         //Call getAllProtectorsInRoom to get a sorted set of all the monster's protectors in this room         //Player must kill the protectors before it can kill the monster, so kill all the protectors         //first via a recursive call to killMonster on each one.         //Reduce the player's health by the amount given by room.getPlayerHealthLostPerEncounter().         //Attack (and thus kill) the monster with the kind of weapon, and amount of ammunition, needed to kill it.         SortedSet<Monster> protectors=new TreeSet<Monster>(getAllProtectorsInRoom(monsterToKill, room));         if(protectors.size()>0)         for(Monster m:protectors)             killMonster(player,room,m);              player.changeHealth(-room.getPlayerHealthLostPerEncounter());         monsterToKill.attack(monsterToKill.getMonsterType().weaponNeededToKill,monsterToKill.getMonsterType().ammunitionCountNeededToKill);         player.changeAmmunitionRoundsForWeapon(monsterToKill.getMonsterType().weaponNeededToKill,-monsterToKill.getMonsterType().ammunitionCountNeededToKill);         room.monsterKilled(monsterToKill);           //System.out.println("Room:"+room.getName()+" Player "+player.getName()+" has killed a "+monsterToKill.getMonsterType()+". Health is now "+player.getHealth());     }     /**      * @return a plain Old set of all the rooms that have been completed      */     public Set<Room> getCompletedRooms() {         Set<Room> rooms_=new HashSet<Room>();                  for(Room r:this.rooms)             if(r.isCompleted())                 rooms_.add(r);         return rooms_;     }     /**      * @return an unmodifiable collection of all the rooms in the game      * @see java.util.Collections#unmodifiableSortedSet(SortedSet)      */     public SortedSet<Room> getAllRooms() {         SortedSet<Room> rooms_=new TreeSet<Room>();              for(Room r:this.rooms)             rooms_.add(r);         return Collections.unmodifiableSortedSet(rooms_);        }     /**      * @return a sorted set of all the live players in the game      */     protected SortedSet<Player> getLivePlayers() {         SortedSet<Player> players_=new TreeSet<Player>();                for(Player p:this.players)             if(!p.isDead())//!this.deadPlayers.contains(p))                 players_.add(p);         return players_;     }     /**      * @param weapon      * @param ammunition      * @return a sorted set of all the players that have the given wepoan with the given amount of ammunition for it      */     protected SortedSet<Player> getLivePlayersWithWeaponAndAmmunition(Weapon weapon, int ammunition) {         SortedSet<Player> players_=new TreeSet<Player>();                for(Player p:getLivePlayers())         {                if(p.hasWeapon(weapon))             {   if(p.getAmmunitionRoundsForWeapon(weapon)>=ammunition)                         players_.add(p);             }                      }         return players_;     }     /**      * Get the set of all monsters that would need to be killed first before you could kill this one.      * Remember that a protector may itself be protected by other monsters, so you will have to recursively check for protectors      * @param monster      * @param room      * @return      */     protected static SortedSet<Monster> getAllProtectorsInRoom(Monster monster, Room room) {         return getAllProtectorsInRoom(new TreeSet<Monster>(), monster, room); //this is a hint about how to handle canKill as well     }     private static SortedSet<Monster> getAllProtectorsInRoom(SortedSet<Monster> protectors, Monster monster, Room room) {         for(Monster m:room.getLiveMonsters())         {             if(m.getMonsterType()==monster.getProtectedBy())             {                 protectors.add(m);                 return getAllProtectorsInRoom(protectors, m, room);             }         }         return protectors;     }     /**      * Can the given player kill the given monster in the given room?      *      * @param player      * @param monster      * @param room      * @return      * @throws IllegalArgumentException if the monster is not located in the room or is dead      */     protected static boolean canKill(Player player, Monster monster, Room room)     {         //Going into the room exposes the player to all the monsters in the room. If the player's health is         //not > room.getPlayerHealthLostPerEncounter(), you can return immediately         //Call the private canKill method, to determine if this player can kill this monster.         //Before returning from this method, reset the player's health to what it was before you called the private canKill         boolean cankill=player.getHealth()>room.getPlayerHealthLostPerEncounter();         if(!cankill)return false;         if(!room.getLiveMonsters().contains(monster)) throw new IllegalArgumentException("Monster is not located in the room or is dead");          int originalHealth=player.getHealth();         cankill=canKill(player,monster,room,new TreeMap<Weapon, Integer>(),new HashSet<Monster>());         player.setHealth(originalHealth);         return cankill;     }     /**      *      * @param player      * @param monster      * @param room      * @param roundsUsedPerWeapon      * @return      */     private static boolean canKill(Player player, Monster monster, Room room, SortedMap<Weapon, Integer> roundsUsedPerWeapon,Set<Monster> alreadyMarkedByCankill) {         //**************************************Rough skecth of logic:     //Remove all the monsters already marked / looked at by this series of recursive calls to canKill from the set of live Monsters     // in the room before you check if the monster is alive and in the room. Be sure to NOT alter the actual set of live monsters in your Room object!     //Check if monster is in the room and alive.     //Check what weapon is needed to kill the monster, see if player has it. If not, return false.     //Check what protects the monster. If the monster is protected, the player can only kill this monster if it can kill its protectors as well.     //Make recursive calls to canKill to see if player can kill its protectors.     //Be sure to remove all members of already MarkedBy CanKill from the set of protectors before you recursively call canKill on the protectors     //If all the recursive calls to canKill on all the protectors returned true:     //Check what amount of ammunition is needed to kill the monster, and see if player has it after we subtract     //from his total ammunition the number stored in rounds UsedPerWeapon for the given weapon, if any.     //add how much ammunition will be used up to kill this monster to rounds UsedPerWeapon     //Add up the playerHealthLostPerExposure of all the live monsters, and see if when that is subtracted from the player if his health is still > 0. If not, return false.     //If health is still > 0, subtract the above total from the player's health     //(Note that in the protected canKill method, you must reset the player's health to what it was before canKill was called before you return from that protected method)     //add this monster to alreadyMarkedByCankill, and return true.         Set<Monster> prots=new HashSet<Monster>();         for(Monster m:getAllProtectorsInRoom(monster, room))             if(!alreadyMarkedByCankill.contains(m))                 prots.add(m);         if(!room.getLiveMonsters().contains(monster))             return false;         if(!player.hasWeapon(monster.getMonsterType().weaponNeededToKill))             return false;         boolean ret=true;         if(prots.size()>alreadyMarkedByCankill.size())         {                for(Monster m:prots)                 if(!alreadyMarkedByCankill.contains(m))                     if(!canKill(player,m,room,roundsUsedPerWeapon,alreadyMarkedByCankill));                         ret=false;             if(!ret&&alreadyMarkedByCankill.size()!=prots.size())                 return false;         }                  if(player.getAmmunitionRoundsForWeapon(monster.getMonsterType().weaponNeededToKill)<monster.getMonsterType().ammunitionCountNeededToKill)             return false;                else         {                int life=0;                      for(Monster mk:room.getLiveMonsters())                 life+=mk.getMonsterType().playerHealthLostPerExposure;             if((player.getHealth()-life)>0)             {                 player.changeHealth(-life);                 alreadyMarkedByCankill.add(monster);                 prots.remove(monster);                 return true;             }             else                 return false;         }     } } GameBotDemo-output.txt Output from running edu.yu.cs.intro.doomGame.GameBotDemo is below. Note that in my GameBot.killMonster method, I output a descriptive line when a monster is killed. ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 97 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 95 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 94 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 102 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 101 Room: I&D. Player Player 1 has killed a DEMON. Health is now 97 Room: I&D. Player Player 1 has killed a IMP. Health is now 94 Room: I&D. Player Player 1 has killed a IMP. Health is now 92 Room: I&D. Player Player 1 has killed a IMP. Health is now 91 Room: Triple Threat. Player Player 1 has killed a IMP. Health is now 87 Room: Triple Threat. Player Player 1 has killed a SPECTRE. Health is now 84 Room: Triple Threat. Player Player 1 has killed a DEMON. Health is now 83 Room: Demon Quad. Player Player 1 has killed a DEMON. Health is now 79 Room: Demon Quad. Player Player 1 has killed a DEMON. Health is now 76 Room: Demon Quad. Player Player 1 has killed a DEMON. Health is now 74 Room: Demon Quad. Player Player 1 has killed a DEMON. Health is now 73 Room: Fearsome Foursome. Player Player 1 has killed a SPECTRE. Health is now 66 Room: Fearsome Foursome. Player Player 1 has killed a IMP. Health is now 61 Room: Fearsome Foursome. Player Player 1 has killed a BARON_OF_HELL. Health is now 57 Room: Fearsome Foursome. Player Player 1 has killed a DEMON. Health is now 56 Game named Single Player Success was completed successfully ********************************************** Room name: Easy Imps Room completed: true State of Monsters in Room: IMP: is dead - true IMP: is dead - true IMP: is dead - true ********************************************** Room name: Double Demonic Room completed: true State of Monsters in Room: DEMON: is dead - true DEMON: is dead - true ********************************************** Room name: I&D Room completed: true State of Monsters in Room: DEMON: is dead - true IMP: is dead - true IMP: is dead - true IMP: is dead - true ********************************************** Room name: Triple Threat Room completed: true State of Monsters in Room: IMP: is dead - true SPECTRE: is dead - true DEMON: is dead - true ********************************************** Room name: Demon Quad Room completed: true State of Monsters in Room: DEMON: is dead - true DEMON: is dead - true DEMON: is dead - true DEMON: is dead - true ********************************************** Room name: Fearsome Foursome Room completed: true State of Monsters in Room: SPECTRE: is dead - true IMP: is dead - true BARON_OF_HELL: is dead - true DEMON: is dead - true ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 97 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 95 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 94 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 102 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 101 Room: Fearsome Foursome. Player Player 1 has killed a SPECTRE. Health is now 94 Room: Fearsome Foursome. Player Player 1 has killed a IMP. Health is now 89 Game named Single Player Failure could not be completed ********************************************** Room name: Easy Imps Room completed: true State of Monsters in Room: IMP: is dead - true IMP: is dead - true IMP: is dead - true ********************************************** Room name: Double Demonic Room completed: true State of Monsters in Room: DEMON: is dead - true DEMON: is dead - true ********************************************** Room name: Fearsome Foursome Room completed: false State of Monsters in Room: SPECTRE: is dead - true BARON_OF_HELL: is dead - false DEMON: is dead - false IMP: is dead - true ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 6 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 4 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 3 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 11 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 10 Room: Fearsome Foursome. Player Player 1 has killed a IMP. Health is now 3 Room: Fearsome Foursome. Player Player 2 has killed a SPECTRE. Health is now 94 Room: Fearsome Foursome. Player Player 2 has killed a BARON_OF_HELL. Health is now 90 Room: Fearsome Foursome. Player Player 1 has killed a DEMON. Health is now 2 Game named Multi-Player Success was completed successfully ********************************************** Room name: Easy Imps Room completed: true State of Monsters in Room: IMP: is dead - true IMP: is dead - true IMP: is dead - true ********************************************** Room name: Double Demonic Room completed: true State of Monsters in Room: DEMON: is dead - true DEMON: is dead - true ********************************************** Room name: Fearsome Foursome Room completed: true State of Monsters in Room: IMP: is dead - true BARON_OF_HELL: is dead - true DEMON: is dead - true SPECTRE: is dead - true ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** ****************************************************************************** Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 2 Room: Easy Imps. Player Player 2 has killed a IMP. Health is now 8 Room: Easy Imps. Player Player 1 has killed a IMP. Health is now 1 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 9 Room: Double Demonic. Player Player 1 has killed a DEMON. Health is now 8 Room: Fearsome Foursome. Player Player 1 has killed a IMP. Health is now 1 Room: Fearsome Foursome. Player Player 2 has killed a SPECTRE. Health is now 2 Game named Multi-Player Failure could not be completed ********************************************** Room name: Easy Imps Room completed: true State of Monsters in Room: IMP: is dead - true IMP: is dead - true IMP: is dead - true ********************************************** Room name: Double Demonic Room completed: true State of Monsters in Room: DEMON: is dead - true DEMON: is dead - true ********************************************** Room name: Fearsome Foursome Room completed: false State of Monsters in Room: IMP: is dead - true SPECTRE: is dead - true BARON_OF_HELL: is dead - false DEMON: is dead - false grade.txt 432 Monster.class public synchronized class Monster implements Comparable { private MonsterType myType; private MonsterType customProtectedBy; private Room room; private boolean alive; protected void Monster(MonsterType); public void Monster(MonsterType, MonsterType); protected void setRoom(Room); public MonsterType getMonsterType(); protected boolean attack(Weapon, int); public boolean isDead(); public MonsterType getProtectedBy(); public int compareTo(Monster); } Monster.java Monster.java package edu.yu.cs.intro.doomGame; /**  * A specific monster  */ public class Monster implements Comparable<Monster>{     /**      * create a monster with no customr protectors; its protectors will be determined by its MonsterType      * @param type the type of monster to create      */     private MonsterType myType;     private MonsterType customProtectedBy;     private Room room;     private boolean alive=true;          protected Monster(MonsterType type){         this.myType=type;     }     /**      * create a monster with a custom protector, i.e. a different protector than the one specified in its MonsterType      * @param type      * @param customProtectedBy      */     public Monster(MonsterType type, MonsterType customProtectedBy){         this.myType=type;         this.customProtectedBy=customProtectedBy;     }     /**      * set the room that the Monster is located in      * @param room      */   protected void setRoom(Room room){         this.room=room;     }     public MonsterType getMonsterType(){         return this.myType;     }     /**      * Attack this monster with the given weapon, firing the given number of rounds at it      * @param weapon      * @param rounds      * @return indicates if the monster is dead after this attack      * @throws IllegalArgumentException if the weapon is one that dones't hurt this monster, if the weapon is null, or if rounds < 1      * @throws IllegalStateException if the monster is already dead      */     protected boolean attack(Weapon weapon, int rounds){         if(this.isDead())             throw new IllegalStateException("Monster already dead...");         else if(weapon==null||rounds<1||this.myType.weaponNeededToKill!=weapon)             throw new IllegalArgumentException("Monster not affected, either the weapon is below par, or you are out of Ammo...");         else if(this.myType.weaponNeededToKill==weapon&&this.myType.ammunitionCountNeededToKill<=rounds)             this.alive=false;                return this.isDead();     }     /**      * @return is this monster dead?      */     public boolean isDead(){         return !this.alive;     }     /**      * if this monster has its customProtectedBy set, return it. Otherwise, return the protectedBy of this monster's type      * @return      */     public MonsterType getProtectedBy(){         if(this.customProtectedBy!=null)             return this.customProtectedBy;         else             return this.myType.getProtectedBy();     }     /**      * Used to sort a set of monsters into the order in which they must be killed, assuming they are in the sane room.     * If the parameter refers to this monster, return e     * If this monster is protected by the other monster's type, return 1     * If this monster's type protects the other monster, return -1     * If this monster's ordinal is < the other's, return -1     * If this monster's ordinal is > the other's, retuen 1     * If(this .hashCode() < other . hashCode()), then return -1     * Otherwise, return 1      * @param other the other monster      * @return see above      */     @Override     public int compareTo(Monster other) {         if(this==other) return 0;             else if(this.getProtectedBy()==other.getMonsterType())return 1;         else if(this.getMonsterType()==other.getProtectedBy()) return -1;         else if(this.getMonsterType().ordinal() < other.getMonsterType().ordinal())return -1;         else if(this.getMonsterType().ordinal() > other.getMonsterType().ordinal())return 1;         else if(this.hashCode() < other.hashCode())return -1;                  return 1;     } } MonsterType$1.class package edu.yu.cs.intro.doomGame; synchronized class MonsterType$1 { MonsterType.class package edu.yu.cs.intro.doomGame; public final synchronized enum MonsterType { MonsterType.java MonsterType.java package edu.yu.cs.intro.doomGame; /**  * Describes the types of monsters that can exist in our game  * (Hat tip to Doom, 1993, by is Software)  */ public enum MonsterType {     IMP(Weapon.FIST,1,1),     DEMON(Weapon.CHAINSAW,1,1),     SPECTRE(Weapon.PISTOL,6,2),     BARON_OF_HELL(Weapon.SHOTGUN,12,3);     /**what weapon is needed to kill this monster?*/     protected final Weapon weaponNeededToKill;     /**how many rounds of ammunition must be fired at the monster from the required weapon to kill it?*/     protected final int ammunitionCountNeededToKill;     /**how much health does a player lose when he is in the same room as this type of monster?*/     protected final int playerHealthLostPerExposure;     /**      *      * @param weaponNeededToKill      * @param ammunitionCountNeededToKill      * @param playerHealthLostPerExposure      */     MonsterType(Weapon weaponNeededToKill, int ammunitionCountNeededToKill, int playerHealthLostPerExposure) {         this.weaponNeededToKill = weaponNeededToKill;         this.ammunitionCountNeededToKill = ammunitionCountNeededToKill;         this.playerHealthLostPerExposure = playerHealthLostPerExposure;     }     /**      * if this monster is in the same room as other monsters, what type of other monster would protected this one?      * @return      */     public MonsterType getProtectedBy(){         switch (this){             case IMP:                 return null;             case DEMON:                 return BARON_OF_HELL;             case SPECTRE:                 return null;             case BARON_OF_HELL:                 return SPECTRE;         }         return null;     } } Player.class public synchronized class Player implements Comparable { private String name; private int health; private java.util.Set weapons; private java.util.Map ammo; private boolean alive; public void Player(String, int); public String getName(); public boolean hasWeapon(Weapon); public int getAmmunitionRoundsForWeapon(Weapon); public int changeAmmunitionRoundsForWeapon(Weapon, int); protected int addAmmunition(Weapon, int); protected boolean addWeapon(Weapon); public int changeHealth(int); protected void setHealth(int); public int getHealth(); public boolean isDead(); public int compareTo(Player); public boolean equals(Object); public int hashCode(); protected Weapon getGreatest(); } Player.java Player.java package edu.yu.cs.intro.doomGame; import java.util.Map; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; /**  * Represents a player in the game.  * A player whose health is <= 0 is dead.  */ public class Player implements Comparable<Player> {     private String name;     private int health;     private Set<Weapon> weapons=new HashSet<Weapon>();     private Map<Weapon,Integer> ammo=new HashMap<Weapon,Integer>();     private boolean alive=true;     /**      * @param name the player's name      * @param health the player's starting health level      */     public Player(String name, int health) {         this.name=name;         this.health=health;         addWeapon(Weapon.FIST);     }     public String getName(){         return this.name;     }     /**      * does this player have the given weapon?      * @param w      * @return      */     public boolean hasWeapon(Weapon w){         return this.weapons.contains(w);     }     /**      * how much ammunition does this player have for the given weapon?      * @param w      * @return      */     public int getAmmunitionRoundsForWeapon(Weapon w){         return this.ammo.get(w);     }     /**      * Change the ammunition amount by a positive or negative amount      * @param weapon weapon whose ammunition count is to be changed      * @param change amount to change ammunition count for that weapon by      * @return the new total amount of ammunition the player has for the weapon.      */     public int changeAmmunitionRoundsForWeapon(Weapon weapon, int change){         int ammocount=0;                  if(this.ammo.containsKey(weapon))ammocount=this.ammo.get(weapon);         //System.out.println("Current ammo:"+ammocount);         this.ammo.put(weapon,ammocount+change);         //System.out.println("New ammo:"+ammocount+change);         return ammocount+change;     }     /**      * A player can have ammunition for a weapon even without having the weapon itself.      * @param weapon weapon for which we are adding ammunition      * @param rounds number of rounds of ammunition to add      * @return the new total amount of ammunition the player has for the weapon      * @throws IllegalArgumentException if rounds < 0 or weapon is null      * @throws IllegalStateException if the player is dead      */     protected int addAmmunition(Weapon weapon, int rounds){         if(weapon==null||rounds<0)             throw new IllegalArgumentException("The weapon cannot be null and rounds cannot be less than 0");         else if(this.isDead())             throw new IllegalStateException("The player is already dead");         return this.changeAmmunitionRoundsForWeapon(weapon,rounds);              }     /**      * When a weapon is first added to a player, the player should automatically be given 5 rounds of ammunition.      * If the player already has the weapon before this method is called, this method has no effect at all.      * @param weapon      * @return true if the weapon was added, false if the player already had it      * @throws IllegalArgumentException if weapon is null      * @throws IllegalStateException if the player is dead      */     protected boolean addWeapon(Weapon weapon){         if(weapon==null)             throw new IllegalArgumentException("The weapon cannot be null");         else if(this.weapons.contains(weapon)) return false;         else if(this.isDead())             throw new IllegalStateException("The player is already dead");         else         {             this.weapons.add(weapon);             addAmmunition(weapon,5);             return true;         }              }     /**      * Change the player's health level      * @param amount a positive or negative number, to increase or decrease the player's health      * @return the player's health level after the change      * @throws IllegalStateException if the player is dead      */     public int changeHealth(int amount){         this.health+=amount;         if(this.health<1)this.alive=false;         return this.health;     }     /**      * set player's current health level to the given level      * @param amount      */     protected void setHealth(int amount){                this.health=amount;         if(this.health<1)this.alive=false;     }     /**      * get the player's current health level      * @return      */     public int getHealth(){         return this.health;     }     /**      * is the player dead?      * @return      */     public boolean isDead(){         return !this.alive;     }     /**      * Compare criteria, in order:      * Does one have a greater weapon?      * If they have the same greatest weapon, who has more ammunition for it?      * If they are the same on weapon and ammunition, who has more health?      * If they are the same on greatest weapon, ammunition for it, and health, they are equal.      * Recall that all enums have a built-in implementation of Comparable, and they compare based on ordinal()      *      * @param other      * @return      */     @Override     public int compareTo(Player other) {                 if (this.getGreatest().ordinal()>other.getGreatest().ordinal()) return 1;         else if(this.getGreatest().ordinal()==other.getGreatest().ordinal())         {             if(this.ammo.get(this.getGreatest())>other.ammo.get(this.getGreatest())) return 1;             else if(this.ammo.get(this.getGreatest())==other.ammo.get(this.getGreatest()))             {                 if(this.getHealth()>other.getHealth())return 1;                 else if(this.getHealth()==other.getHealth())return 0;                 else return -1;             }             else return -1;                  }         else return -1;     }     /**      * Only equal if it is literally the same player      * @param o      * @return      */     @Override     public boolean equals(Object o) {         if(o == null)return false;         if(getClass()!=o.getClass()) return false;             Player p = (Player) o;         if(this.name != p.getName()) return false;         return true;     }     /**      * @return the hash code of the player's name      */     @Override     public int hashCode() {         return this.name.hashCode();     }          protected Weapon getGreatest()     {         SortedSet w=new TreeSet<Weapon>(this.weapons);         return (Weapon)w.last();     } } README.txt * Assignment #9 is due Thursday, January 7, 11:59 PM. * You must complete, and submit to CodePost, every Java file enclosed in this zip file (except for GameBotDemo, which is just a demo, and Weapon.java and MonsterType.java, which have been given to you in their entirety) * As always, the given API is just the API, which means you can add as many additional private or protected methods as you want, but you MAY NOT add any additional public methods * To really write a good GameBot that would work in many different scenarios is a an AI Planning (see https://en.wikipedia.org/wiki/Automated_planning_and_scheduling) problem, and NOT one you are required to solve for this assignment. You will only be given inputs of very simple cases that have very simple solutions, and can be played / won using the logic described in the comments in GameBot.java * Note: Weapon.java and MonsterType.java are good review about enums for the final exam * GameBotDemo is given as a demo/example only - it is not test code * Also attached is the output from a run of GameBotDemo.java * Your code will be tested using the Java API, NOT based on printed output results.txt YOUR SCORE: 432 out of 564 TEST NAME: testAttackWithInsufficientWeapon TEST DESCRIPTION: Monster: does monster.attack throw an IllegalArgumentException when attacked with an insufficient weapon? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testAttackWithNoAmmo TEST DESCRIPTION: Monster: does monster.attack throw an IllegalArgumentException when attacked with no ammunition? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testAttackDeadMonster TEST DESCRIPTION: Monster: does Monster.attack throw an IllegalStateException when the monster was attacked when it was already dead? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testAttackMonsterButDontKillMonster TEST DESCRIPTION: Monster: Monster.isDead should return false after being attacked with less than ammunitionCountNeededToKill TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testKillMonsterInTwoPasses TEST DESCRIPTION: Monster: Monster attacked with ammunitionCountNeededToKill over the course of 2 calls on monster.attack should be dead, i.e. should return true from isDead() TEST POINT VALUE: 12 Monster should be dead but isDead returned false edu.yu.cs.intro.doomGame.Assignment9Tests$IncorrectBehaviorException: Monster should be dead but isDead returned false at edu.yu.cs.intro.doomGame.Assignment9Tests.testKillMonsterInTwoPasses(Assignment9Tests.java:709) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at edu.yu.cs.intro.TestHelper.runMethod(TestHelper.java:194) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:66) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:57) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTests(Assignment9Tests.java:81) at edu.yu.cs.intro.doomGame.Assignment9Tests.main(Assignment9Tests.java:27) +++++TEST FAILED+++++ TEST NAME: testGetDefaultProtector TEST DESCRIPTION: Monster: Monster with no custom protector should return the protector of its monster type from Monster.getProtectedBy() TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testGetCustomProtector TEST DESCRIPTION: Monster: Monster with custom protector should return the custom protector from Monster.getProtectedBy() TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testMonsterCompareTo TEST DESCRIPTION: Monster: test Monster.compareTo TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testPlayerDeath TEST DESCRIPTION: Player: Does Player.isDead return true when health is == 0? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testPlayerAlive TEST DESCRIPTION: Player: Does Player.isDead return false when health is == 100? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testChangePlayerHealth TEST DESCRIPTION: Player: Does Player.changeHealth result in health changing as expected? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testReducePlayerHealth TEST DESCRIPTION: Player: Does Player.changeHealth, with a negative number, result in health changing as expected? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testAddAmmo TEST DESCRIPTION: Player: Does Player.addAmmunition result in ammunition count changing as expected? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testChangeAmmo TEST DESCRIPTION: Player: Does Player.changeAmmunitionRoundsForWeapon result in ammunition count changing as expected? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testReduceAmmo TEST DESCRIPTION: Player: Does Player.changeAmmunitionRoundsForWeapon result in ammunition count beign reduced as expected? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testHasWeapon TEST DESCRIPTION: Player: Does Player.hasWeapon return what is expected based on what weapons we have given him? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testPlayerCompareTo TEST DESCRIPTION: Player: Does Player.compareTo return what is expected? TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testRoomDangerLevel TEST DESCRIPTION: Room: Danger level should equal ordinal+1 values of all monsters combined TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testRoomCompareTo TEST DESCRIPTION: Room: compareTo should compare based on danger level TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testGetWeaponsWonUponCompletion TEST DESCRIPTION: Room: did not get expected set of weapons won upon completion TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testGetWeaponsWonUponCompletion TEST DESCRIPTION: Room: check keys and values of room.getAmmoWonUponCompletion() TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testSinglePlayerSuccessGame TEST DESCRIPTION: GameBot: Play Single Player Success TEST POINT VALUE: 36 The test game Single Player Success failed, although it was expected to succeed edu.yu.cs.intro.doomGame.Assignment9Tests$IncorrectBehaviorException: The test game Single Player Success failed, although it was expected to succeed at edu.yu.cs.intro.doomGame.Assignment9Tests.testSinglePlayerSuccessGame(Assignment9Tests.java:393) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at edu.yu.cs.intro.TestHelper.runMethod(TestHelper.java:194) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:66) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTests(Assignment9Tests.java:104) at edu.yu.cs.intro.doomGame.Assignment9Tests.main(Assignment9Tests.java:27) +++++TEST FAILED+++++ TEST NAME: testSinglePlayerFailureGame TEST DESCRIPTION: GameBot: Play Single Player Failure TEST POINT VALUE: 36 +++++TEST PASSED+++++ TEST NAME: testMultiPlayerSuccessGame TEST DESCRIPTION: GameBot: Play Multi-Player Success TEST POINT VALUE: 36 Monster is not located in the room or is dead java.lang.IllegalArgumentException: Monster is not located in the room or is dead at edu.yu.cs.intro.doomGame.GameBot.canKill(GameBot.java:229) at edu.yu.cs.intro.doomGame.GameBot.passThroughRooms(GameBot.java:79) at edu.yu.cs.intro.doomGame.GameBot.play(GameBot.java:50) at edu.yu.cs.intro.doomGame.Assignment9Tests.playAndReport(Assignment9Tests.java:751) at edu.yu.cs.intro.doomGame.Assignment9Tests.testMultiPlayerSuccessGame(Assignment9Tests.java:375) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at edu.yu.cs.intro.TestHelper.runMethod(TestHelper.java:194) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:66) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTests(Assignment9Tests.java:106) at edu.yu.cs.intro.doomGame.Assignment9Tests.main(Assignment9Tests.java:27) +++++TEST FAILED+++++ TEST NAME: testMultiPlayerFailureGame TEST DESCRIPTION: GameBot: Play Multi-Player Failure TEST POINT VALUE: 36 Monster is not located in the room or is dead java.lang.IllegalArgumentException: Monster is not located in the room or is dead at edu.yu.cs.intro.doomGame.GameBot.canKill(GameBot.java:229) at edu.yu.cs.intro.doomGame.GameBot.passThroughRooms(GameBot.java:79) at edu.yu.cs.intro.doomGame.GameBot.play(GameBot.java:50) at edu.yu.cs.intro.doomGame.Assignment9Tests.playAndReport(Assignment9Tests.java:751) at edu.yu.cs.intro.doomGame.Assignment9Tests.testMultiPlayerFailureGame(Assignment9Tests.java:368) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at edu.yu.cs.intro.TestHelper.runMethod(TestHelper.java:194) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:66) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTests(Assignment9Tests.java:107) at edu.yu.cs.intro.doomGame.Assignment9Tests.main(Assignment9Tests.java:27) +++++TEST FAILED+++++ TEST NAME: testReapCompletionRewards TEST DESCRIPTION: GameBot: Check that player reaps the rewards of completing a room: GameBot.reapCompletionRewards() TEST POINT VALUE: 36 +++++TEST PASSED+++++ TEST NAME: testKillMonster TEST DESCRIPTION: GameBot: Check that killMonster kills the right set of monsters and results in the correct changes to the player TEST POINT VALUE: 36 +++++TEST PASSED+++++ TEST NAME: testGetCompletedRooms TEST DESCRIPTION: GameBot: Check that Gamebot.getCompletedRooms() returns all completed rooms, and no other rooms TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testGetLivePlayers TEST DESCRIPTION: GameBot: Check that Gamebot.getLivePlayers() returns all live players, and no other players TEST POINT VALUE: 12 +++++TEST PASSED+++++ TEST NAME: testGetLivePlayersWithWeaponAndAmmunition TEST DESCRIPTION: GameBot: Check that Gamebot.getLivePlayersWithWeaponAndAmmunition() returns the correct set of players TEST POINT VALUE: 12 bot.getLivePlayersWithWeaponAndAmmunition did not return the expected players (all players) edu.yu.cs.intro.doomGame.Assignment9Tests$IncorrectBehaviorException: bot.getLivePlayersWithWeaponAndAmmunition did not return the expected players (all players) at edu.yu.cs.intro.doomGame.Assignment9Tests.testGetLivePlayersWithWeaponAndAmmunition(Assignment9Tests.java:239) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at edu.yu.cs.intro.TestHelper.runMethod(TestHelper.java:194) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:66) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTest(Assignment9Tests.java:57) at edu.yu.cs.intro.doomGame.Assignment9Tests.runTests(Assignment9Tests.java:112) at edu.yu.cs.intro.doomGame.Assignment9Tests.main(Assignment9Tests.java:27) +++++TEST FAILED+++++ TEST NAME: testGetAllProtectorsInRoom TEST DESCRIPTION: GameBot: Check that Gamebot.getAllProtectorsInRoom() returns the correct set of monsters TEST POINT VALUE: 24 +++++TEST PASSED+++++ TEST NAME: testCanKill TEST DESCRIPTION: GameBot: Check that Gamebot.canKill() responds correctly TEST POINT VALUE: 36 +++++TEST PASSED+++++ Room.java Room.java package edu.yu.cs.intro.doomGame; import java.util.SortedSet; import java.util.TreeSet; import java.util.Map; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.Iterator; import java.util.Collection; import java.util.*; /**  * A Room in the game, which contains both monsters as well as rewards for the player that completes the room,  * which is defined as the player who kills the last living monster in the room  */ public class Room implements Comparable<Room>{     private Set<Monster> monsters;     private Set<Weapon> weaponsWonUponCompletion;     private Map<Weapon,Integer> ammoWonUponCompletion;     private int healthWonUponCompletion;     private String name;     private Set<Monster> deadMonsters=new HashSet<Monster>();          /**      *      * @param monsters the monsters present in this room. This is a set of Monsters, NOT MonsterTypes - can have multiple monsters of a given type in a room      * @param weaponsWonUponCompletion weapons a player gains when killing the last monster in this room      * @param ammoWonUponCompletion ammunition a player gains when killing the last monster in this room      * @param healthWonUponCompletion health a player gains when killing the last monster in this room      * @param name the room's name      */     public Room(SortedSet<Monster> monsters, Set<Weapon>weaponsWonUponCompletion, Map<Weapon,Integer> ammoWonUponCompletion,int healthWonUponCompletion,String name){         this.monsters = new HashSet<Monster>(monsters);         this.weaponsWonUponCompletion=new HashSet<Weapon>(weaponsWonUponCompletion);         this.ammoWonUponCompletion=new HashMap<Weapon,Integer> (ammoWonUponCompletion);         this.healthWonUponCompletion=healthWonUponCompletion;         this.name=name;     }     /**      * Mark the given monster as being dead.      * Reduce the danger level of this room by monster.getMonsterType().ordinal()+1      * @param monster      */     protected void monsterKilled(Monster monster){         if(!this.deadMonsters.contains(monster))this.deadMonsters.add(monster);         //monster.getMonsterType().ordinal()+1;     }     /**      * The danger level of the room is defined as the sum of the ordinal+1 value of all living monsters, i.e. adding up (m.getMonsterType().ordinal() + 1) of all the living monsters      * @return the danger level of this room      */     public int getDangerLevel(){         int dl=0;         for(Monster m: this.monsters)             if(!this.deadMonsters.contains(m))                 dl+=m.getMonsterType().ordinal() + 1;         return dl;     }     /**      *      * @return name of this monster      */     public String getName(){         return this.name;     }     /**      * compares based on danger level      * @param other      * @return      */     @Override     public int compareTo(Room other) {         if(this.getDangerLevel()>other.getDangerLevel())return 1;         else if(this.getDangerLevel() == other.getDangerLevel()) return 0;         else             return -1;     }     /**      * @return the set of weapons the player who completes the room is rewarded with. Make sure you don't

Related Questions

Similar orders to Class Homework Assignment for INTRO COMP SCI
4
Views
0
Answers
Java Programming
The program needs to be done within the two class methods. Attached all the information, and the necessary template to use, along with the grading sheet. Just looking to get a working program that fulfills all the necessary requirements. It doesn't need to...
9
Views
0
Answers
Creating basic hangman game using html and js no css required
I have chose to do a basic hangman game for my project. I attached the pdf that entails all directions to complete this assignment. My project should meet the following requirements: 1.Accept text input from the user via a button or keyboard press. 2.U...
14
Views
0
Answers
While Loops for Decimal to Binary Conversion
Write a program that will ask the user for a number in the Decimal base system. Then use a while loop that starts from 210 = 1024 and counts down by binary values. Determine each digit of the binary number. Print out each digit of the binary ...
26
Views
0
Answers
Java Programming Project
https://sp21.datastructur.es/materials/proj/proj1/proj1#introduction This website lists the rules and the starter code to complete this project. Due 10:00 pm pst...