diff --git a/Dia6/Cartas.java b/Dia6/Cartas.java new file mode 100644 index 0000000..e6456ed --- /dev/null +++ b/Dia6/Cartas.java @@ -0,0 +1,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 crearMazo(){ + ArrayList mazo = new ArrayList<>(); + for(int i=0;i + + JavaScript Challenges + + + +
+
+ Email subscriptions +

+ +

+

+ +

+
+
+ + + diff --git a/Dia6/Ejercicio2Dom.html b/Dia6/Ejercicio2Dom.html new file mode 100644 index 0000000..f790c29 --- /dev/null +++ b/Dia6/Ejercicio2Dom.html @@ -0,0 +1,49 @@ + + + + + Billing + + +
+ Billing Information +

+ +

+

+ Home Address:
+ +
+ +

+
+ + + diff --git a/Dia6/JuegoPoker.java b/Dia6/JuegoPoker.java new file mode 100644 index 0000000..4123f9a --- /dev/null +++ b/Dia6/JuegoPoker.java @@ -0,0 +1,281 @@ +/* + * 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; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Scanner; + +/** + * + * @author user + */ +public class JuegoPoker { + + private Cartas[] mano; + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + System.out.println("POKER PLAY\nSe genera la sogiente mano usuario" + + "\n\tObtuviste las siguietnes combinaciones: "); + JuegoPoker pokerJuego = new JuegoPoker(); + pokerJuego.cartaAlta(); + pokerJuego.doble(); + pokerJuego.dobleDoble(); + pokerJuego.trio(); + pokerJuego.escalera(); + pokerJuego.color(); + pokerJuego.full(); + pokerJuego.poker(); + pokerJuego.escaleraColor(); +} + + + public JuegoPoker(){ + this.mano = this.repartirCincoCartas(); + this.mano = new Cartas[]{ + new Cartas("H", "A", 14), + new Cartas("H", "2", 2), + new Cartas("H", "3", 3), + new Cartas("H", "4", 4), + new Cartas("H", "5", 5)}; + Arrays.sort(mano, Comparator.comparing(Cartas::getNumericValue).reversed()); + if(mano[1].getValor().equals("2") && mano[4].getValor().equals("A")){ + Cartas temp = mano[0]; + mano[0] = mano[4]; + mano[4] = temp; + } + } + + public Cartas[] repartirCincoCartas(){ + ArrayList mazo = Cartas.crearMazo(); + Cartas[] mano = new Cartas[5]; + int[] choices = new int[]{-1, -1, -1, -1, -1}; + boolean repeatedChoice = false; + Scanner in = new Scanner(System.in); + int i=0; + for(i=0;i<5;i++){ + repeatedChoice = false; + int choice = (int)(Math.random()*(52)); + for(int temp: choices){ + if(temp == choice){ + i--; + repeatedChoice = true; + } + } + if(repeatedChoice) continue; + choices[i] = choice; + mano[i] = mazo.get(choice); + } + Arrays.sort(mano, Comparator.comparing(Cartas::getNumericValue).reversed()); + if(mano[1].getValor().equals("2") && mano[4].getValor().equals("A")){ + Cartas temp; + temp = mano[0]; + mano[0] = mano[4]; + mano[4] = temp; + } + return mano; + } + + public void cartaAlta(){ + System.out.print("\nCarta Alta: *"); + for(Cartas carta: mano){ + System.out.print("|"+carta.getValor()+""+carta.getPalo()+"|-"); + } + } + public void dobleDoble(){ + String[] act = new String[5]; + String firstDoble = null; + boolean exist = false; + int dobleCount = 0; + for(int i=0;i 1){ + exist = false; + break; + } + } + if(exist){ + System.out.print("\nEscalera: "); + for(int i=0;i 1 || + !(mano[0].getPalo().equals(mano[i + 1].getPalo()))){ + exist = false; + break; + } + } + if(exist){ + System.out.print("\nEscalera Color: "); + for(int i=0;i