From a18faa4ec1dbde6c00c0078c82a6bc6fe6c3200e Mon Sep 17 00:00:00 2001 From: AishwaryaShinde07 Date: Tue, 28 Nov 2023 22:53:58 -0500 Subject: [PATCH 1/5] Adapter Pattern --- .../warzone/Commands/MapEditorCommands.java | 53 +++++- .../app/warzone/Commands/PlayerCommands.java | 7 +- .../app/warzone/Features/MapFeatures.java | 12 +- .../app/warzone/Model/AttackOrder.java | 5 +- .../java/project/app/warzone/Model/Cards.java | 5 +- .../app/warzone/Model/ConquestFileReader.java | 155 ++++++++++++++++++ .../java/project/app/warzone/Model/Edit.java | 5 +- .../java/project/app/warzone/Model/End.java | 4 +- .../app/warzone/Model/MapFeatureAdapter.java | 16 ++ .../java/project/app/warzone/Model/Phase.java | 3 +- .../java/project/app/warzone/Model/Play.java | 2 +- .../project/app/warzone/Model/Postload.java | 4 +- .../warzone/Utilities/Maps/ConquestDemo.map | 58 +++++++ .../app/warzone/Utilities/Maps/Montreal.map | 48 ++++++ .../app/warzone/Utilities/Maps/demo.map | 2 - 15 files changed, 355 insertions(+), 24 deletions(-) create mode 100644 src/main/java/project/app/warzone/Model/ConquestFileReader.java create mode 100644 src/main/java/project/app/warzone/Model/MapFeatureAdapter.java create mode 100644 src/main/java/project/app/warzone/Utilities/Maps/ConquestDemo.map create mode 100644 src/main/java/project/app/warzone/Utilities/Maps/Montreal.map diff --git a/src/main/java/project/app/warzone/Commands/MapEditorCommands.java b/src/main/java/project/app/warzone/Commands/MapEditorCommands.java index d45d143..f2a3ca2 100644 --- a/src/main/java/project/app/warzone/Commands/MapEditorCommands.java +++ b/src/main/java/project/app/warzone/Commands/MapEditorCommands.java @@ -1,4 +1,7 @@ package project.app.warzone.Commands; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import org.springframework.shell.standard.ShellComponent; @@ -7,7 +10,10 @@ import project.app.warzone.Features.MapFeatures; import project.app.warzone.Features.PlayerFeatures; +import project.app.warzone.Model.ConquestFileReader; import project.app.warzone.Model.GameEngine; +import project.app.warzone.Model.Map; +import project.app.warzone.Model.MapFeatureAdapter; import project.app.warzone.Utilities.Commands; import project.app.warzone.Utilities.MapResources; @@ -54,18 +60,51 @@ public void loadMap(@ShellOption String p_filename) { * Display the game map * * @return String returns message about the map validation + * @throws IOException */ @ShellMethod(key = "showmap", value = "Used to display map continents with terriotories and boundaries") public void showmap() { - d_gameEngine.getGamePhase().showMap(); - } - - public project.app.warzone.Model.Map returnMap() { String p_mapLocation = d_gameEngine.gameMap.getMapDirectory() + "/" - + d_gameEngine.gameMap.get_USER_SELECTED_FILE() + ".map"; - dMap = dMapFeatures.readMap(p_mapLocation); - return dMap; + + d_gameEngine.gameMap.get_USER_SELECTED_FILE() + ".map"; + String l_line=""; + + try{ + BufferedReader reader = new BufferedReader(new FileReader(p_mapLocation)); + MapFeatures mapFeatures= MapFeatures.getInstance(); + l_line=reader.readLine(); + if(l_line.equals("conquest")){ + mapFeatures = new MapFeatureAdapter(new ConquestFileReader()); + // newmMapFeatures.readMap(p_mapLocation); + } + else{ + mapFeatures = MapFeatures.getInstance(); + // mapFeatures.readMap(p_mapLocation); + } + + + + + d_gameEngine.getGamePhase().showMap(mapFeatures); + +} + catch(FileNotFoundException e) + { + System.out.println("File Not Found----"); } + catch (IOException e) { + System.out.println("IOException----"); + } + } + + // public project.app.warzone.Model.Map returnMap() { + // String p_mapLocation = d_gameEngine.gameMap.getMapDirectory() + "/" + // + d_gameEngine.gameMap.get_USER_SELECTED_FILE() + ".map"; + + + + // dMap = dMapFeatures.readMap(p_mapLocation); + // return dMap; + // } /** * command for editing continent diff --git a/src/main/java/project/app/warzone/Commands/PlayerCommands.java b/src/main/java/project/app/warzone/Commands/PlayerCommands.java index 6e2dba0..613ec1c 100644 --- a/src/main/java/project/app/warzone/Commands/PlayerCommands.java +++ b/src/main/java/project/app/warzone/Commands/PlayerCommands.java @@ -6,6 +6,7 @@ import java.util.Observable; import java.util.Observer; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.shell.standard.ShellComponent; import org.springframework.shell.standard.ShellMethod; import org.springframework.shell.standard.ShellOption; @@ -24,6 +25,7 @@ @ShellComponent public class PlayerCommands implements Observer { + public GameEngine d_gameEngine; public PlayerFeatures d_playerFeatures; public String d_prevUserCommand; @@ -135,9 +137,10 @@ public String bombCountry(@ShellOption int p_countryId) { // @Prashant please add here check to see if player has bomb card **** Player l_player = d_gameEngine.getPlayers().get(PlayerCommands.d_CurrentPlayerId); - + for (Cards card : l_player.d_cardsInCollection) { - if (card.getCardType().equalsIgnoreCase("bomb")){ + boolean hasBombCard= card.getCardType().equalsIgnoreCase("bomb"); + if (hasBombCard){ d_gameEngine.getGamePhase().bomb(p_countryId); diff --git a/src/main/java/project/app/warzone/Features/MapFeatures.java b/src/main/java/project/app/warzone/Features/MapFeatures.java index 6579db9..0bbe3b3 100644 --- a/src/main/java/project/app/warzone/Features/MapFeatures.java +++ b/src/main/java/project/app/warzone/Features/MapFeatures.java @@ -38,6 +38,11 @@ public MapFeatures(MapResources mapResouces){ MapFeatures.mapResouces = mapResouces; } + +//Empty Constructor + public MapFeatures(){ + + } /** * used for getting instance * @return MapFeatures @@ -58,6 +63,7 @@ public static synchronized MapFeatures getInstance() * @return Map returns gamemap */ public Map readMap(String filename){ + System.out.println("Inside Domination::MapFeatures: readMap()"); LogObject l_logObject = new LogObject(); l_logObject.setD_command("showmap"); l_logEntryBuffer.addObserver(this); @@ -162,7 +168,7 @@ public Map readMap(String filename){ * @param gameMap used for storing game map */ public void printMap(Map gameMap){ - + System.out.println("------Domination Map ------"); System.out.println("------ Map ------"); System.out.println(); String continent =""; @@ -228,7 +234,7 @@ public java.util.Map validateByNodes(List p_allNodes, java.u * @param gameEngine storing gameEngine * @return Boolean returns the status of validating */ - public Boolean validateEntireGraph(GameEngine gameEngine){ + public boolean validateEntireGraph(GameEngine gameEngine){ System.out.println(); @@ -268,7 +274,7 @@ public Boolean validateEntireGraph(GameEngine gameEngine){ public boolean validateSubGraph(Continent con, List l_listOfNodes,java.util.Map l_visitedList){ List l_nodesOfContinent = l_listOfNodes.stream().filter(c-> c.getData().getContinent().equals(con)).toList(); - if(l_nodesOfContinent.size() == 0){ + if(l_nodesOfContinent.isEmpty()){ return false; } l_visitedList =validateByNodes(l_nodesOfContinent,l_visitedList); diff --git a/src/main/java/project/app/warzone/Model/AttackOrder.java b/src/main/java/project/app/warzone/Model/AttackOrder.java index fd08887..a4988c7 100644 --- a/src/main/java/project/app/warzone/Model/AttackOrder.java +++ b/src/main/java/project/app/warzone/Model/AttackOrder.java @@ -197,9 +197,8 @@ public void Negotiate(Player p_playerToNegotiate,Player currentPlayer) public void update(java.util.Observable p_obj, Object p_arg) { LogObject l_logObject = (LogObject) p_arg; if (p_arg instanceof LogObject) { - try { - BufferedWriter l_writer = new BufferedWriter( - new FileWriter(System.getProperty("logFileLocation"), true)); + try (BufferedWriter l_writer = new BufferedWriter( + new FileWriter(System.getProperty("logFileLocation"), true))){ l_writer.newLine(); l_writer.append(LogObject.d_logLevel + " " + l_logObject.d_command + "\n" + "Time: " + l_logObject.d_timestamp + "\n" + "Status: " + l_logObject.d_statusCode + "\n" + "Description: " + l_logObject.d_message); diff --git a/src/main/java/project/app/warzone/Model/Cards.java b/src/main/java/project/app/warzone/Model/Cards.java index 1a01cfd..fad52f9 100644 --- a/src/main/java/project/app/warzone/Model/Cards.java +++ b/src/main/java/project/app/warzone/Model/Cards.java @@ -24,11 +24,14 @@ public String getCardType() { public void setCardType(String cardType) { cardType = cardType.toUpperCase(); - if (cardType.equals("BOMB") || cardType.equals("REINFORCEMENT") || cardType.equals("BLOCKADE") || cardType.equals("AIRLIFT") || cardType.equals("NEGOTIATE")) { + if (isValidCardType(cardType)) { this.cardType = cardType; } else { System.out.println("Invalid card type"); } } + public boolean isValidCardType(String cardType) { + return List.of("BOMB", "REINFORCEMENT", "BLOCKADE", "AIRLIFT", "NEGOTIATE").contains(cardType); + } } diff --git a/src/main/java/project/app/warzone/Model/ConquestFileReader.java b/src/main/java/project/app/warzone/Model/ConquestFileReader.java new file mode 100644 index 0000000..e0d7ea7 --- /dev/null +++ b/src/main/java/project/app/warzone/Model/ConquestFileReader.java @@ -0,0 +1,155 @@ +package project.app.warzone.Model; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Observer; + +import project.app.warzone.Utilities.LogObject; + +public class ConquestFileReader { + private LogEntryBuffer l_logEntryBuffer = new LogEntryBuffer(); + + //Empty Constructor + public ConquestFileReader(){ + + } + public Map readMap(String filename){ + System.out.println("Inside ConquestFileReader: readMap()"); + // LogObject l_logObject = new LogObject(); + // l_logObject.setD_command("showmap"); + // l_logEntryBuffer.addObserver((Observer) this); + + String l_line=""; + List continentsList = new ArrayList<>(); + List nodesList = new ArrayList<>(); + Map gameMap = new Map(); + try{ + + BufferedReader reader = new BufferedReader(new FileReader(filename)); + while ( l_line !=null ) { + + l_line=reader.readLine(); + if(l_line.equals("[continents]")){ + l_line=reader.readLine(); + + while(!l_line.equals("")){ + + String[] continentDetails = l_line.split(" "); + gameMap.createContinent(continentDetails[0], Integer.parseInt((continentDetails[1]))); + l_line= reader.readLine(); + + } + + continentsList= gameMap.getListOfContinents(); + + + } + + if(l_line.equals("[countries]")){ + + l_line=reader.readLine(); + + while(!l_line.equals("") ){ + + String[] countryDetails = l_line.split(" "); + gameMap.createAndInsertCountry(Integer.parseInt(countryDetails[0]),countryDetails[1],continentsList.get(Integer.parseInt(countryDetails[2])-1) ); + l_line= reader.readLine(); + + + } + + nodesList = gameMap.getNodes(); + + + + } + + + if(l_line.equals("[borders]")){ + + l_line=reader.readLine(); + + while( l_line != null && !l_line.equals("")){ + + List bordersToConnect = new ArrayList<>(); + String[] borderDetails = l_line.split(" "); + Node currentTerritory = nodesList.get(Integer.parseInt(borderDetails[0])-1); + + for(int i=1 ; i< borderDetails.length;i++){ + Node node=nodesList.get(Integer.parseInt(borderDetails[i])-1); + bordersToConnect.add(node); + } + gameMap.addEdgesOfCountry(currentTerritory, bordersToConnect); + l_line=reader.readLine(); + + + } + } + + } + + reader.close(); + // l_logObject.setStatus(true, "User printed map " + filename.split("/")[filename.split("/").length-1].split(".map")[0]); + // l_logEntryBuffer.notifyClasses(l_logObject); + printMap(gameMap); + return gameMap; + + } + catch(FileNotFoundException e){ + // l_logObject.setStatus(false, "Error: File not found"); + // l_logEntryBuffer.notifyClasses(l_logObject); + e.printStackTrace(); + return gameMap; + + } + catch (IOException e) { + // l_logObject.setStatus(false, "IO Exception"); + // l_logEntryBuffer.notifyClasses(l_logObject); + e.printStackTrace(); + return gameMap; + + } + + } + + + public void printMap(Map gameMap){ + System.out.println("Inside ConquestFileReader: printMap()"); + System.out.println("------Conquest Map ------"); + System.out.println(); + String continent =""; + List nodeList = gameMap.getNodes(); + for(Node c : nodeList){ + + if(c.getData().getContinent().getContinentName() != continent ){ + System.out.println("Continent:"+c.getData().getContinent().getContinentName()); + continent = c.getData().getContinent().getContinentName(); + System.out.println("======================================================================="); + } + System.out.print(c.getData().getCountryName()+" : "); + String borderString =""; + if(c.getBorders() != null && c.getBorders().size()> 0 ){ + List listOfBorders = c.getBorders(); + + for(Node border : listOfBorders ){ + + borderString+=border.getData().getCountryName()+" -> "; + + } + borderString=borderString.substring(0,borderString.length()-4); + System.out.println(borderString); + System.out.println(); + } + + + + } + } + + + +} diff --git a/src/main/java/project/app/warzone/Model/Edit.java b/src/main/java/project/app/warzone/Model/Edit.java index b1a5fdc..0b6f869 100644 --- a/src/main/java/project/app/warzone/Model/Edit.java +++ b/src/main/java/project/app/warzone/Model/Edit.java @@ -1,4 +1,7 @@ package project.app.warzone.Model; + +import project.app.warzone.Features.MapFeatures; + public abstract class Edit extends Phase{ // Edit(GameEngine p_ge) { @@ -37,7 +40,7 @@ public void endGame() { printInvalidCommandMessage(); } - public void showMap() { + public void showMap(MapFeatures newmapFeatures) { printInvalidCommandMessage(); } diff --git a/src/main/java/project/app/warzone/Model/End.java b/src/main/java/project/app/warzone/Model/End.java index 864184d..8738587 100644 --- a/src/main/java/project/app/warzone/Model/End.java +++ b/src/main/java/project/app/warzone/Model/End.java @@ -1,5 +1,7 @@ package project.app.warzone.Model; +import project.app.warzone.Features.MapFeatures; + public class End extends Phase { End(GameEngine p_ge) { @@ -10,7 +12,7 @@ public void loadMap(String p_filename) { printInvalidCommandMessage(); } - public void showMap() { + public void showMap(MapFeatures newmapFeatures) { printInvalidCommandMessage(); } diff --git a/src/main/java/project/app/warzone/Model/MapFeatureAdapter.java b/src/main/java/project/app/warzone/Model/MapFeatureAdapter.java new file mode 100644 index 0000000..e4c2536 --- /dev/null +++ b/src/main/java/project/app/warzone/Model/MapFeatureAdapter.java @@ -0,0 +1,16 @@ +package project.app.warzone.Model; + +import project.app.warzone.Features.MapFeatures; +public class MapFeatureAdapter extends MapFeatures { + ConquestFileReader conquestReader; + + public MapFeatureAdapter(ConquestFileReader conquestReader){ + this.conquestReader= conquestReader; + + } + + public Map readMap(String fileName) + { + return conquestReader.readMap(fileName); + } +} diff --git a/src/main/java/project/app/warzone/Model/Phase.java b/src/main/java/project/app/warzone/Model/Phase.java index 4b712e9..c409bfa 100644 --- a/src/main/java/project/app/warzone/Model/Phase.java +++ b/src/main/java/project/app/warzone/Model/Phase.java @@ -7,6 +7,7 @@ import org.jline.utils.Log; +import project.app.warzone.Features.MapFeatures; import project.app.warzone.Utilities.LogObject; // This class is Phase.java state design pattern class with GameEngine.java as the context class. @@ -30,7 +31,7 @@ public abstract class Phase implements Observer { // common commands abstract public void loadMap(String p_filename); - abstract public void showMap(); + abstract public void showMap(MapFeatures newmapFeatures); // Edit map commands abstract public void editCountry(String p_editcmd,String p_editremovecmd); diff --git a/src/main/java/project/app/warzone/Model/Play.java b/src/main/java/project/app/warzone/Model/Play.java index 65e2071..8e897e8 100644 --- a/src/main/java/project/app/warzone/Model/Play.java +++ b/src/main/java/project/app/warzone/Model/Play.java @@ -31,7 +31,7 @@ public abstract class Play extends Phase implements Observer { l_logEntryBuffer.addObserver(this); } - public void showMap() { + public void showMap(MapFeatures newmapFeatures) { LogObject l_logObject = new LogObject(); l_logObject.setD_command("showmap"); diff --git a/src/main/java/project/app/warzone/Model/Postload.java b/src/main/java/project/app/warzone/Model/Postload.java index 8c92eb3..2b74ce1 100644 --- a/src/main/java/project/app/warzone/Model/Postload.java +++ b/src/main/java/project/app/warzone/Model/Postload.java @@ -31,13 +31,13 @@ public void editMap(String p_fileName) { printInvalidCommandMessage(); } - public void showMap() { + public void showMap(MapFeatures newmapFeatures) { LogObject l_logObject = new LogObject(); l_logObject.setD_command("showmap"); String p_mapLocation = ge.gameMap.getMapDirectory() + "//" + ge.gameMap.get_USER_SELECTED_FILE() + ".map"; Boolean l_result = false; - ge.gameMap = d_mapFeatures.readMap(p_mapLocation); + ge.gameMap = newmapFeatures.readMap(p_mapLocation); l_result = d_mapFeatures.validateEntireGraph(ge); if (!l_result) { l_logObject.setStatus(false, "Map is not shown but map is not valid!"); diff --git a/src/main/java/project/app/warzone/Utilities/Maps/ConquestDemo.map b/src/main/java/project/app/warzone/Utilities/Maps/ConquestDemo.map new file mode 100644 index 0000000..bca4244 --- /dev/null +++ b/src/main/java/project/app/warzone/Utilities/Maps/ConquestDemo.map @@ -0,0 +1,58 @@ +conquest +[continents] +North_Europe 5 red +East_Europe 4 magenta +South_Europe 5 green +West_Europe 3 blue + +[countries] +1 England 1 164 126 +2 Scotland 1 158 44 +3 N_Ireland 1 125 70 +4 Rep_Ireland 1 106 90 +5 Wales 1 141 109 +6 Belgium 1 213 153 +7 Netherlands 1 226 128 +8 Denmark 2 275 76 +9 Germany 2 261 149 +10 Poland 2 346 141 +11 Czech_Rep 2 308 173 +12 Slovakia 2 356 190 +13 Hungary 3 347 220 +14 Austria 3 306 210 +15 Switzerland 3 233 217 +16 Italy 3 264 249 +17 Sicily 3 294 363 +18 Sardinia 3 240 321 +19 Corsica 3 242 286 +20 Majorca 4 184 319 +21 France 4 176 202 +22 Spain 4 96 285 +23 Portugal 4 38 290 +24 Luxembourg 4 227 172 + +[borders] +1 8 21 6 7 5 2 3 4 +2 8 1 3 +3 1 2 +4 22 1 5 +5 1 4 +6 9 21 24 7 1 +7 9 6 1 +8 10 9 2 1 +9 15 14 11 10 8 7 6 24 +10 12 11 8 9 +11 14 12 9 10 +12 14 13 10 11 +13 14 12 +14 16 15 13 9 11 12 +15 16 14 9 21 +16 18 17 15 14 +17 18 16 +18 20 17 19 16 +19 20 18 +20 22 19 18 +21 22 15 24 6 1 +22 23 4 20 21 +23 22 +24 9 21 6 diff --git a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map new file mode 100644 index 0000000..2c06ce8 --- /dev/null +++ b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map @@ -0,0 +1,48 @@ +[Map] +author=Maxime Gousse +warn=yes +image=Montreal.bmp +wrap=no +scroll=horizontal + +[Continents] +Montreal Est=3 +Montreal Centre-Est=4 +Montreal Centre-Ouest=4 +Montreal Centre=3 +Montreal Ouest=6 + + +[Territories] +RDP-PAT,330,50,Montreal Est,Anjou,Montreal Nord,Mercier +Anjou,300,95,Montreal Est,RDP-PAT,Montreal Nord,Mercier,St-Leonard +Montreal Nord,255,110,Montreal Est,RDP-PAT,Anjou,St-Leonard,Ahuntsic,Villeray +St-Leonard,270,120,Montreal Est,Montreal Nord,Anjou,Mercier,Rosemont,Villeray +Mercier,325,130, Montreal Est, RDP-PAT, Anjou, St-Leonard, Rosemont, Plateau + +Ahuntsic,230,160,Montreal Centre-Est,Montreal Nord, Villeray,Mont-Royal,Saint-Laurent,Pierrefonds +Villeray,265,150,Montreal Centre-Est,Ahuntsic,Montreal Nord,St-Leonard,Rosemont,Mont-ROyal,Outremont +Rosemont,290,160,Montreal Centre-Est,St-Leonard,Villeray,Mercier,Plateau,Outremont +Plateau,300,180,Montreal Centre-Est,Mercier,Rosemont,Outremont,Ville-Marie +Outremont,270,195,Montreal Centre-Est,Villeray,Rosemont,Plateau,Ville-Marie,NDG,Mont-Royal + +Saint-Laurent, 200, 210, Montreal Centre-Ouest,Ahuntsic,Mont-Royal,Hampstead,Pierrefonds,Lachine,Dorval,NDG +Mont-Royal, 240, 200, Montreal Centre-Ouest,Saint-Laurent,Ahuntsic,Villeray,Outremont,NDG,Hampstead +NDG, 255, 220, Montreal Centre-Ouest,Mont-Royal,Outremont,Ville-Marie,Westmount,Pointe St-Charles,Hampstead,Saint-Laurent +Hampstead, 230, 245, Montreal Centre-Ouest,Saint-Laurent,Mont-Royal,NDG,Pointe St-Charles,La Salle,Lachine +Westmount, 275, 225, Montreal Centre-Ouest,NDG,Ville-Marie,Pointe St-Charles + +Ville-Marie, 300, 210, Montreal Centre,Plateau,Outremont,NDG,Westmount,Pointe St-Charles +Pointe St-Charles, 290, 240, Montreal Centre,Ville-Marie,Westmount,Verdun,NDG,La Salle, Hampstead +Verdun, 300, 260, Montreal Centre,La Salle,Pointe St-Charles +La Salle, 260, 285, Montreal Centre,Lachine,Pointe St-Charles,Verdun, Hampstead +Lachine, 210, 270, Montreal Centre,La Salle,Hampstead,Saint-Laurent,Dorval + +Dorval, 165, 260, Montreal Ouest,Saint-Laurent,Lachine,Pointe-Claire,Pierrefonds +Pierrefonds, 125, 220, Montreal Ouest,Saint-Laurent,Ahuntsic,Dorval,Pointe-Claire,Kirkland,Senneville +Pointe-Claire, 120, 260, Montreal Ouest,Dorval,Pierrefonds,Kirkland,Beaconsfield +Beaconsfield, 70, 290, Montreal Ouest,Pointe-Claire,Kirkland,Ste-Anne-de-Bellevue +Ste-Anne-de-Bellevue, 30, 285, Montreal Ouest,Beaconsfield,Kirkland,Senneville +Senneville, 75, 240, Montreal Ouest,Ile Bizard,Ste-Anne-de-Bellevue,Kirkland,Pierrefonds +Ile Bizard, 60, 220, Montreal Ouest,Senneville +Kirkland, 80, 265, Montreal Ouest,Senneville,Ste-Anne-de-Bellevue,Beaconsfield,Pointe-Claire,Pierrefonds \ No newline at end of file diff --git a/src/main/java/project/app/warzone/Utilities/Maps/demo.map b/src/main/java/project/app/warzone/Utilities/Maps/demo.map index 8e59b56..240c0da 100644 --- a/src/main/java/project/app/warzone/Utilities/Maps/demo.map +++ b/src/main/java/project/app/warzone/Utilities/Maps/demo.map @@ -4,7 +4,6 @@ South_Europe 4 West_Europe 5 North_Europe 5 - [countries] 1 England 1 2 Scotland 1 @@ -15,7 +14,6 @@ North_Europe 5 7 Netherlands 4 8 Denmark 4 -[borders] [borders] 1 2 2 1 3 5 From 4b509cf6e9b2b6a86f6fb8eff4ff55fd36c13e04 Mon Sep 17 00:00:00 2001 From: AishwaryaShinde07 Date: Wed, 29 Nov 2023 00:33:35 -0500 Subject: [PATCH 2/5] Added continent and country --- .../app/warzone/Model/ConquestFileReader.java | 58 ++++++++++++------- .../app/warzone/Utilities/Maps/Montreal.map | 5 -- .../app/warzone/Features/CardTest.java | 8 ++- .../app/warzone/Model/AttackOrderTest.java | 8 +-- 4 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/main/java/project/app/warzone/Model/ConquestFileReader.java b/src/main/java/project/app/warzone/Model/ConquestFileReader.java index e0d7ea7..01df561 100644 --- a/src/main/java/project/app/warzone/Model/ConquestFileReader.java +++ b/src/main/java/project/app/warzone/Model/ConquestFileReader.java @@ -17,6 +17,7 @@ public class ConquestFileReader { public ConquestFileReader(){ } + public Map readMap(String filename){ System.out.println("Inside ConquestFileReader: readMap()"); // LogObject l_logObject = new LogObject(); @@ -33,42 +34,59 @@ public Map readMap(String filename){ while ( l_line !=null ) { l_line=reader.readLine(); - if(l_line.equals("[continents]")){ + if(l_line.equals("[Map]")){ + do{ l_line=reader.readLine(); - while(!l_line.equals("")){ + }while(!l_line.equals("")); + + if(l_line.equals("[Continents]")){ + l_line=reader.readLine(); - String[] continentDetails = l_line.split(" "); - gameMap.createContinent(continentDetails[0], Integer.parseInt((continentDetails[1]))); - l_line= reader.readLine(); + do{ + String[] continentDetails =l_line.split("="); + gameMap.createContinent(continentDetails[0], Integer.parseInt((continentDetails[1]))); + l_line=reader.readLine(); - } - + }while(!l_line.equals("")); + } continentsList= gameMap.getListOfContinents(); - + l_line=reader.readLine(); } - - if(l_line.equals("[countries]")){ + + if(l_line.equals("[Territories]")){ l_line=reader.readLine(); - - while(!l_line.equals("") ){ - - String[] countryDetails = l_line.split(" "); - gameMap.createAndInsertCountry(Integer.parseInt(countryDetails[0]),countryDetails[1],continentsList.get(Integer.parseInt(countryDetails[2])-1) ); + int i=0; + // int k=1; + String[][] listOfCountries={}; + while(!l_line.equals(" ") ){ + + + String[] countryDetails = l_line.split(","); + for(int j=0; j bordersToConnect = new ArrayList<>(); + Node currentTerritory = nodesList.get(k); //setting an id for borders + // for(int j=0; j< ;j++) + // { + // } } + - nodesList = gameMap.getNodes(); - - - } - if(l_line.equals("[borders]")){ l_line=reader.readLine(); diff --git a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map index 2c06ce8..77ccb2e 100644 --- a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map +++ b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map @@ -12,32 +12,27 @@ Montreal Centre-Ouest=4 Montreal Centre=3 Montreal Ouest=6 - [Territories] RDP-PAT,330,50,Montreal Est,Anjou,Montreal Nord,Mercier Anjou,300,95,Montreal Est,RDP-PAT,Montreal Nord,Mercier,St-Leonard Montreal Nord,255,110,Montreal Est,RDP-PAT,Anjou,St-Leonard,Ahuntsic,Villeray St-Leonard,270,120,Montreal Est,Montreal Nord,Anjou,Mercier,Rosemont,Villeray Mercier,325,130, Montreal Est, RDP-PAT, Anjou, St-Leonard, Rosemont, Plateau - Ahuntsic,230,160,Montreal Centre-Est,Montreal Nord, Villeray,Mont-Royal,Saint-Laurent,Pierrefonds Villeray,265,150,Montreal Centre-Est,Ahuntsic,Montreal Nord,St-Leonard,Rosemont,Mont-ROyal,Outremont Rosemont,290,160,Montreal Centre-Est,St-Leonard,Villeray,Mercier,Plateau,Outremont Plateau,300,180,Montreal Centre-Est,Mercier,Rosemont,Outremont,Ville-Marie Outremont,270,195,Montreal Centre-Est,Villeray,Rosemont,Plateau,Ville-Marie,NDG,Mont-Royal - Saint-Laurent, 200, 210, Montreal Centre-Ouest,Ahuntsic,Mont-Royal,Hampstead,Pierrefonds,Lachine,Dorval,NDG Mont-Royal, 240, 200, Montreal Centre-Ouest,Saint-Laurent,Ahuntsic,Villeray,Outremont,NDG,Hampstead NDG, 255, 220, Montreal Centre-Ouest,Mont-Royal,Outremont,Ville-Marie,Westmount,Pointe St-Charles,Hampstead,Saint-Laurent Hampstead, 230, 245, Montreal Centre-Ouest,Saint-Laurent,Mont-Royal,NDG,Pointe St-Charles,La Salle,Lachine Westmount, 275, 225, Montreal Centre-Ouest,NDG,Ville-Marie,Pointe St-Charles - Ville-Marie, 300, 210, Montreal Centre,Plateau,Outremont,NDG,Westmount,Pointe St-Charles Pointe St-Charles, 290, 240, Montreal Centre,Ville-Marie,Westmount,Verdun,NDG,La Salle, Hampstead Verdun, 300, 260, Montreal Centre,La Salle,Pointe St-Charles La Salle, 260, 285, Montreal Centre,Lachine,Pointe St-Charles,Verdun, Hampstead Lachine, 210, 270, Montreal Centre,La Salle,Hampstead,Saint-Laurent,Dorval - Dorval, 165, 260, Montreal Ouest,Saint-Laurent,Lachine,Pointe-Claire,Pierrefonds Pierrefonds, 125, 220, Montreal Ouest,Saint-Laurent,Ahuntsic,Dorval,Pointe-Claire,Kirkland,Senneville Pointe-Claire, 120, 260, Montreal Ouest,Dorval,Pierrefonds,Kirkland,Beaconsfield diff --git a/src/test/java/project/app/warzone/Features/CardTest.java b/src/test/java/project/app/warzone/Features/CardTest.java index cb932fc..fa10fc1 100644 --- a/src/test/java/project/app/warzone/Features/CardTest.java +++ b/src/test/java/project/app/warzone/Features/CardTest.java @@ -12,6 +12,7 @@ import project.app.warzone.Commands.PlayerCommands; import project.app.warzone.Features.PlayerFeatures; +import project.app.warzone.Features.MapFeatures; import project.app.warzone.Model.Cards; import project.app.warzone.Model.GameEngine; import project.app.warzone.Model.Map; @@ -41,10 +42,10 @@ public void setUp(){ @Test public void bombSelf(){ - + MapFeatures mapFeatures= MapFeatures.getInstance(); d_gameEngine.getGamePhase().loadMap("europe"); String l_res ="1"; - d_gameEngine.getGamePhase().showMap(); + d_gameEngine.getGamePhase().showMap(mapFeatures); d_gameEngine.getGamePhase().setPlayers("add","rochelle"); d_gameEngine.getGamePhase().setPlayers("add","numan"); d_gameEngine.getGamePhase().assignCountries(); @@ -80,9 +81,10 @@ public void testBombCountry() { //Map l_map = new Map(); //GameEngine l_gameEngine = new GameEngine(l_map); + MapFeatures mapFeatures= MapFeatures.getInstance(); d_gameEngine.getGamePhase().loadMap("europe"); String l_res ="1"; - d_gameEngine.getGamePhase().showMap(); + d_gameEngine.getGamePhase().showMap(mapFeatures); d_gameEngine.getGamePhase().setPlayers("add","rochelle"); d_gameEngine.getGamePhase().setPlayers("add","numan"); d_gameEngine.getGamePhase().setPlayers("add","anash"); diff --git a/src/test/java/project/app/warzone/Model/AttackOrderTest.java b/src/test/java/project/app/warzone/Model/AttackOrderTest.java index 1c40aa5..458001e 100644 --- a/src/test/java/project/app/warzone/Model/AttackOrderTest.java +++ b/src/test/java/project/app/warzone/Model/AttackOrderTest.java @@ -162,12 +162,12 @@ public void testBlockadeToEnemyCountry() { @Test public void testNegotiate() { - + MapFeatures mapFeatures= MapFeatures.getInstance(); d_playerFeatures.assignCountries(d_gameEngine); LogObject l_logObject = new LogObject(); d_gameEngine.getGamePhase().loadMap("europe"); - d_gameEngine.getGamePhase().showMap(); + d_gameEngine.getGamePhase().showMap(mapFeatures); d_gameEngine.getGamePhase().setPlayers("add","rochelle"); d_gameEngine.getGamePhase().setPlayers("add","numan"); d_gameEngine.getGamePhase().assignCountries(); @@ -196,12 +196,12 @@ public void testNegotiate() { @Test public void testNegotiateWithSelf() { - + MapFeatures mapFeatures= MapFeatures.getInstance(); d_playerFeatures.assignCountries(d_gameEngine); LogObject l_logObject = new LogObject(); d_gameEngine.getGamePhase().loadMap("europe"); - d_gameEngine.getGamePhase().showMap(); + d_gameEngine.getGamePhase().showMap(mapFeatures); d_gameEngine.getGamePhase().setPlayers("add","rochelle"); d_gameEngine.getGamePhase().setPlayers("add","numan"); d_gameEngine.getGamePhase().assignCountries(); From 8dd547d37528d739eefdfda28e141bc233323094 Mon Sep 17 00:00:00 2001 From: anash3420 Date: Wed, 29 Nov 2023 02:12:19 -0500 Subject: [PATCH 3/5] Added Boundaries --- spring-shell.log | 99 +++++++++++++++++++ .../warzone/Commands/MapEditorCommands.java | 2 +- .../app/warzone/Model/ConquestFileReader.java | 96 ++++++++++-------- .../app/warzone/Utilities/Maps/Montreal.map | 2 +- .../java/project/app/warzone/gameplay.log | 54 +--------- 5 files changed, 157 insertions(+), 96 deletions(-) diff --git a/spring-shell.log b/spring-shell.log index 62ef83c..a77faa7 100644 --- a/spring-shell.log +++ b/spring-shell.log @@ -2280,3 +2280,102 @@ 1700605732538:N 1700605741340:deploy 8 2 1700605782380:N +1701230940992:loadmap europe +1701230942557:showmap +1701236740235:loadmap Montreal +1701236746508:showmap +1701236767614:stacktrace +1701236861264:loadmap Montreal +1701236863225:showmap +1701236990607:loadmap Montreal +1701236999712:showmap +1701237006388:stacktrace +1701237115592:loadmap Montreal +1701237116950:showmap +1701237148660:loadmap Montreal +1701237149939:showmap +1701237168519:loadmap Montreal +1701237169947:showmap +1701237300700:stacktrace +1701237584385:loadmap Montreal +1701237586109:showmap +1701237589948:stacktrace +1701237679286:loadmap Montreal +1701237680599:showmap +1701237757827:stacktrace +1701237826322:loadmap Montreal +1701237827982:showmap +1701237944280:loadmap Montreal +1701237953980:showmap +1701237957724:stacktrace +1701238169064:showmap +1701238171521:loadmap Montreal +1701238173337:showmap +1701238178185:stacktrace +1701238239788:loadmap Montreal +1701238241376:showmap +1701238289135:loadmap Montreal +1701238290154:showmap +1701238346436:loadmap Montreal +1701238347499:showmap +1701238533581:loadmap Montreal +1701238534650:showmap +1701238576702:loadmap Montreal +1701238577546:showmap +1701238684135:loadmap Montreal +1701238684946:showmap +1701238690518:stacktrace +1701238748297:loadmap Montreal +1701238750054:showmap +1701238824774:loadmap Montreal +1701238825649:showmap +1701238908174:loadmap Montreal +1701238909058:showmap +1701238941764:loadmap Montreal +1701238944093:showap +1701238947004:showmap +1701239283212:loadmap Montreal +1701239284432:showmap +1701239294107:stacktrace +1701239377949:showmap +1701239379804:loadmap Montreal +1701239381129:showmap +1701239385581:stacktrace +1701239495529:loadmap Montreal +1701239496666:stacktrace +1701239499281:showmap +1701239535998:stacktrace +1701239621768:loadmap Montreal +1701239623274:showmap +1701239930212:loadmap Montreal +1701239931481:showmap +1701240115214:loadmap Montreal +1701240116397:showmap +1701240233328:loadmap Montreal +1701240234320:showmap +1701240279045:loadmap Montreal +1701240280032:showmap +1701240487037:loadmap Montreal +1701240492588:showmap +1701240603252:stacktrace +1701240655111:loadmap Montreal +1701240656826:showmap +1701241015755:loadmap Montreal +1701241017260:showmap +1701241077900:loadmap Montreal +1701241080360:showmap +1701241161838:loadmap Montreal +1701241166400:showmap +1701241211175:loadmap Montreal +1701241212547:showmap +1701241230836:loadmap Montreal +1701241231838:showmap +1701241257595:stacktrace +1701241319538:loadmap Montreal +1701241321361:showmap +1701241481914:loadmap Montreal +1701241491611:showmap +1701241617730:loadmap Montreal +1701241618863:showmap +1701241650356:loadmap europe +1701241652547:showmap diff --git a/src/main/java/project/app/warzone/Commands/MapEditorCommands.java b/src/main/java/project/app/warzone/Commands/MapEditorCommands.java index f2a3ca2..df9273d 100644 --- a/src/main/java/project/app/warzone/Commands/MapEditorCommands.java +++ b/src/main/java/project/app/warzone/Commands/MapEditorCommands.java @@ -72,7 +72,7 @@ public void showmap() { BufferedReader reader = new BufferedReader(new FileReader(p_mapLocation)); MapFeatures mapFeatures= MapFeatures.getInstance(); l_line=reader.readLine(); - if(l_line.equals("conquest")){ + if(l_line.equals("[Map]")){ mapFeatures = new MapFeatureAdapter(new ConquestFileReader()); // newmMapFeatures.readMap(p_mapLocation); } diff --git a/src/main/java/project/app/warzone/Model/ConquestFileReader.java b/src/main/java/project/app/warzone/Model/ConquestFileReader.java index 01df561..8eda53f 100644 --- a/src/main/java/project/app/warzone/Model/ConquestFileReader.java +++ b/src/main/java/project/app/warzone/Model/ConquestFileReader.java @@ -31,82 +31,94 @@ public Map readMap(String filename){ try{ BufferedReader reader = new BufferedReader(new FileReader(filename)); - while ( l_line !=null ) { + l_line=reader.readLine(); + while ( l_line !=null ) { - l_line=reader.readLine(); if(l_line.equals("[Map]")){ do{ l_line=reader.readLine(); }while(!l_line.equals("")); - - if(l_line.equals("[Continents]")){ - l_line=reader.readLine(); - - do{ - String[] continentDetails =l_line.split("="); - gameMap.createContinent(continentDetails[0], Integer.parseInt((continentDetails[1]))); - l_line=reader.readLine(); + } + if(l_line.equals("[Continents]")){ + l_line=reader.readLine(); - }while(!l_line.equals("")); + while(!l_line.equals("")){ + String[] continentDetails =l_line.split("="); + gameMap.createContinent(continentDetails[0], Integer.parseInt((continentDetails[1]))); + l_line=reader.readLine(); + }; + continentsList= gameMap.getListOfContinents(); } - continentsList= gameMap.getListOfContinents(); - - l_line=reader.readLine(); - } if(l_line.equals("[Territories]")){ l_line=reader.readLine(); int i=0; + int countryId = -1; // int k=1; - String[][] listOfCountries={}; - while(!l_line.equals(" ") ){ - - + String[][] listOfCountries= new String[28][20]; + // This loop is used to create the countries + while(l_line != null){ String[] countryDetails = l_line.split(","); for(int j=0; j bordersToConnect = new ArrayList<>(); - Node currentTerritory = nodesList.get(k); //setting an id for borders - // for(int j=0; j< ;j++) - // { - - // } + List bordersToConnect = new ArrayList<>(); + Node currentTerritory = nodesList.get(k); //setting an id for borders + for(int j=0; j < listOfCountries[k].length ;j++) + { + // listOfCountries[k][j] is the name of the country + for(i=0; i bordersToConnect = new ArrayList<>(); - String[] borderDetails = l_line.split(" "); - Node currentTerritory = nodesList.get(Integer.parseInt(borderDetails[0])-1); + // List bordersToConnect = new ArrayList<>(); + // String[] borderDetails = l_line.split(" "); + // Node currentTerritory = nodesList.get(Integer.parseInt(borderDetails[0])-1); - for(int i=1 ; i< borderDetails.length;i++){ - Node node=nodesList.get(Integer.parseInt(borderDetails[i])-1); - bordersToConnect.add(node); - } - gameMap.addEdgesOfCountry(currentTerritory, bordersToConnect); - l_line=reader.readLine(); + // for(int i=1 ; i< borderDetails.length;i++){ + // Node node=nodesList.get(Integer.parseInt(borderDetails[i])-1); + // bordersToConnect.add(node); + // } + // gameMap.addEdgesOfCountry(currentTerritory, bordersToConnect); + // l_line=reader.readLine(); - } - } + // } + // } } diff --git a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map index 77ccb2e..69f485e 100644 --- a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map +++ b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map @@ -40,4 +40,4 @@ Beaconsfield, 70, 290, Montreal Ouest,Pointe-Claire,Kirkland,Ste-Anne-de-Bellevu Ste-Anne-de-Bellevue, 30, 285, Montreal Ouest,Beaconsfield,Kirkland,Senneville Senneville, 75, 240, Montreal Ouest,Ile Bizard,Ste-Anne-de-Bellevue,Kirkland,Pierrefonds Ile Bizard, 60, 220, Montreal Ouest,Senneville -Kirkland, 80, 265, Montreal Ouest,Senneville,Ste-Anne-de-Bellevue,Beaconsfield,Pointe-Claire,Pierrefonds \ No newline at end of file +Kirkland, 80, 265, Montreal Ouest,Senneville,Ste-Anne-de-Bellevue,Beaconsfield,Pointe-Claire,Pierrefonds diff --git a/src/main/java/project/app/warzone/gameplay.log b/src/main/java/project/app/warzone/gameplay.log index d22b645..c7cbbd2 100644 --- a/src/main/java/project/app/warzone/gameplay.log +++ b/src/main/java/project/app/warzone/gameplay.log @@ -2,61 +2,11 @@ Game Commnece 1 loadmap europe -Time: 05:28:13 +Time: 02:07:30 Status: SUCCESS Description: Map loaded successfully europe 2 showmap -Time: 05:28:15 +Time: 02:07:32 Status: SUCCESS Description: User printed map europe - -4 gameplayer -add p1,-add,p2 -Time: 05:28:20 -Status: SUCCESS -Description: Players added successfully - -5 assigncountries -Time: 05:28:26 -Status: SUCCESS -Description: Countries assigned successfully - -6 showstats -Time: 05:28:26 -Status: SUCCESS -Description: Stats shown. - -7 reinforce 1 3 -Time: 05:28:32 -Status: SUCCESS -Description: - -8 deploy 8 1 -Time: 05:28:45 -Status: SUCCESS -Description: Armies deployed successfully. - -9 reinforce 8 1 -Time: 05:28:45 -Status: SUCCESS -Description: - -10 Deploy -Time: 05:30:48 -Status: SUCCESS -Description: Executed Deploy Attack - -11 Deploy -Time: 05:30:48 -Status: SUCCESS -Description: Executed Deploy Attack - -12 Deploy -Time: 05:30:48 -Status: SUCCESS -Description: Executed Deploy Attack - -13 reinforce 8 2 -Time: 05:29:03 -Status: SUCCESS -Description: From 3588d08d326d8576b688ac3229cd5f3ad6881231 Mon Sep 17 00:00:00 2001 From: AishwaryaShinde07 Date: Wed, 29 Nov 2023 18:08:39 -0500 Subject: [PATCH 4/5] Adapter changes --- .../app/warzone/Model/ConquestFileReader.java | 35 ++++------------- .../project/app/warzone/Model/Preload.java | 6 ++- .../app/warzone/Utilities/Maps/Montreal.map | 38 +++++++++---------- 3 files changed, 31 insertions(+), 48 deletions(-) diff --git a/src/main/java/project/app/warzone/Model/ConquestFileReader.java b/src/main/java/project/app/warzone/Model/ConquestFileReader.java index 8eda53f..dc59895 100644 --- a/src/main/java/project/app/warzone/Model/ConquestFileReader.java +++ b/src/main/java/project/app/warzone/Model/ConquestFileReader.java @@ -19,9 +19,9 @@ public ConquestFileReader(){ } public Map readMap(String filename){ - System.out.println("Inside ConquestFileReader: readMap()"); - // LogObject l_logObject = new LogObject(); - // l_logObject.setD_command("showmap"); + // System.out.println("Inside ConquestFileReader: readMap()"); + // LogObject l_logObject = new LogObject(); + // l_logObject.setD_command("showmap"); // l_logEntryBuffer.addObserver((Observer) this); String l_line=""; @@ -99,38 +99,19 @@ public Map readMap(String filename){ } l_line=reader.readLine(); - // if(l_line.equals("[borders]")){ - - // l_line=reader.readLine(); - - // while( l_line != null && !l_line.equals("")){ - - // List bordersToConnect = new ArrayList<>(); - // String[] borderDetails = l_line.split(" "); - // Node currentTerritory = nodesList.get(Integer.parseInt(borderDetails[0])-1); - - // for(int i=1 ; i< borderDetails.length;i++){ - // Node node=nodesList.get(Integer.parseInt(borderDetails[i])-1); - // bordersToConnect.add(node); - // } - // gameMap.addEdgesOfCountry(currentTerritory, bordersToConnect); - // l_line=reader.readLine(); - - - // } - // } + } reader.close(); - // l_logObject.setStatus(true, "User printed map " + filename.split("/")[filename.split("/").length-1].split(".map")[0]); - // l_logEntryBuffer.notifyClasses(l_logObject); + // l_logObject.setStatus(true, "User printed map " + filename.split("/")[filename.split("/").length-1].split(".map")[0]); + // l_logEntryBuffer.notifyClasses(l_logObject); printMap(gameMap); return gameMap; } catch(FileNotFoundException e){ - // l_logObject.setStatus(false, "Error: File not found"); + // l_logObject.setStatus(false, "Error: File not found"); // l_logEntryBuffer.notifyClasses(l_logObject); e.printStackTrace(); return gameMap; @@ -148,7 +129,7 @@ public Map readMap(String filename){ public void printMap(Map gameMap){ - System.out.println("Inside ConquestFileReader: printMap()"); + //System.out.println("Inside ConquestFileReader: printMap()"); System.out.println("------Conquest Map ------"); System.out.println(); String continent =""; diff --git a/src/main/java/project/app/warzone/Model/Preload.java b/src/main/java/project/app/warzone/Model/Preload.java index 1b8b592..f50d181 100644 --- a/src/main/java/project/app/warzone/Model/Preload.java +++ b/src/main/java/project/app/warzone/Model/Preload.java @@ -61,9 +61,11 @@ public void loadMap(String p_filename) { } else { l_logObject.setStatus(false, "Map not found"); l_logEntryBuffer.notifyClasses(l_logObject); - System.out.println("Map not found."); - } + System.out.println(p_filename +"Map not found."); + System.out.println("To create new Map use command editmap filename"); + } +} /** diff --git a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map index 69f485e..a5658d8 100644 --- a/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map +++ b/src/main/java/project/app/warzone/Utilities/Maps/Montreal.map @@ -17,27 +17,27 @@ RDP-PAT,330,50,Montreal Est,Anjou,Montreal Nord,Mercier Anjou,300,95,Montreal Est,RDP-PAT,Montreal Nord,Mercier,St-Leonard Montreal Nord,255,110,Montreal Est,RDP-PAT,Anjou,St-Leonard,Ahuntsic,Villeray St-Leonard,270,120,Montreal Est,Montreal Nord,Anjou,Mercier,Rosemont,Villeray -Mercier,325,130, Montreal Est, RDP-PAT, Anjou, St-Leonard, Rosemont, Plateau +Mercier,325,130,Montreal Est,RDP-PAT, Anjou,St-Leonard,Rosemont,Plateau Ahuntsic,230,160,Montreal Centre-Est,Montreal Nord, Villeray,Mont-Royal,Saint-Laurent,Pierrefonds Villeray,265,150,Montreal Centre-Est,Ahuntsic,Montreal Nord,St-Leonard,Rosemont,Mont-ROyal,Outremont Rosemont,290,160,Montreal Centre-Est,St-Leonard,Villeray,Mercier,Plateau,Outremont Plateau,300,180,Montreal Centre-Est,Mercier,Rosemont,Outremont,Ville-Marie Outremont,270,195,Montreal Centre-Est,Villeray,Rosemont,Plateau,Ville-Marie,NDG,Mont-Royal -Saint-Laurent, 200, 210, Montreal Centre-Ouest,Ahuntsic,Mont-Royal,Hampstead,Pierrefonds,Lachine,Dorval,NDG -Mont-Royal, 240, 200, Montreal Centre-Ouest,Saint-Laurent,Ahuntsic,Villeray,Outremont,NDG,Hampstead -NDG, 255, 220, Montreal Centre-Ouest,Mont-Royal,Outremont,Ville-Marie,Westmount,Pointe St-Charles,Hampstead,Saint-Laurent -Hampstead, 230, 245, Montreal Centre-Ouest,Saint-Laurent,Mont-Royal,NDG,Pointe St-Charles,La Salle,Lachine -Westmount, 275, 225, Montreal Centre-Ouest,NDG,Ville-Marie,Pointe St-Charles -Ville-Marie, 300, 210, Montreal Centre,Plateau,Outremont,NDG,Westmount,Pointe St-Charles -Pointe St-Charles, 290, 240, Montreal Centre,Ville-Marie,Westmount,Verdun,NDG,La Salle, Hampstead -Verdun, 300, 260, Montreal Centre,La Salle,Pointe St-Charles -La Salle, 260, 285, Montreal Centre,Lachine,Pointe St-Charles,Verdun, Hampstead -Lachine, 210, 270, Montreal Centre,La Salle,Hampstead,Saint-Laurent,Dorval -Dorval, 165, 260, Montreal Ouest,Saint-Laurent,Lachine,Pointe-Claire,Pierrefonds -Pierrefonds, 125, 220, Montreal Ouest,Saint-Laurent,Ahuntsic,Dorval,Pointe-Claire,Kirkland,Senneville -Pointe-Claire, 120, 260, Montreal Ouest,Dorval,Pierrefonds,Kirkland,Beaconsfield -Beaconsfield, 70, 290, Montreal Ouest,Pointe-Claire,Kirkland,Ste-Anne-de-Bellevue -Ste-Anne-de-Bellevue, 30, 285, Montreal Ouest,Beaconsfield,Kirkland,Senneville -Senneville, 75, 240, Montreal Ouest,Ile Bizard,Ste-Anne-de-Bellevue,Kirkland,Pierrefonds -Ile Bizard, 60, 220, Montreal Ouest,Senneville -Kirkland, 80, 265, Montreal Ouest,Senneville,Ste-Anne-de-Bellevue,Beaconsfield,Pointe-Claire,Pierrefonds +Saint-Laurent,200, 210,Montreal Centre-Ouest,Ahuntsic,Mont-Royal,Hampstead,Pierrefonds,Lachine,Dorval,NDG +Mont-Royal,240, 200,Montreal Centre-Ouest,Saint-Laurent,Ahuntsic,Villeray,Outremont,NDG,Hampstead +NDG,255,220,Montreal Centre-Ouest,Mont-Royal,Outremont,Ville-Marie,Westmount,Pointe St-Charles,Hampstead,Saint-Laurent +Hampstead,230, 245,Montreal Centre-Ouest,Saint-Laurent,Mont-Royal,NDG,Pointe St-Charles,La Salle,Lachine +Westmount,275, 225, Montreal Centre-Ouest,NDG,Ville-Marie,Pointe St-Charles +Ville-Marie,300, 210,Montreal Centre,Plateau,Outremont,NDG,Westmount,Pointe St-Charles +Pointe St-Charles,290, 240,Montreal Centre,Ville-Marie,Westmount,Verdun,NDG,La Salle,Hampstead +Verdun,300, 260,Montreal Centre,La Salle,Pointe St-Charles +La Salle,260, 285,Montreal Centre,Lachine,Pointe St-Charles,Verdun, Hampstead +Lachine,210, 270,Montreal Centre,La Salle,Hampstead,Saint-Laurent,Dorval +Dorval,165, 260,Montreal Ouest,Saint-Laurent,Lachine,Pointe-Claire,Pierrefonds +Pierrefonds,125, 220,Montreal Ouest,Saint-Laurent,Ahuntsic,Dorval,Pointe-Claire,Kirkland,Senneville +Pointe-Claire,120, 260,Montreal Ouest,Dorval,Pierrefonds,Kirkland,Beaconsfield +Beaconsfield,70, 290,Montreal Ouest,Pointe-Claire,Kirkland,Ste-Anne-de-Bellevue +Ste-Anne-de-Bellevue,30, 285,Montreal Ouest,Beaconsfield,Kirkland,Senneville +Senneville,75, 240,Montreal Ouest,Ile Bizard,Ste-Anne-de-Bellevue,Kirkland,Pierreeditmapfonds +Ile Bizard,60, 220,Montreal Ouest,Senneville +Kirkland,80, 265,Montreal Ouest,Senneville,Ste-Anne-de-Bellevue,Beaconsfield,Pointe-Claire,Pierrefonds From 3866e4acb4ce71af134b3e85767da314fe90a32d Mon Sep 17 00:00:00 2001 From: AishwaryaShinde07 Date: Wed, 29 Nov 2023 20:29:22 -0500 Subject: [PATCH 5/5] Code fix --- src/main/java/project/app/warzone/Features/MapFeatures.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/project/app/warzone/Features/MapFeatures.java b/src/main/java/project/app/warzone/Features/MapFeatures.java index db58862..21aa942 100644 --- a/src/main/java/project/app/warzone/Features/MapFeatures.java +++ b/src/main/java/project/app/warzone/Features/MapFeatures.java @@ -53,7 +53,7 @@ public MapFeatures(){ public static synchronized MapFeatures getInstance() { if (d_singleInstance == null) - d_singleInstance = new MapFeatures(mapResouces); + d_singleInstance = new MapFeatures(new MapResources()); return d_singleInstance; }