public void populateRoomsWithDefendersAndFacilities(BattleSetup s, List<RoomBattle> rooms) throws BadGameStateException {
        int nRooms = Math.max(s.getNumRoomsBasedOnPeople(), s.getNumRoomsBasedOnFacilities());
        int nDefendersAllocated = 0;
        int nFacilitiesAllocated = 0;
        for (int i = 0; i < nRooms; ++i) {
            int nFacilitiesThisRoom = 0;
            int nDefendersThisRoom = 0;
            // new room to addBatchedMessageForLater
            RoomBattle room = new RoomBattle(context);
            // addBatchedMessageForLater defenders
            while ((nDefendersAllocated < s.getNumDefenders()) && (nDefendersThisRoom < s.getDefendersPerRoom())) {
                room.addDefender(s.getDefenseTeam().get(nDefendersAllocated));
                nDefendersAllocated++;
                nDefendersThisRoom++;
            }
            // addBatchedMessageForLater facilities
            while ((nFacilitiesAllocated < s.getDefenseCapableFacilities().size()) && (nFacilitiesThisRoom < s.getFacilitiesPerRoom())) {
                room.addFacility(s.getDefenseCapableFacilities().get(nFacilitiesAllocated));
                nFacilitiesAllocated++;
                nFacilitiesThisRoom++;
            }
            // any other extra cool stuff in rooms

            // paranoid safety check
            if (room.getAttackers().size() > 0 && room.getDefenders().size() > 0) {
                if (room.getAttackers().get(0).getSide().equals(room.getDefenders().get(0).getSide())) {
                    throw new BadGameStateException("Attacker has same side as defender in room 0?!");
                }
            }
            // then addBatchedMessageForLater the room
            rooms.add(room);
        }
    }