mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
la til ekstra info
This commit is contained in:
parent
9d2aeee355
commit
165ea68f3b
@ -31,23 +31,23 @@ public class RoboRallyGame implements IDrawableGame {
|
|||||||
* Instantiates a new robo rally game
|
* Instantiates a new robo rally game
|
||||||
* @param debug Whether to start the game in debugging mode
|
* @param debug Whether to start the game in debugging mode
|
||||||
*/
|
*/
|
||||||
public RoboRallyGame(List<Player> playerList, boolean debug) {
|
public RoboRallyGame(List<Player> playerList, String boardName, boolean host, boolean debug) {
|
||||||
this.host=false;
|
this.host=host;
|
||||||
this.playerList = playerList;
|
this.playerList = playerList;
|
||||||
if (debug) {
|
if (debug) {
|
||||||
initializeDebugMode();
|
initializeDebugMode();
|
||||||
} else {
|
} else {
|
||||||
initializeGame();
|
initializeGame(boardName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new robo rally game
|
* Instantiates a new robo rally game
|
||||||
*/
|
*/
|
||||||
public RoboRallyGame(List<Player> playerList) {
|
public RoboRallyGame(List<Player> playerList, String boardName,boolean host) {
|
||||||
this.host=false;
|
this.host=host;
|
||||||
this.playerList = playerList;
|
this.playerList = playerList;
|
||||||
initializeGame();
|
initializeGame(boardName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -111,20 +111,17 @@ public class RoboRallyGame implements IDrawableGame {
|
|||||||
/**
|
/**
|
||||||
* Initializes the game with a playable board
|
* Initializes the game with a playable board
|
||||||
*/
|
*/
|
||||||
private void initializeGame() {
|
private void initializeGame(String boardName) {
|
||||||
try {
|
try {
|
||||||
List<Robot> robots = new ArrayList<>();
|
List<Robot> robots = new ArrayList<>();
|
||||||
robots.add(new Robot(RobotID.ROBOT_1, new Position(1, 1)));
|
int noe = 1;
|
||||||
robots.add(new Robot(RobotID.ROBOT_2, new Position(1, 2)));
|
for (Player player:playerList) {
|
||||||
robots.add(new Robot(RobotID.ROBOT_3, new Position(1, 3)));
|
Position spawn = new Position(noe,1);
|
||||||
robots.add(new Robot(RobotID.ROBOT_4, new Position(4, 8)));
|
robots.add(new Robot(player.getRobotID(),spawn));
|
||||||
robots.add(new Robot(RobotID.ROBOT_5, new Position(6, 6)));
|
noe++;
|
||||||
robots.add(new Robot(RobotID.ROBOT_6, new Position(7, 7)));
|
}
|
||||||
robots.add(new Robot(RobotID.ROBOT_7, new Position(6, 7)));
|
|
||||||
robots.add(new Robot(RobotID.ROBOT_8, new Position(6, 8)));
|
|
||||||
|
|
||||||
initializePlayers();
|
gameBoard = BoardLoaderUtil.loadBoard("boards/"+boardName, robots);
|
||||||
gameBoard = BoardLoaderUtil.loadBoard("boards/Checkmate.txt", robots);
|
|
||||||
generateTileLists();
|
generateTileLists();
|
||||||
|
|
||||||
if (host) {
|
if (host) {
|
||||||
@ -143,23 +140,6 @@ public class RoboRallyGame implements IDrawableGame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes all players
|
|
||||||
* @throws IOException If interrupted while trying to sleep
|
|
||||||
*/
|
|
||||||
private void initializePlayers() throws IOException {
|
|
||||||
Deck<ProgrammingCard> cards = DeckLoaderUtil.loadProgrammingCardsDeck();
|
|
||||||
for (Player player : playerList) {
|
|
||||||
cards.shuffle();
|
|
||||||
List<ProgrammingCard> testProgram = new ArrayList<>();
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
cards.shuffle();
|
|
||||||
testProgram.add(cards.peekTop());
|
|
||||||
}
|
|
||||||
player.setInProgram(testProgram);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates lists containing board element containers with all tiles of certain types
|
* Generates lists containing board element containers with all tiles of certain types
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user