Fix NullPointerException in App.java
This commit is contained in:
parent
9cfa56be8d
commit
b08139ebca
@ -38,10 +38,10 @@ public class App extends Application {
|
|||||||
public static void startGame() throws IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
public static void startGame() throws IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
||||||
InstantiationException, IllegalAccessException {
|
InstantiationException, IllegalAccessException {
|
||||||
List<Player> players = parsePlayers();
|
List<Player> players = parsePlayers();
|
||||||
|
game = new Game(new Grid(12, 12, players), players);
|
||||||
for (Player player : game.getPlayers()) {
|
for (Player player : game.getPlayers()) {
|
||||||
playerList.put(player, new ClientPlayer(player, new Terminal(game, player)));
|
playerList.put(player, new ClientPlayer(player, new Terminal(game, player)));
|
||||||
}
|
}
|
||||||
game = new Game(new Grid(12, 12, players), players);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateView() {
|
public static void updateView() {
|
||||||
|
@ -28,11 +28,7 @@ public class Game {
|
|||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void play() {
|
||||||
*
|
|
||||||
* @return game winner
|
|
||||||
*/
|
|
||||||
public Player play() {
|
|
||||||
while(!isOver()) {
|
while(!isOver()) {
|
||||||
ModelListener awakeEvent = new AwakeGame(this);
|
ModelListener awakeEvent = new AwakeGame(this);
|
||||||
generateAndGetPlayerActions(currentPlayer);
|
generateAndGetPlayerActions(currentPlayer);
|
||||||
@ -41,7 +37,6 @@ public class Game {
|
|||||||
selectedAction.doAction();
|
selectedAction.doAction();
|
||||||
nextCurrentPlayer();
|
nextCurrentPlayer();
|
||||||
}
|
}
|
||||||
return getWinner();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForInterfaceEvent() {
|
private void waitForInterfaceEvent() {
|
||||||
|
Loading…
Reference in New Issue
Block a user