コード例 #1
0
 public Universe(Planets planets, Fleets fleets, int turn, Reservations reservations) {
   this.turn = turn;
   Fleets sentThisTurn = new Fleets();
   for (Reservation reservation : reservations.items) {
     if (turn == reservation.turn) {
       Planet planet = planets.find(reservation.attack.homePlanet.id);
       if (planet.isMine() && planet.numShips >= reservation.attack.ships) {
         sentThisTurn = sentThisTurn.plus(new Fleet(reservation.attack));
         planets = planets.remove(planet);
         planet = planet.removeShips(reservation.attack.ships);
         planets = planets.union(planet);
       }
     }
   }
   this.planets = planets;
   this.fleets = fleets.plus(sentThisTurn);
   this.reservations = reservations;
 }