From e469e431fb64a85f01445f6b1dda60bd0c309374 Mon Sep 17 00:00:00 2001 From: JiananAlvin Date: Sun, 24 Apr 2022 01:47:35 +0200 Subject: [PATCH] [release v1.1]merged subgroup3 && sloved movement --- src/main/java/content/MapName.java | 23 +++- src/main/java/content/RobotName.java | 25 +++-- src/main/java/gui/view/map/TileImageEnum.java | 48 ++++---- .../gui/view/widgets/game/BoardPanel.java | 3 +- .../java/gui/view/widgets/game/GamePanel.java | 11 +- .../java/gui/view/widgets/game/MatPanel.java | 6 +- .../gui/view/widgets/login/LoginPanel.java | 6 +- .../java/gui/view/widgets/room/RoomPanel.java | 2 +- .../view/widgets/waiting/WaitingPanel.java | 4 +- src/main/java/model/Game.java | 8 +- src/main/java/model/game/Player.java | 4 +- .../java/model/game/board/map/GameMap.java | 8 +- .../java/model/game/board/map/Position.java | 30 ++--- .../model/game/board/map/element/Robot.java | 23 ++-- .../card/programming/behaviour/Movement.java | 9 +- .../programming/card/SpecialProgrammable.java | 7 -- src/main/java/utils/MapReader.java | 62 ++-------- .../resources/maps/{map2.txt => ADVANCED.txt} | 0 src/main/resources/maps/INTERMEDIATE.txt | 2 +- .../test/InitializationStepsDefinition.java | 16 +-- .../test/InteractionStepsDefinition.java | 3 +- .../test/MapElementStepsDefinition.java | 34 +++--- .../resources/featureFiles/MapElement.feature | 106 +++++++++--------- 23 files changed, 206 insertions(+), 234 deletions(-) delete mode 100644 src/main/java/model/game/card/special/programming/card/SpecialProgrammable.java rename src/main/resources/maps/{map2.txt => ADVANCED.txt} (100%) diff --git a/src/main/java/content/MapName.java b/src/main/java/content/MapName.java index 08f8dfa..8d8c6b2 100644 --- a/src/main/java/content/MapName.java +++ b/src/main/java/content/MapName.java @@ -1,8 +1,19 @@ package content; -public class MapName { - public static final String STARTER = "STARTER"; - public static final String BEGINNER = "BEGINNER"; - public static final String INTERMEDIATE = "INTERMEDIATE"; - public static final String ADVANCED = "ADVANCED"; -} +public enum MapName { + + STARTER("STARTER"), + BEGINNER("BEGINNER"), + INTERMEDIATE("INTERMEDIATE"), + ADVANCED("ADVANCED"); + + private final String mapName; + + private MapName(String mapName) { + this.mapName = mapName; + } + + public String getMapName() { + return mapName; + } +} \ No newline at end of file diff --git a/src/main/java/content/RobotName.java b/src/main/java/content/RobotName.java index fd81662..b431b5b 100644 --- a/src/main/java/content/RobotName.java +++ b/src/main/java/content/RobotName.java @@ -1,10 +1,21 @@ package content; -public class RobotName { - public static final String SQUASH_BOT = "SQUASH_BOT"; - public static final String ZOOM_BOT = "ZOOM_BOT"; - public static final String HAMMER_BOT = "HAMMER_BOT"; - public static final String SPIN_BOT = "SPIN_BOT"; - public static final String HULK_X90 = "HULK_X90"; - public static final String TRUNDLE_BOT = "TRUNDLE_BOT"; +public enum RobotName { + + SQUASH_BOT("SQUASH_BOT"), + ZOOM_BOT("ZOOM_BOT"), + HAMMER_BOT("HAMMER_BOT"), + SPIN_BOT("SPIN_BOT"), + HULK_X90("HULK_X90"), + TRUNDLE_BOT("TRUNDLE_BOT"); + + private String name; + + private RobotName(String name) { + this.name = name; + } + + public String getName() { + return name; + } } diff --git a/src/main/java/gui/view/map/TileImageEnum.java b/src/main/java/gui/view/map/TileImageEnum.java index 9399e8b..9187554 100644 --- a/src/main/java/gui/view/map/TileImageEnum.java +++ b/src/main/java/gui/view/map/TileImageEnum.java @@ -6,34 +6,31 @@ public enum TileImageEnum { - BLANK(1, "src/main/resources/images/tiles/blank.png"), - CHARGER(2, "src/main/resources/images/tiles/charger.png"), - CHECKPOINT1(3, "src/main/resources/images/tiles/check_point1.png"), - REBOOTPOINT(4, "src/main/resources/images/tiles/reboot_point.png"), - SOUTHTWO(5, "src/main/resources/images/tiles/south_two.png"), - WESTTWO(6, "src/main/resources/images/tiles/west_two.png"), - ANTENNA(7, "src/main/resources/images/tiles/priority_antenna.png"), - EASTONE(8, "src/main/resources/images/tiles/east_one.png"), - EASTTWO(9, "src/main/resources/images/tiles/east_two.png"), - STARTPOINT(10, "src/main/resources/images/tiles/start_point.png"), - NORTHTWO(11, "src/main/resources/images/tiles/north_two.png"), - WALLSOUTH(12, "src/main/resources/images/tiles/wall_south.png"), - WALLSOUTHLASER(13, "src/main/resources/images/tiles/wall_south_laser.png"), - WALLWEST(14, "src/main/resources/images/tiles/wall_west.png"), - WALLWESTLASER(15, "src/main/resources/images/tiles/wall_west_laser.png"), - WALLEAST(16, "src/main/resources/images/tiles/wall_east.png"), - WALLEASTLASER(17, "src/main/resources/images/tiles/wall_east_laser.png"), - WALLNORTH(18, "src/main/resources/images/tiles/wall_north.png"), - WALLNORTHLASER(19, "src/main/resources/images/tiles/wall_north_laser.png"), - NORTHONE(20, "src/main/resources/images/tiles/north_one.png"), - ARROW(21,"src/main/resources/images/robots/arrow.png"); + BLANK("src/main/resources/images/tiles/blank.png"), + CHARGER("src/main/resources/images/tiles/charger.png"), + CHECKPOINT1("src/main/resources/images/tiles/check_point1.png"), + REBOOTPOINT("src/main/resources/images/tiles/reboot_point.png"), + SOUTHTWO("src/main/resources/images/tiles/south_two.png"), + WESTTWO("src/main/resources/images/tiles/west_two.png"), + ANTENNA("src/main/resources/images/tiles/priority_antenna.png"), + EASTONE("src/main/resources/images/tiles/east_one.png"), + EASTTWO("src/main/resources/images/tiles/east_two.png"), + STARTPOINT("src/main/resources/images/tiles/start_point.png"), + NORTHTWO("src/main/resources/images/tiles/north_two.png"), + WALLSOUTH("src/main/resources/images/tiles/wall_south.png"), + WALLSOUTHLASER("src/main/resources/images/tiles/wall_south_laser.png"), + WALLWEST("src/main/resources/images/tiles/wall_west.png"), + WALLWESTLASER("src/main/resources/images/tiles/wall_west_laser.png"), + WALLEAST("src/main/resources/images/tiles/wall_east.png"), + WALLEASTLASER("src/main/resources/images/tiles/wall_east_laser.png"), + WALLNORTH("src/main/resources/images/tiles/wall_north.png"), + WALLNORTHLASER("src/main/resources/images/tiles/wall_north_laser.png"), + NORTHONE("src/main/resources/images/tiles/north_one.png"), + ARROW("src/main/resources/images/robots/arrow.png"); private final BufferedImage image; - private final int identity; - - private TileImageEnum(int identity, String fileName) { - // first assign to tempImage to meet teh final modifier of image + private TileImageEnum(String fileName) { BufferedImage tempImage; try { tempImage = ImageIO.read(new File(fileName)); @@ -41,7 +38,6 @@ private TileImageEnum(int identity, String fileName) { tempImage = null; } this.image = tempImage; - this.identity = identity; } public BufferedImage getImage() { diff --git a/src/main/java/gui/view/widgets/game/BoardPanel.java b/src/main/java/gui/view/widgets/game/BoardPanel.java index ea7bd32..5b8bb28 100644 --- a/src/main/java/gui/view/widgets/game/BoardPanel.java +++ b/src/main/java/gui/view/widgets/game/BoardPanel.java @@ -1,7 +1,6 @@ package gui.view.widgets.game; import java.awt.*; -import java.util.ArrayList; import javax.swing.*; @@ -46,7 +45,7 @@ private void loadBoard() { } for (Player player : game.getParticipants()) { Robot r = player.getRobot(); - board[r.getPosition().getXcoord()][r.getPosition().getYcoord()].setRobot(r.getOrientation(), player.getUserColor()); + board[r.getPosition().getRow()][r.getPosition().getCol()].setRobot(r.getOrientation(), player.getUserColor()); } } diff --git a/src/main/java/gui/view/widgets/game/GamePanel.java b/src/main/java/gui/view/widgets/game/GamePanel.java index 2eaea37..3f6971e 100644 --- a/src/main/java/gui/view/widgets/game/GamePanel.java +++ b/src/main/java/gui/view/widgets/game/GamePanel.java @@ -1,6 +1,8 @@ package gui.view.widgets.game; import content.Application; +import content.MapName; +import content.RobotName; import lombok.SneakyThrows; import model.Game; import model.Room; @@ -18,7 +20,6 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.IOException; import java.util.ArrayList; /* @@ -109,9 +110,9 @@ public void actionPerformed(ActionEvent e) { } Player currentPlayer = game.getParticipants().get(currenPlayerIndex); Card currentRegisterCard = currentPlayer.getRegisterArea().getCard(registerIndex); - boardPanel.getBoard()[currentPlayer.getRobot().getPosition().getXcoord()][currentPlayer.getRobot().getPosition().getYcoord()].unsetRobot(); + boardPanel.getBoard()[currentPlayer.getRobot().getPosition().getRow()][currentPlayer.getRobot().getPosition().getCol()].unsetRobot(); currentRegisterCard.action(currentPlayer.getRobot()); - boardPanel.getBoard()[currentPlayer.getRobot().getPosition().getXcoord()][currentPlayer.getRobot().getPosition().getYcoord()].setRobot(currentPlayer.getRobot().getOrientation(), currentPlayer.getUserColor()); + boardPanel.getBoard()[currentPlayer.getRobot().getPosition().getRow()][currentPlayer.getRobot().getPosition().getCol()].setRobot(currentPlayer.getRobot().getOrientation(), currentPlayer.getUserColor()); boardPanel.repaint(); // boardPanel.revalidate(); @@ -196,7 +197,7 @@ private Card getCardObject(String className) { @SneakyThrows public static void main(String[] args) { - Player user = new Player("SpongeBob", new Robot("SQUASH_BOT")); + Player user = new Player("SpongeBob", new Robot(RobotName.SQUASH_BOT)); UserController userController = new UserController(); userController.deleteUser("SpongeBob"); userController.createUser("SpongeBob"); @@ -208,7 +209,7 @@ public static void main(String[] args) { System.out.println(roomController.createRoom(user.getName(), "STARTER")); int roomNumber = roomController.createRoom(user.getName(), "STARTER").getInt("room_number"); userController.joinRoom("PatrickStar", roomNumber); - GameMap gameMap = new GameMap("STARTER"); + GameMap gameMap = new GameMap(MapName.STARTER); Room room = new Room(roomNumber); Game game = new Game(); game.init(user, room, gameMap, roomController.roomInfo(roomNumber)); diff --git a/src/main/java/gui/view/widgets/game/MatPanel.java b/src/main/java/gui/view/widgets/game/MatPanel.java index 7159671..918f891 100644 --- a/src/main/java/gui/view/widgets/game/MatPanel.java +++ b/src/main/java/gui/view/widgets/game/MatPanel.java @@ -1,6 +1,8 @@ package gui.view.widgets.game; import content.Application; +import content.MapName; +import content.RobotName; import lombok.Data; import model.Game; import model.Room; @@ -122,7 +124,7 @@ public Class getColumnClass(int column) { public static void main(String[] args) throws IOException { - Player user = new Player("SpongeBob", new Robot("SQUASH_BOT")); + Player user = new Player("SpongeBob", new Robot(RobotName.valueOf("SQUASH_BOT"))); UserController userController = new UserController(); userController.createUser("SpongeBob"); userController.createUser("PatrickStar"); @@ -133,7 +135,7 @@ public static void main(String[] args) throws IOException { System.out.println(roomController.createRoom(user.getName(), "STARTER")); int roomNumber = roomController.createRoom(user.getName(), "STARTER").getInt("room_number"); userController.joinRoom("PatrickStar", roomNumber); - GameMap gameMap = new GameMap("STARTER"); + GameMap gameMap = new GameMap(MapName.valueOf("STARTER")); Room room = new Room(roomNumber); Game game = new Game(); game.init(user, room, gameMap, roomController.roomInfo(roomNumber)); diff --git a/src/main/java/gui/view/widgets/login/LoginPanel.java b/src/main/java/gui/view/widgets/login/LoginPanel.java index 7788619..7c5241a 100644 --- a/src/main/java/gui/view/widgets/login/LoginPanel.java +++ b/src/main/java/gui/view/widgets/login/LoginPanel.java @@ -22,7 +22,7 @@ public class LoginPanel extends JPanel { public LoginPanel(JFrame frame) { this.userName = new JTextField(); - JLabel lbluserName = new JLabel("Player name"); + JLabel lblUserName = new JLabel("Player name"); JLabel lblRobot = new JLabel("Robot"); this.lblChosenRobot = new JLabel(); Icon iconSquashBot = new ImageIcon(new ImageIcon(PATH_TO_ROBOT_ICONS + "SQUASH_BOT.jpg").getImage().getScaledInstance(105, 142, Image.SCALE_DEFAULT)); @@ -43,7 +43,7 @@ public LoginPanel(JFrame frame) { // Displaying the login interface this.setLayout(null); RobotListener robotListener = new RobotListener(); - lbluserName.setBounds(100, 8, 70, 20); + lblUserName.setBounds(100, 8, 70, 20); this.userName.setBounds(100, 36, 193, 28); lblRobot.setBounds(100, 75, 70, 20); this.lblChosenRobot.setBounds(200, 75, 100, 20); @@ -62,7 +62,7 @@ public LoginPanel(JFrame frame) { btOk.setBounds(100, 270, 80, 30); btCancel.setBounds(300, 270, 80, 30); this.add(this.userName); - this.add(lbluserName); + this.add(lblUserName); this.add(lblRobot); this.add(this.lblChosenRobot); this.add(this.btSquashBot); diff --git a/src/main/java/gui/view/widgets/room/RoomPanel.java b/src/main/java/gui/view/widgets/room/RoomPanel.java index 2d0f01e..6210284 100644 --- a/src/main/java/gui/view/widgets/room/RoomPanel.java +++ b/src/main/java/gui/view/widgets/room/RoomPanel.java @@ -53,7 +53,7 @@ public RoomPanel(String userName, JFrame frame) { btJoinRoom.addActionListener(e -> { /* fetching the room number when the "Join room" button is pressed - inserting the player info into the room through API + inserting the qplayer info into the room through API */ UserController userController = new UserController(); String roomNumberStr = this.roomNumber.getText(); diff --git a/src/main/java/gui/view/widgets/waiting/WaitingPanel.java b/src/main/java/gui/view/widgets/waiting/WaitingPanel.java index 5865ed5..cea3c76 100644 --- a/src/main/java/gui/view/widgets/waiting/WaitingPanel.java +++ b/src/main/java/gui/view/widgets/waiting/WaitingPanel.java @@ -1,5 +1,7 @@ package gui.view.widgets.waiting; +import content.MapName; +import content.RobotName; import gui.view.widgets.game.GamePanel; import gui.view.widgets.room.RoomPanel; import lombok.SneakyThrows; @@ -199,7 +201,7 @@ private void startGamePanel(int roomNumber, JSONObject roomInfoResponse, String String mapName = roomInfoResponse.getString(RoomController.RESPONSE_MAP_NAME); // int roomNumber = roomInfoResponse.getInt(RoomController.RESPONSE_ROOM_NUMBER); String robotName = (String) new RobotController().getRobotInfo(userName).get(RobotController.RESPONSE_ROBOT_NAME); - game.init(new Player(userName, new Robot(robotName)), new Room(roomNumber), new GameMap(mapName), roomInfoResponse); + game.init(new Player(userName, new Robot(RobotName.valueOf(robotName))), new Room(roomNumber), new GameMap(MapName.valueOf(mapName)), roomInfoResponse); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { diff --git a/src/main/java/model/Game.java b/src/main/java/model/Game.java index 08a90e6..2dfcb93 100644 --- a/src/main/java/model/Game.java +++ b/src/main/java/model/Game.java @@ -1,8 +1,8 @@ package model; +import content.RobotName; import gui.view.widgets.game.GamePanel; import lombok.Data; -import lombok.SneakyThrows; import model.game.board.map.Collision; import model.game.board.map.GameMap; import model.game.board.map.Position; @@ -91,7 +91,7 @@ public ArrayList orderOfPlayers() { TreeMap> robotDistanceTree = new TreeMap<>(); for (Player p : this.participants) { Integer dist = p.getRobot().distanceToAntenna(); - Integer ycoord = p.getRobot().getPosition().getYcoord(); + Integer ycoord = p.getRobot().getPosition().getCol(); if (robotDistanceTree.containsKey(dist)) { robotDistanceTree.get(dist).put(ycoord, p); } else { @@ -131,7 +131,7 @@ public void initParticipants(JSONObject roomInfoReponse) { List userList = users.toList(); for (Object userName : userList) { JSONObject robotInfo = new RobotController().getRobotInfo(userName.toString()); - Robot robot = new Robot((String) robotInfo.get(RobotController.RESPONSE_ROBOT_NAME)); + Robot robot = new Robot(RobotName.valueOf((String) robotInfo.get(RobotController.RESPONSE_ROBOT_NAME))); try { // if JSONObject["x"] not found, it means there is no initial position int x = (int) robotInfo.get(RobotController.RESPONSE_ROBOT_XCOORD); @@ -153,7 +153,7 @@ public void generateRandomPositionsForAllParticipants() { for (Player player : this.participants) { StartPoint assignedStartPoint = startPoints.remove(new Random().nextInt(startPoints.size())); player.getRobot().setPosition(assignedStartPoint.getPosition()); - new RobotController().updatePosition(player.getName(), player.getRobot().getPosition().getXcoord(), player.getRobot().getPosition().getYcoord()); + new RobotController().updatePosition(player.getName(), player.getRobot().getPosition().getRow(), player.getRobot().getPosition().getCol()); } } diff --git a/src/main/java/model/game/Player.java b/src/main/java/model/game/Player.java index 20e44d2..44af8e8 100644 --- a/src/main/java/model/game/Player.java +++ b/src/main/java/model/game/Player.java @@ -67,13 +67,13 @@ public boolean takeToken(CheckPoint checkPoint) { * @return an arraylist of 9 cards that is 9 cards in the player's hand. */ public void drawCards() { - ArrayList cardsInHand = new ArrayList<>(); + this.cardsInHand = new ArrayList<>(); if (this.programmingDeck.getCards().size() < ProgrammingDeck.NUMBER_OF_CARDS_DRAWN_IN_EACH_ROUND) { this.cardsInHand = new ArrayList<>(this.programmingDeck.getCards()); //this.discardPile.getDiscards().addAll(cardsInHand); this.programmingDeck.getCards().removeAll(this.programmingDeck.getCards()); this.replenishProgrammingDeck(); - ArrayList complements = new ArrayList<>(this.programmingDeck.getCards().subList(0, ProgrammingDeck.NUMBER_OF_CARDS_DRAWN_IN_EACH_ROUND - cardsInHand.size())); + ArrayList complements = new ArrayList<>(this.programmingDeck.getCards().subList(0, ProgrammingDeck.NUMBER_OF_CARDS_DRAWN_IN_EACH_ROUND - this.cardsInHand.size())); this.programmingDeck.getCards().subList(0, ProgrammingDeck.NUMBER_OF_CARDS_DRAWN_IN_EACH_ROUND - this.cardsInHand.size()).clear(); this.cardsInHand.addAll(complements); //this.discardPile.getDiscards().addAll(cardsInHand); diff --git a/src/main/java/model/game/board/map/GameMap.java b/src/main/java/model/game/board/map/GameMap.java index 1548600..4bbf2e7 100644 --- a/src/main/java/model/game/board/map/GameMap.java +++ b/src/main/java/model/game/board/map/GameMap.java @@ -1,6 +1,6 @@ package model.game.board.map; -import io.cucumber.java.bs.A; +import content.MapName; import lombok.Data; import lombok.RequiredArgsConstructor; import model.game.board.map.element.CheckPoint; @@ -29,8 +29,8 @@ public class GameMap { * * @param mapName the name of this map. Such as 'STARTER', 'BEGINNER' represent the map stored in 'STARTER.txt' and 'BEGINNER.txt'. */ - public GameMap(String mapName) throws IOException { - this.mapName = mapName; + public GameMap(MapName mapName) throws IOException { + this.mapName = mapName.getMapName(); this.content = MapReader.txtToTileMatrix(mapName); this.startPoints = new ArrayList<>(); this.rebootPoints = new ArrayList<>(); @@ -63,6 +63,6 @@ public RebootPoint getARandomRebootPoint() { } public Tile getTileWithPosition(Position position) { - return content[position.getXcoord()][position.getYcoord()]; + return content[position.getRow()][position.getCol()]; } } diff --git a/src/main/java/model/game/board/map/Position.java b/src/main/java/model/game/board/map/Position.java index 1d6735d..da426f7 100644 --- a/src/main/java/model/game/board/map/Position.java +++ b/src/main/java/model/game/board/map/Position.java @@ -2,38 +2,38 @@ public class Position { - private int xcoord; - private int ycoord; + private int row; + private int col; public Position() { } - public Position(int xcoord, int ycoord) { - this.xcoord = xcoord; - this.ycoord = ycoord; + public Position(int row, int col) { + this.row = row; + this.col = col; } - public int getXcoord() { - return xcoord; + public int getRow() { + return row; } - public void setXcoord(int xcoord) { - this.xcoord = xcoord; + public void setRow(int row) { + this.row = row; } - public int getYcoord() { - return ycoord; + public int getCol() { + return col; } - public void setYcoord(int ycoord) { - this.ycoord = ycoord; + public void setCol(int col) { + this.col = col; } @Override public boolean equals(Object object) { if (object instanceof Position) { - return ((Position) object).getXcoord() == this.xcoord && ((Position) object).getYcoord() == this.ycoord; + return ((Position) object).getRow() == this.row && ((Position) object).getCol() == this.col; } else { return false; } @@ -41,7 +41,7 @@ public boolean equals(Object object) { @Override public String toString() { - return "[x:" + this.getXcoord() + "y:" + this.getYcoord() + "]"; + return "[row:" + this.getRow() + "column:" + this.getCol() + "]"; } } diff --git a/src/main/java/model/game/board/map/element/Robot.java b/src/main/java/model/game/board/map/element/Robot.java index bc34bf9..548445e 100644 --- a/src/main/java/model/game/board/map/element/Robot.java +++ b/src/main/java/model/game/board/map/element/Robot.java @@ -1,5 +1,6 @@ package model.game.board.map.element; +import content.RobotName; import lombok.Data; import model.game.board.map.Orientation; import model.game.board.map.Position; @@ -15,17 +16,17 @@ public class Robot { private int lives; private Position position; - public Robot(String name) { - this.name = name; + public Robot(RobotName robotName) { + this.name = robotName.getName(); this.onBoard = false; this.position = new Position(); this.orientation = Orientation.E; } - public Robot(String name, int x, int y) { + public Robot(String name, int row, int col) { this.name = name; this.onBoard = false; - this.position = new Position(x, y); + this.position = new Position(row, col); this.orientation = Orientation.E; } @@ -34,13 +35,13 @@ public void setPosition(Position position) { this.position = position; } - public void setPosition(int x, int y) { - this.position.setXcoord(x); - this.position.setYcoord(y); + public void setPosition(int row, int col) { + this.position.setRow(row); + this.position.setCol(col); } public int distanceToAntenna() { - return Math.abs(this.position.getXcoord() - Antenna.getInstance().getPosition().getXcoord()) + Math.abs(this.position.getYcoord() - Antenna.getInstance().getPosition().getYcoord()); + return Math.abs(this.position.getRow() - Antenna.getInstance().getPosition().getRow()) + Math.abs(this.position.getCol() - Antenna.getInstance().getPosition().getCol()); } @Override @@ -67,10 +68,10 @@ private boolean checkAlive() { return true; // here nothing happens } - public boolean imInsideBoard(int maxX, int maxY) { - if (this.getPosition().getXcoord() > maxX || this.getPosition().getYcoord() > maxY) { + public boolean imInsideBoard(int maxRow, int maxCol) { + if (this.getPosition().getRow() > maxRow || this.getPosition().getCol() > maxCol) { return false; - } else return this.getPosition().getXcoord() >= 0 && this.getPosition().getYcoord() >= 0; + } else return this.getPosition().getRow() >= 0 && this.getPosition().getCol() >= 0; } } diff --git a/src/main/java/model/game/card/programming/behaviour/Movement.java b/src/main/java/model/game/card/programming/behaviour/Movement.java index 7974302..68d5ca9 100644 --- a/src/main/java/model/game/card/programming/behaviour/Movement.java +++ b/src/main/java/model/game/card/programming/behaviour/Movement.java @@ -11,21 +11,20 @@ public static Position calculateNewPosition(Orientation robotOrientation, Positi //this switch takes the robot Orientation given by the Card class, and returns the newPosition based on this orientation switch (robotOrientation) { case N: - newPos = new Position(currentPos.getXcoord()- amount, currentPos.getYcoord() ); + newPos = new Position(currentPos.getRow() - amount, currentPos.getCol()); break; case S: - newPos = new Position(currentPos.getXcoord()+ amount, currentPos.getYcoord() ); + newPos = new Position(currentPos.getRow() + amount, currentPos.getCol()); break; case E: - newPos = new Position(currentPos.getXcoord() , currentPos.getYcoord()+ amount); + newPos = new Position(currentPos.getRow(), currentPos.getCol() + amount); break; case W: - newPos = new Position(currentPos.getXcoord() , currentPos.getYcoord()- amount); + newPos = new Position(currentPos.getRow(), currentPos.getCol() - amount); break; default: throw new IllegalStateException("Unexpected value: " + robotOrientation + " is different from N/S/E/W"); } - return newPos; } } diff --git a/src/main/java/model/game/card/special/programming/card/SpecialProgrammable.java b/src/main/java/model/game/card/special/programming/card/SpecialProgrammable.java deleted file mode 100644 index 0b09a9c..0000000 --- a/src/main/java/model/game/card/special/programming/card/SpecialProgrammable.java +++ /dev/null @@ -1,7 +0,0 @@ -package model.game.card.special.programming.card; - -import model.game.card.programming.Programmable; - -public interface SpecialProgrammable extends Programmable { - -} diff --git a/src/main/java/utils/MapReader.java b/src/main/java/utils/MapReader.java index da9d9a0..5ab1c8f 100644 --- a/src/main/java/utils/MapReader.java +++ b/src/main/java/utils/MapReader.java @@ -1,5 +1,6 @@ package utils; +import content.MapName; import gui.view.map.TileImageEnum; import model.game.board.map.element.Antenna; import model.game.board.map.element.CheckPoint; @@ -7,6 +8,7 @@ import java.io.*; import java.util.ArrayList; +import java.util.Map; /** * @@ -18,15 +20,15 @@ public class MapReader { */ private static final String PATH_TO_MAP_FILE = "src/main/resources/maps/"; private static final String FULLY_QUALIFIED_NAME_OF_ELEMENT = "model.game.board.map.element."; - private static final String FULLY_QUALIFIED_NAME_OF_CHECKPOINT ="model.game.board.map.element.CheckPoint"; + private static final String FULLY_QUALIFIED_NAME_OF_CHECKPOINT = "model.game.board.map.element.CheckPoint"; + /** * @ readLineToStringArray: Read the content of .txt file to a string array. * One line of this txt file -> one string element of this arraylist */ - private static ArrayList readLineToStringArray(String mapName) throws IOException { - + private static ArrayList readLineToStringArray(MapName mapName) throws IOException { ArrayList strList = new ArrayList<>(); - FileReader reader = new FileReader(new File(PATH_TO_MAP_FILE + mapName + ".txt")); + FileReader reader = new FileReader(new File(PATH_TO_MAP_FILE + mapName.getMapName() + ".txt")); BufferedReader readerBuf = new BufferedReader(reader); String lineStr; while ((lineStr = readerBuf.readLine()) != null) { @@ -47,7 +49,7 @@ private static Tile createTileInstance(String str, int x, int y) { if (str.startsWith("CheckPoint")) { Class clz = Class.forName(FULLY_QUALIFIED_NAME_OF_CHECKPOINT); CheckPoint checkPoint = (CheckPoint) clz.getDeclaredConstructor(Integer.class, Integer.class).newInstance(x, y); - checkPoint.setCheckPointNum(Integer.parseInt("" + str.charAt(str.length()-1))); + checkPoint.setCheckPointNum(Integer.parseInt("" + str.charAt(str.length() - 1))); return checkPoint; } else { Class clz = Class.forName(FULLY_QUALIFIED_NAME_OF_ELEMENT + str); @@ -64,8 +66,7 @@ private static Tile createTileInstance(String str, int x, int y) { * @ txtToTileMatrix: input a Map name (like "map1", "map2") and then read the txt file of this map * then parse the txt file to a 2D array of Tile */ - public static Tile[][] txtToTileMatrix(String mapName) throws IOException { - + public static Tile[][] txtToTileMatrix(MapName mapName) throws IOException { Tile[][] result = null; ArrayList strList = MapReader.readLineToStringArray(mapName); @@ -86,51 +87,4 @@ public static Tile[][] txtToTileMatrix(String mapName) throws IOException { } return result; } - - - /** - * @ txtToTileTypeMatrix: input a string of map name (like "map1", “map2") and then read the txt file of this map - * then parse the txt file to a 2D array of TileType - * TIP: THIS IS ONLY USED IN UI!!!!!!!!!!!!!! - */ -// public static TileImageEnum[][] txtToTileTypeMatrix(String mapName) throws IOException { -// TileImageEnum[][] result = null; -// ArrayList strList; -// strList = MapReader.readLineToStringArray(mapName); -// -// // The number of columns -// String s = strList.get(0); -// int columnNum = s.split(",").length; -// -// result = new TileImageEnum[strList.size()][columnNum]; -// -// // Put data into a 2D array -// int count = 0; -// for (String str : strList) { -// String[] strs = str.split(","); -// for (int i = 0; i < columnNum; i++) { -// result[count][i] = TileImageEnum.valueOf(strs[i].toUpperCase()); -// } -// count++; -// } -// -// return result; -// } - - // This is the test of the function -// public static void main(String[] args) { -// Tile[][] map = null; -// try { -// map = MapReader.txtToTileMatrix("map1"); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// assert map != null; -// for (Tile[] tiles : map) { -// for (Tile tile : tiles) { -// System.out.print(tile.getClass().getSimpleName() + ","); -// } -// System.out.println(); -// } -// } } diff --git a/src/main/resources/maps/map2.txt b/src/main/resources/maps/ADVANCED.txt similarity index 100% rename from src/main/resources/maps/map2.txt rename to src/main/resources/maps/ADVANCED.txt diff --git a/src/main/resources/maps/INTERMEDIATE.txt b/src/main/resources/maps/INTERMEDIATE.txt index 55a99cf..a5875ea 100644 --- a/src/main/resources/maps/INTERMEDIATE.txt +++ b/src/main/resources/maps/INTERMEDIATE.txt @@ -1,7 +1,7 @@ Blank,Blank,EastOne,Blank,SouthTwo,SouthTwo,Blank,Blank,Blank,Blank,Blank,Blank,Charger Blank,StartPoint,Blank,Blank,SouthTwo,WestTwo,WestTwo,WestTwo,WestTwo,WestTwo,WestTwo,WestTwo,WestTwo Blank,WallNorth,Blank,Blank,SouthTwo,Charger,Blank,Blank,Blank,Blank,Blank,NorthTwo,WestTwo -StartPoint,Blank,Blank,Blank,SouthTwo,Blank,WallNorthLaser,RebootPoint,WallWestLaser,WallEastLaser,Blank,NorthTwo,CheckPoint1 +StartPoint,Blank,Blank,Blank,SouthTwo,Blank,WallNorthLaser,RebootPoint,WallWestLaser,WallEastLaser,CheckPoint3,CheckPoint2,CheckPoint1 Antenna,StartPoint,WallEast,Blank,SouthTwo,Blank,WallSouthLaser,Blank,Charger,Blank,Blank,NorthTwo,Blank Blank,StartPoint,WallEast,Blank,SouthTwo,Blank,Blank,Charger,Blank,WallNorthLaser,Blank,NorthTwo,Blank StartPoint,Blank,Blank,Blank,SouthTwo,Blank,WallWestLaser,WallEastLaser,Blank,WallSouthLaser,Blank,NorthTwo,Blank diff --git a/src/test/java/client/test/InitializationStepsDefinition.java b/src/test/java/client/test/InitializationStepsDefinition.java index 0c5e0b9..b001680 100644 --- a/src/test/java/client/test/InitializationStepsDefinition.java +++ b/src/test/java/client/test/InitializationStepsDefinition.java @@ -1,6 +1,8 @@ package client.test; import content.Application; +import content.MapName; +import content.RobotName; import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.en.And; @@ -122,7 +124,7 @@ public void aPlayerHasAName(String arg0) { @When("the player chooses a robot {string}") public void thePlayerChoosesARobot(String string) { - this.robot = new Robot(string); + this.robot = new Robot(RobotName.valueOf(string)); this.user.setRobot(this.robot); this.response = new UserController().chooseRobot(this.user.getName(), string); } @@ -145,7 +147,7 @@ public void thereIsANewRecordInTheCollectionUserWithUsernameAndRobotname(String public void thePlayerCreatesANewRoomAndChoosesAMap(String mapName) { this.room = new Room(); this.game.setRoom(this.room); - this.game.setGameMap(new GameMap(mapName)); + this.game.setGameMap(new GameMap(MapName.valueOf(mapName))); assertEquals(mapName, this.game.getGameMap().getMapName()); this.response = new RoomController().createRoom(this.user.getName(), mapName); this.game.getRoom().setRoomNumber((Integer) response.get(RoomController.RESPONSE_ROOM_NUMBER)); @@ -187,21 +189,21 @@ public void the_player_is_in_this_room() { @SneakyThrows @Given("a room owner {string} created a new room with map {string} and chose robot {string}") public void aRoomOwnerCreatedANewRoomWithMapAndChoseRobot(String ownerName, String mapName, String robotName) { - this.roomOwner = new Player(ownerName, new Robot(robotName)); + this.roomOwner = new Player(ownerName, new Robot(RobotName.valueOf(robotName))); assertEquals(200, new UserController().createUser(ownerName).get(ServerConnection.RESPONSE_STATUS)); assertEquals(200, new UserController().chooseRobot(ownerName, robotName).get(ServerConnection.RESPONSE_STATUS)); JSONObject createRoomResponse = new RoomController().createRoom(ownerName, mapName); assertEquals(200, createRoomResponse.get(ServerConnection.RESPONSE_STATUS)); this.room = new Room(); - this.game.setGameMap(new GameMap(mapName)); + this.game.setGameMap(new GameMap(MapName.valueOf(mapName))); this.room.setRoomNumber((Integer) createRoomResponse.get(RoomController.RESPONSE_ROOM_NUMBER)); } @And("player1 {string} player2 {string} and player3 {string} chose robot1 {string} robot2 {string} and robot3 {string} respectively") public void playerPlayerAndPlayerChoseRobotRobotAndRobotRespectively(String player1Name, String player2Name, String player3Name, String robot1Name, String robot2Name, String robot3Name) { - this.player1 = new Player(player1Name, new Robot(robot1Name)); - this.player2 = new Player(player2Name, new Robot(robot2Name)); - this.player3 = new Player(player3Name, new Robot(robot3Name)); + this.player1 = new Player(player1Name, new Robot(RobotName.valueOf(robot1Name))); + this.player2 = new Player(player2Name, new Robot(RobotName.valueOf(robot2Name))); + this.player3 = new Player(player3Name, new Robot(RobotName.valueOf(robot3Name))); assertEquals(200, new UserController().createUser(this.player1.getName()).get(ServerConnection.RESPONSE_STATUS)); assertEquals(200, new UserController().chooseRobot(this.player1.getName(), this.player1.getRobot().getName()).get(ServerConnection.RESPONSE_STATUS)); assertEquals(200, new UserController().createUser(this.player2.getName()).get(ServerConnection.RESPONSE_STATUS)); diff --git a/src/test/java/client/test/InteractionStepsDefinition.java b/src/test/java/client/test/InteractionStepsDefinition.java index f33bd9f..315735b 100644 --- a/src/test/java/client/test/InteractionStepsDefinition.java +++ b/src/test/java/client/test/InteractionStepsDefinition.java @@ -1,5 +1,6 @@ package client.test; +import content.RobotName; import io.cucumber.java.Before; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; @@ -25,7 +26,7 @@ public class InteractionStepsDefinition { @Before public void init() { - this.p1 = new Player("group10", new Robot("HULK X90")); + this.p1 = new Player("group10", new Robot(RobotName.valueOf("HULK_X90"))); } @Given("a player had {string} cards in his programming deck") diff --git a/src/test/java/client/test/MapElementStepsDefinition.java b/src/test/java/client/test/MapElementStepsDefinition.java index a71fd4d..bef4122 100644 --- a/src/test/java/client/test/MapElementStepsDefinition.java +++ b/src/test/java/client/test/MapElementStepsDefinition.java @@ -37,7 +37,7 @@ public void initMapElement() { //-------------------------------------------------------------------------------------------- @Given("a player chose a robot {string}") public void aPlayerChoseARobot(String arg0) { - this.robot = new Robot(arg0); + this.robot = new Robot(RobotName.valueOf(arg0)); } @When("the robot gets an initial position randomly") @@ -87,7 +87,7 @@ public void theRobotIsNowFacing(String arg0) { //-------------------------------------------------------------------------------------------- @Given("A robot {string} had {string} lives") public void aRobotHasLives(String arg0, String arg1) { - this.robot = new Robot(arg0); + this.robot = new Robot(RobotName.valueOf(arg0)); this.robot.setLives(Integer.parseInt(arg1)); } @@ -104,9 +104,9 @@ public void the_robot_has_lives(String lives) { } - @Given("A robot {string} has initial position {string} {string} with orientation {string}") - public void aRobotHasInitialPositionWithOrientation(String robotName, String xPos, String yPos, String orientation) { - this.robot = new Robot(robotName); + @Given("a robot {string} had initial position {string} {string} with orientation {string}") + public void aRobotHadInitialPositionWithOrientation(String robotName, String xPos, String yPos, String orientation) { + this.robot = new Robot(RobotName.valueOf(robotName)); this.robot.setPosition(Integer.parseInt(xPos), Integer.parseInt(yPos)); Orientation o = Orientation.N; switch (orientation) { @@ -126,7 +126,7 @@ public void aRobotHasInitialPositionWithOrientation(String robotName, String xPo this.robot.setOrientation(o); } - @Given("A card with movement {string}") + @Given("a card with movement {string}") public void aCardWithMovement(String movement) { switch (movement) { case "1": @@ -145,24 +145,24 @@ public void aCardWithMovement(String movement) { } - @When("The card is played") + @When("the card is played") public void theCardIsPlayed() { card.action(robot); } @Then("the robot position is {string} {string}") public void theRobotPositionIs(String expectedXPos, String expectedYPos) { - assertEquals(Integer.parseInt(expectedXPos), robot.getPosition().getXcoord()); - assertEquals(Integer.parseInt(expectedYPos), robot.getPosition().getYcoord()); + assertEquals(Integer.parseInt(expectedXPos), robot.getPosition().getRow()); + assertEquals(Integer.parseInt(expectedYPos), robot.getPosition().getCol()); } @Given("A robot {string} has position {string} {string}") public void aRobotHasPosition(String robotName, String xPos, String yPos) { - this.robot = new Robot(robotName); + this.robot = new Robot(RobotName.valueOf(robotName)); this.robot.setPosition(Integer.parseInt(xPos), Integer.parseInt(yPos)); } - @Then("The expected output is {string} in a board that have a maximum size of {string} {string}") + @Then("the expected output is {string} in a board that have a maximum size of {string} {string}") public void theExpectedOutputIsInABoardThatHaveAMaximumSizeOf(String output, String maxX, String maxY) { boolean aux = this.robot.imInsideBoard(Integer.parseInt(maxX), Integer.parseInt(maxY)); assertEquals(Boolean.valueOf(output), aux); @@ -172,9 +172,9 @@ public void theExpectedOutputIsInABoardThatHaveAMaximumSizeOf(String output, Str //-------------------------------------------------------------------------------------------- @Given("an antenna and three robots {string}, {string} and {string} chosen by {string}, {string} and {string} respectively") public void anAntennaAndThreeRobotsAndChosenByAndRespectively(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5) { - this.p1 = new Player(arg3, new Robot(arg0)); - this.p2 = new Player(arg4, new Robot(arg1)); - this.p3 = new Player(arg5, new Robot(arg2)); + this.p1 = new Player(arg3, new Robot(RobotName.valueOf(arg0))); + this.p2 = new Player(arg4, new Robot(RobotName.valueOf(arg1))); + this.p3 = new Player(arg5, new Robot(RobotName.valueOf(arg2))); this.game.addParticipant(p1); this.game.addParticipant(p2); this.game.addParticipant(p3); @@ -199,13 +199,13 @@ public void thePriorityOfThesePlayersIs(String arg0, String arg1, String arg2) { @Given("there is a game with map {string}") public void thereIsAGameWithMap(String arg0) throws IOException { this.game = new Game(); - this.game.setGameMap(new GameMap(arg0)); + this.game.setGameMap(new GameMap(MapName.valueOf(arg0))); } @And("there are players {string} and {string} in this game") public void thereArePlayersAndInThisGame(String arg0, String arg1) { - Player player1 = new Player(arg0, new Robot("SQUASH BOT")); - Player player2 = new Player(arg1, new Robot("ZOOM BOT")); + Player player1 = new Player(arg0, new Robot(RobotName.SQUASH_BOT)); + Player player2 = new Player(arg1, new Robot(RobotName.ZOOM_BOT)); this.game.addParticipant(player1); this.game.addParticipant(player2); } diff --git a/src/test/resources/featureFiles/MapElement.feature b/src/test/resources/featureFiles/MapElement.feature index bc34f12..4ac7ca2 100644 --- a/src/test/resources/featureFiles/MapElement.feature +++ b/src/test/resources/featureFiles/MapElement.feature @@ -3,24 +3,24 @@ Feature: ##################### ANTENNA SCENARIOS ####################################### Scenario Outline: The antenna determines the priority Given an antenna and three robots "", "" and "" chosen by "", "" and "" respectively - When robotI, robotII and robotIII are placed in ("",""), ("",""),("","") respectively + When robotI, robotII and robotIII are placed in ("",""), ("",""),("","") respectively Then the priority of these players is "","","" Examples: # (0,4) antenna - | player1 | player2 | player3 | robot-name1 | robot-name2 | robot-name3 | x1 | y1 | x2 | y2 | x3 | y3 | result_name1 | result_name2 | result_name3 | - | Raul | Simona | Durdija | SQUASH BOT | ZOOM BOT | HAMMER BOT | 5 | 3 | 7 | 5 | 12 | 4 | Raul | Simona | Durdija | - | Wenjie | Anna | Ion | SQUASH BOT | ZOOM BOT | HAMMER BOT | 5 | 3 | 5 | 5 | 12 | 4 | Anna | Wenjie | Ion | + | player1 | player2 | player3 | robot-name1 | robot-name2 | robot-name3 | row1 | col1 | row2 | col2 | row3 | col3 | result_name1 | result_name2 | result_name3 | + | Raul | Simona | Durdija | SQUASH_BOT | ZOOM_BOT | HAMMER_BOT | 5 | 3 | 7 | 5 | 12 | 4 | Raul | Simona | Durdija | + | Wenjie | Anna | Ion | SQUASH_BOT | ZOOM_BOT | HAMMER_BOT | 5 | 3 | 5 | 5 | 12 | 4 | Anna | Wenjie | Ion | ##################### ROBOT SCENARIOS ####################################### Scenario Outline: A robot gets an initial position Given a player chose a robot "" When the robot gets an initial position randomly - Then robot is now at a position "" and "" + Then robot is now at a position "" and "" Examples: - | position_x | position_y | robot_name | - | 0 | 0 | SQUASH BOT | - | 0 | 0 | ZOOM BOT | - | 0 | 0 | HAMMER BOT | - | 0 | 0 | TRUNDLE BOT | + | row | col | robot_name | + | 0 | 0 | SQUASH_BOT | + | 0 | 0 | ZOOM_BOT | + | 0 | 0 | HAMMER_BOT | + | 0 | 0 | TRUNDLE_BOT | Scenario Outline: As a robot, I want to change my direction according to the input angle value @@ -44,16 +44,16 @@ Feature: Scenario Outline: A robot moves according to the programming card - Given A robot "" has initial position "" "" with orientation "" - And A card with movement "" - When The card is played - Then the robot position is "" "" + Given a robot "" had initial position "" "" with orientation "" + And a card with movement "" + When the card is played + Then the robot position is "" "" Examples: - | robot_name | initial_posX | initial_posY | orientation | movement | expected_positionX | expected_positionY | - | Anna | 1 | 1 | N | 1 | 1 | 0 | - | Anna | 1 | 1 | S | 1 | 1 | 2 | - | Anna | 1 | 1 | E | 2 | 3 | 1 | - | Anna | 1 | 1 | W | -1 | 2 | 1 | + | robot_name | initial_row | initial_col | orientation | movement | expected_row | expected_col | + | SQUASH_BOT | 1 | 1 | N | 1 | 0 | 1 | + | ZOOM_BOT | 1 | 1 | S | 1 | 2 | 1 | + | HAMMER_BOT | 1 | 1 | E | 2 | 1 | 3 | + | TRUNDLE_BOT | 1 | 1 | W | -1 | 1 | 2 | Scenario Outline: Damage affects robot lives @@ -62,33 +62,33 @@ Feature: Then The robot now has "" lives Examples: | robot_name | initial_lives | damage_lives | final_lives | - | Raul | 1 | 1 | 5 | - | Raul | 2 | 1 | 1 | - | Jianan | 1 | 2 | 5 | + | SQUASH_BOT | 1 | 1 | 5 | + | HULK_X90 | 2 | 1 | 1 | + | SPIN_BOT | 1 | 2 | 5 | # TODO: # When Scenario Outline: As a robot I want to check if I am inside of the board - Given A robot "" has position "" "" - Then The expected output is "" in a board that have a maximum size of "" "" + Given A robot "" has position "" "" + Then the expected output is "" in a board that have a maximum size of "" "" Examples: - | robot_name | posX | posY | max_posX | max_posY | expected_output | - | Raul | 1 | -2 | 3 | 3 | false | - | Raul | 7 | 1 | 4 | 4 | false | - | Raul | 1 | 1 | 1 | 1 | true | - | Raul | 4 | -1 | 3 | 3 | false | + | robot_name | row | col | max_row | max_col | expected_output | + | ZOOM_BOT | 1 | -2 | 3 | 3 | false | + | HULK_X90 | 7 | 1 | 4 | 4 | false | + | SPIN_BOT | 1 | 1 | 1 | 1 | true | + | TRUNDLE_BOT | 4 | -1 | 3 | 3 | false | # This test only have the purpose of mix some of the scenarios, no step definition needed (: Scenario Outline: As a robot I want to move with some cards and check if I'm inside of the board - Given A robot "" has initial position "" "" with orientation "" - And A card with movement "" - When The card is played - Then The expected output is "" in a board that have a maximum size of "" "" + Given a robot "" had initial position "" "" with orientation "" + And a card with movement "" + When the card is played + Then the expected output is "" in a board that have a maximum size of "" "" Examples: - | robot_name | initial_posX | initial_posY | orientation | movement | expected_output | max_posX | max_posY | - | Anna | 3 | 3 | N | 2 | true | 5 | 5 | - | Anna | 2 | 0 | S | -1 | false | 5 | 5 | - | Anna | 4 | 2 | E | 3 | false | 6 | 5 | + | robot_name | initial_row | initial_col | orientation | movement | expected_output | max_row | max_col | + | HAMMER_BOT | 3 | 3 | N | 2 | true | 5 | 5 | + | SPIN_BOT | 2 | 0 | E | -1 | false | 5 | 5 | + | HULK_X90 | 4 | 2 | S | 3 | false | 6 | 5 | # A robot can take a checkpoint token only when it stops on a checkpoint and it has taken checkpoint tokens from all previous checkpoints numerically Scenario Outline: A robot can take a checkpoint token only when it stops on a checkpoint and it has taken checkpoint tokens from all previous checkpoints numerically @@ -100,10 +100,10 @@ Feature: When this player's turn ends and the robot stops on this checkpoint Then this player gets a checkpoint token from this checkpoint successfully and now has checkpoint tokens Examples: - | map_name | playerA | playerB | point_number | - | map2 | Jianan | Wenjie | 2 | - | map2 | Anna | Raul | 3 | - | map2 | Ion | Durdija | 1 | + | map_name | playerA | playerB | point_number | + | ADVANCED | Jianan | Wenjie | 2 | + | INTERMEDIATE | Anna | Raul | 3 | + | INTERMEDIATE | Ion | Durdija | 1 | Scenario Outline: The game status is checked every time a checkpoint token is taken by a player @@ -116,22 +116,22 @@ Feature: When this player gets a checkpoint token from this checkpoint successfully and now has checkpoint tokens Then this game checks game status and now the game status is "" Examples: - | map_name | playerA | playerB | point_number | is_finished | - | map2 | Jianan | Wenjie | 2 | unfinished | - | map2 | Anna | Raul | 3 | finished | - | map2 | Ion | Durdija | 1 | unfinished | + | map_name | playerA | playerB | point_number | is_finished | + | ADVANCED | Jianan | Wenjie | 2 | unfinished | + | ADVANCED | Anna | Raul | 3 | finished | + | INTERMEDIATE | Ion | Durdija | 1 | unfinished | Scenario Outline: Player lands on an Obstacle Given A robot "" had "" lives - And The robot has initial position "" "" with orientation "" - And a position "" "" on the map indicating the obstacle of type "" + And The robot has initial position "" "" with orientation "" + And a position "" "" on the map indicating the obstacle of type "" When robot lands on an obstacle status is true Then The robot now has "" lives Examples: - | robot_name | initial_lives | initial_posX | initial_posY | orientation | obstacle_posX | obstacle_posY | type_of_obstacle | final_lives | - | Simona | 2 | 2 | 2 | N | 2 | 2 | wnl | 1 | - | Simona | 2 | 3 | 2 | N | 2 | 2 | wsl | 2 | - | Simona | 1 | 2 | 2 | N | 2 | 2 | wel | 5 | - | Simona | 3 | 2 | 2 | S | 2 | 2 | wwl | 2 | - | Simona | 4 | 2 | 2 | S | 2 | 2 | sg | 2 | + | robot_name | initial_lives | initial_row | initial_col | orientation | obstacle_row | obstacle_col | type_of_obstacle | final_lives | + | ZOOM_BOT | 2 | 2 | 2 | N | 2 | 2 | wnl | 1 | + | HULK_X90 | 2 | 3 | 2 | N | 2 | 2 | wsl | 2 | + | SPIN_BOT | 1 | 2 | 2 | N | 2 | 2 | wel | 5 | + | SQUASH_BOT | 3 | 2 | 2 | S | 2 | 2 | wwl | 2 | + | HAMMER_BOT | 4 | 2 | 2 | S | 2 | 2 | sg | 2 |