Cartas.java 1.26 KB
Newer Older
Javier Ferreira 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 43 44 45 46 47 48 49 50 51 52
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package juegopoker;

import java.util.ArrayList;

/**
 *
 * @author user
 */
class Cartas {
    private static final String[] palos = {"S", "C", "H", "D"};//para los valores de los palos
    private static final String[] valores = {"A","2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", };//para los valores de la cartas
    private String p;
    private String v;
    private String n;
    private int numericValue;

    public Cartas(String palo, String valor, int numericValue) {
        this.p = palo;
        this.v = valor;
        this.numericValue = numericValue;
        this.n = valor+palo;
    }

    public String getPalo() {
        return p;
    }


    public String getValor() {
        return v;
    }

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

    public int getNumericValue() {
        return numericValue;
    }
}