package RiskProject;
public class Card{
//set for the Type of Countries
public enum Country{ALASKA, ALBERTA, CENTRAL_AMERICA, EASTERN_UNITED_STATES, GREENLAND, NORTHWEST_TERRITORY,
...
Type: Posts; User: geeksutopia
package RiskProject;
public class Card{
//set for the Type of Countries
public enum Country{ALASKA, ALBERTA, CENTRAL_AMERICA, EASTERN_UNITED_STATES, GREENLAND, NORTHWEST_TERRITORY,
...
Well managed to get it to iterate through the list to get
Just can't seem to figure out how to test if multiples of say ARTILLERY appears in the hand
public boolean canTurnInCards(){
...
With the current coding, an arrayList is being created, all I am trying to say with this is if the same enum(Infantry, Artillery, or Calvalry) appear three times in this ArrayList, then the statement...
There is another class (class Player) which draws the cards and holds them. all it does is (riskCards.draw(Card)). So it holds the cards drawn.
but wait shouldn't it be if there are three of a kind, the statement is true.
import java.util.ArrayList;
public class HandTest{
public enum Arms{INFANTRY, ARTILLERY, CALVALRY};
private final Arms arms;
public HandTest(Arms arms){
this.arms = arms;
The reason for those errors is cause the class Card and the class HandTest are in the same package.
package RiskProject;
import java.util.ArrayList;
public class HandTest{
Card.Arms[] arm = Card.Arms.values();
6 errors found:
File: C:\Users\Carlos Satres\Documents\SystemandDesign\RiskProject\Hand.java [line: 32]
Error: Arms cannot be resolved to a variable
File: C:\Users\Carlos...
package RiskProject;
import java.util.ArrayList;
public class Hand{
private final ArrayList<Card> deck;
public int MAXCARDS = 4;
Card.Arms[] arm = Card.Arms.values();
Tried it, and nothing. Got an Arms cannot be resolved to a variable
The name of the enum is Arms, which I instantiated with
Card.Arms[] arm = Card.Arms.values();
And tried putting it into practice in the boolean using
found out the answer to the return statement which is "return deck.get(index1);" which compiles correctly.
Working on the canTurnInCards statement which I am using
Card.Arms[]arm =...
It's supposed to return an instance of the Card class, sort of what is in your hand now, The three cards that get removed are gone completely.
Just implemented that and it compiles. Now the return statement is giving me problems.
public Card removeCardsFromHand(int index1, int index2, int index3){
deck.remove(index1);
...
The error is posted in the Hand class, I am stuck on the the remove cards from hand method. Just can't seem to figure out what to do here
package RiskProject;
public class Card{
//set for the Type of Countries
public enum Country{ALASKA, ALBERTA, CENTRAL_AMERICA, EASTERN_UNITED_STATES, GREENLAND, NORTHWEST_TERRITORY,
...