Beispiel #1
0
  public Game(IGameControl control, String... playerNames) {
    players = new Player[playerNames.length];
    for (int i = 0; i < players.length; i++) {
      players[i] = new Player(playerNames[i], i, Color.PINK, control, this);
    }

    this.control = control;

    IBoardBuilder builder = new EasyBoardBuilder();
    Collections.addAll(intersections, builder.getIntersections());
    Collections.addAll(paths, builder.getPaths());
    terrains = builder.getTerrains();

    for (Intersection i : intersections) {
      control.sendGameEvent(i.createSetupEvent());
    }

    for (Path p : paths) {
      control.sendGameEvent(p.createSetupEvent());
    }

    for (Terrain t : terrains) {
      control.sendGameEvent(t.createSetupEvent());
    }

    control.sendGameEvent(new PreparationSettlementPhaseEvent(curPlayerIndex));
  }
Beispiel #2
0
 private Path findPath(int pathId) {
   for (Path p : paths) {
     if (p.getId() == pathId) {
       return p;
     }
   }
   return null;
 }