diff --git a/Carta.java b/Carta.java index 4c0e786..8cb1d2d 100644 --- a/Carta.java +++ b/Carta.java @@ -19,6 +19,12 @@ public class Carta { { return this.valor + this.palo; } + + + + + + } diff --git a/SortbyPalo.java b/SortbyPalo.java new file mode 100644 index 0000000..892e8eb --- /dev/null +++ b/SortbyPalo.java @@ -0,0 +1,11 @@ +import java.util.Comparator; + +class SortbyPalo implements Comparator +{ + // Used for sorting in ascending order of + // Ordenar por Palo + public int compare(Carta a, Carta b) + { + return a.palo.compareTo(b.palo) ; + } +} \ No newline at end of file diff --git a/SortbyValor.java b/SortbyValor.java new file mode 100644 index 0000000..34f30b8 --- /dev/null +++ b/SortbyValor.java @@ -0,0 +1,11 @@ +import java.util.Comparator; + +class SortbyValor implements Comparator +{ + // Used for sorting in ascending order of + // Ordenar por Palo + public int compare(Carta a, Carta b) + { + return a.valor.compareTo(b.valor) ; + } +} \ No newline at end of file diff --git a/pokerGame.java b/pokerGame.java index e5b20f6..65bc8cb 100644 --- a/pokerGame.java +++ b/pokerGame.java @@ -1,5 +1,10 @@ /** */ +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Scanner; +import java.util.*; public class pokerGame { @@ -18,28 +23,42 @@ public class pokerGame { return null; } - - - - - - - public static void main(String[] args) { pokerGame poker = new pokerGame(); int i; - Carta mano[] = new Carta[5]; - mano [0] = new Carta("AS"); - mano [1] = new Carta("2S"); - mano [2]= new Carta("3S"); - mano [3]= new Carta("4S"); - mano [4]= new Carta("5S"); + Carta carta1, carta2, carta3, carta4, carta5 ; + ArrayList mano = new ArrayList(); + carta1 = new Carta("AS"); + carta2 = new Carta("2S"); + carta3 = new Carta("3S"); + carta4 = new Carta("4S"); + carta5 = new Carta("5S"); + mano.add(carta5) ; + mano.add(carta4) ; + mano.add(carta3) ; + mano.add(carta2) ; + mano.add(carta1) ; + //System.out.println(mano); + + for (i=0; i