package RiskProject; public class Card{ //set for the Type of Countries public enum Country{ALASKA, ALBERTA, CENTRAL_AMERICA, EASTERN_UNITED_STATES, GREENLAND, NORTHWEST_TERRITORY, ONTARIO, QUEBEC, WESTERN_UNITED_STATES, ARGENTINA, BRAZIL, VENEZUELA, GREAT_BRITAIN, ICELAND, NORTHERN_EUROPE, SCANDINAVIA, SOUTHER_EUROPE, UKRAINE, WESTERN_EUROPE, CONGO, EAST_AFRICA, EGYPT, MADAGASCAR, NORTH_AFRICA, SOUTH_AFRICA, AFGHANISTAN, CHINA, INDIA, IRKUTSK, JAPAN, KAMCHATKA, MIDDLE_EAST, MONGOLIA, SIAM, SIBERIA, URAL, YAKUTSK, EASTERN_AUSTRALIA, INDONESIA, LOTR, NEW_GUINEA, WESTERN_AUSTRALIA}; //set for the Type of cards public enum Arms{INFANTRY, ARTILLERY, CALVALRY}; private final Country country; private final Arms arms; public Card(Country country, Arms arms){ this.country = country; this.arms = arms; } public @Override String toString(){ return country + "," + arms; } public Arms getArms(){ return arms; } public Country getCountry(){ return country; } }
package RiskProject; import java.util.ArrayList; import java.util.Collections; public class Deck{ public ArrayList<Card> deck; Card.Country[] countries = Card.Country.values(); Card.Arms[] arm = Card.Arms.values(); public Deck(){ deck = new ArrayList<Card>(); } public Card draw(){ return deck.remove(0); } public void add(){ for(Card.Arms arms : arm){ for(Card.Country country : countries){ deck.add(new Card(country, arms)); } } } public void shuffle(){ Collections.shuffle(deck); } }
package RiskProject; import java.util.ArrayList; public class Hand{ private final ArrayList<Card> deck; public Hand(){ deck = new ArrayList<Card>(); } public Card add(Card card){ deck.add(card); return card; } public Card removeCardsFromHand(int index1, int index2, int index3){ deck.remove(index1, index2, index3);//The method remove(int) in the type java.util.ArrayList<RiskProject.Card> is not applicable for the arguments(int, int, int) return deck; } public boolean canTurnInCards(){ } public boolean mustTurnInCards(){ } public ArrayList<Card> getHand(){ } }