Carta.java 1.04 KB
Newer Older
Cesar Giulano Gonzalez Maqueda committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
package roshka.bootcamp.poker;

import java.util.ArrayList;

public class Carta {
    private static final String[] palos = {"S", "C", "H", "D"};
    private static final String[] valores = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
    private String palo;
    private String valor;
    private String name;
    private int numericValue;

    public Carta(String palo, String valor, int numericValue) {
        this.palo = palo;
        this.valor = valor;
        this.numericValue = numericValue;
        this.name = valor+palo;
    }

    public String getPalo() {
        return palo;
    }


    public String getValor() {
        return valor;
    }

    public static ArrayList<Carta> crearMazo(){
        ArrayList<Carta> mazo = new ArrayList<Carta>();
        for(int i=0;i<palos.length;i++){
            for(int j=0;j<valores.length;j++){
                mazo.add(new Carta(palos[i], valores[j], j+2));
            }
        }
        return mazo;
    }

    public int getNumericValue() {
        return numericValue;
    }
}