/*
* Cero Project - Copyright 2006 The Cero Developement Team
* (Michael Laguerre, Camille Roux, Matthieu Segret, Mathieu Sivade)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
package cero.games.bataille;
import java.util.ArrayList;
import java.util.Collection;
import cero.games.Card;
import cero.games.InitializationException;
import cero.games.Zone;
import cero.games.base.Card52;
import cero.games.base.ZoneHand;
public class GameInitializer implements cero.games.GameInitializer {
static private String[] zonesType = {"stock","current","won"};
public void initialize(cero.games.Game game) throws InitializationException {
BatailleGame bataille = (BatailleGame) game;
Collection<Card52> card52Set = Card52.getCardSet();
Collection<Card> cardSet = new ArrayList<Card>();
for (Card card : card52Set)
cardSet.add(card);
//dealsource creation
Zone dealzone = new ZoneHand("Deal Source", cardSet);
bataille.getZones().add(dealzone);
//Players and zones creation
for (int i = 0; i < bataille.getPlayers().size(); i++) {
cero.games.Player player = bataille.getPlayers().get(i);
for(String type : zonesType)
player.getZones().add(new ZoneHand(type));
}
}
}