We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
public class Carta { private String seme; private int valore; public Carta(String seme, int valore) { this.seme = seme; this.valore = valore; } public String toString() { return valore + " di " + seme; } } import java.util.AbstractList; import java.util.ArrayList; import java.util.Random; public class MazzoDiCarte { private static String[] semi = new String[] {"Quadri", "Cuori", "Fiori", "Picche"}; private static Random random = new Random(); private ArrayList<Carta> carte = new ArrayList<Carta>(); //private Carta[] carte = new Carta[52]; private int estrazione = 0; public void Mescola() { if (!carte.isEmpty()) { estrazione = random.nextInt(0, carte.size()); } else { System.out.println("Mazzo finito"); } } public Carta Distribuisci() { estrazione = random.nextInt(0, carte.size()); Carta carta = carte.get(estrazione); carte.remove(estrazione); return carta; } public MazzoDiCarte() { for (String i : semi) { for (int j = 1; j <= 13; j++) { carte.add(new Carta(i, j)); } } } }
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: