Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
poker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Emanuel Lugo
poker
Commits
d37aa914
Commit
d37aa914
authored
Apr 27, 2022
by
Emanuel Lugo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
se agrega puntuacion a las combinaciones
parent
89deb808
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
41 deletions
+74
-41
poker/pokerGame.java
+3
-4
poker2/PokerGame2.java
+71
-37
No files found.
poker/pokerGame.java
View file @
d37aa914
/** */
/** */
package
poker
;
package
poker
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.*
;
...
@@ -72,9 +71,9 @@ public class pokerGame {
...
@@ -72,9 +71,9 @@ public class pokerGame {
if
((
valoresIguales
==
2
&&
mano
.
get
(
1
).
getValorInt
()
!=
mano
.
get
(
2
).
getValorInt
())
if
((
valoresIguales
==
2
&&
mano
.
get
(
1
).
getValorInt
()
!=
mano
.
get
(
2
).
getValorInt
())
||
(
valoresIguales
==
2
&&
mano
.
get
(
2
).
getValorInt
()
!=
mano
.
get
(
4
).
getValorInt
()))
{
||
(
valoresIguales
==
2
&&
mano
.
get
(
2
).
getValorInt
()
!=
mano
.
get
(
4
).
getValorInt
()))
{
return
resultado
=
"DOBLE
DUO
"
;
return
resultado
=
"DOBLE
PAREJA
"
;
}
else
if
(
valoresIguales
==
1
)
}
else
if
(
valoresIguales
==
1
)
return
resultado
=
"
DUO
"
;
return
resultado
=
"
PAREJA
"
;
return
resultado
=
"CARTA ALTA"
;
return
resultado
=
"CARTA ALTA"
;
}
}
...
...
poker2/PokerGame2.java
View file @
d37aa914
package
poker2
;
package
poker2
;
import
poker.*
;
import
poker.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.*
;
public
class
PokerGame2
{
public
class
PokerGame2
{
public
String
ganadores
(
List
<
Carta
[]>
jugadas
)
public
String
ganadores
(
List
<
Carta
[]>
jugadas
)
{
{
System
.
out
.
println
(
"Cantidad de jugadas: "
+
jugadas
.
size
());
System
.
out
.
println
(
"Cantidad de jugadas: "
+
jugadas
.
size
());
for
(
Carta
[]
mano
:
jugadas
)
{
for
(
Carta
[]
mano
:
jugadas
)
{
System
.
out
.
println
(
"JUGADA ======================"
);
System
.
out
.
println
(
"JUGADA ======================"
);
...
@@ -17,55 +18,88 @@ public class PokerGame2 {
...
@@ -17,55 +18,88 @@ public class PokerGame2 {
return
"0"
;
return
"0"
;
}
}
public
static
void
main
(
String
args
[])
{
public
static
void
main
(
String
args
[])
{
PokerGame2
mc
=
new
PokerGame2
();
int
puntosMano1
;
List
<
Carta
[]>
jugadas
=
new
ArrayList
<
Carta
[]>();
PokerGame2
pokerGanador
=
new
PokerGame2
();
Carta
[]
m1
=
new
Carta
[
5
];
pokerGame
pokerJugadas
=
new
pokerGame
();
m1
[
0
]
=
new
Carta
(
"AH"
);
ArrayList
<
Carta
>
mano
=
new
ArrayList
<
Carta
>();
m1
[
1
]
=
new
Carta
(
"AD"
);
// List<Carta[]> jugadas = new ArrayList<Carta[]>();
m1
[
2
]
=
new
Carta
(
"TH"
);
// Carta[] m1 = new Carta[5];
m1
[
3
]
=
new
Carta
(
"TC"
);
// m1[0] = new Carta("AH");
m1
[
4
]
=
new
Carta
(
"6S"
);
// m1[1] = new Carta("AD");
Carta
[]
m2
=
new
Carta
[
5
];
// m1[2] = new Carta("TH");
m2
[
0
]
=
new
Carta
(
"AH"
);
// m1[3] = new Carta("TC");
m2
[
1
]
=
new
Carta
(
"KD"
);
// m1[4] = new Carta("6S");
m2
[
2
]
=
new
Carta
(
"QH"
);
// Carta[] m2 = new Carta[5];
m2
[
3
]
=
new
Carta
(
"3C"
);
// m2[0] = new Carta("AH");
m2
[
4
]
=
new
Carta
(
"3S"
);
// m2[1] = new Carta("KD");
// m2[2] = new Carta("QH");
jugadas
.
add
(
m1
);
// m2[3] = new Carta("3C");
jugadas
.
add
(
m2
);
// m2[4] = new Carta("3S");
String
ganadores
=
mc
.
ganadores
(
jugadas
);
Carta
carta1
=
new
Carta
(
"2S "
);
System
.
out
.
println
(
"Ganadores = "
+
ganadores
);
Carta
carta2
=
new
Carta
(
"2C "
);
Carta
carta3
=
new
Carta
(
"4H "
);
Carta
carta4
=
new
Carta
(
"5D "
);
Carta
carta5
=
new
Carta
(
"5C "
);
mano
.
add
(
carta1
);
mano
.
add
(
carta2
);
mano
.
add
(
carta3
);
mano
.
add
(
carta4
);
mano
.
add
(
carta5
);
// jugadas.add(m1);
// jugadas.add(m2);
// pokerJugadas.jugadas(mano);
for
(
Carta
carta
:
mano
)
{
System
.
out
.
print
(
carta
.
valorPalo
()
+
" "
);
}
}
puntosMano1
=
pokerGanador
.
valorJugada
(
pokerJugadas
.
jugadas
(
mano
));
System
.
out
.
println
(
" \nPuntos Mano1 = "
+
puntosMano1
);
System
.
out
.
println
(
pokerJugadas
.
jugadas
(
mano
));
}
public
int
valorJugada
(
String
jugada
)
{
public
int
valorJugada
(
String
jugada
)
{
String
result
;
int
result
;
switch
(
animal
)
{
switch
(
jugada
)
{
case
"DOG"
:
case
"ESCALERA COLOR"
:
result
=
"domestic animal"
;
result
=
9
;
break
;
case
"POKER"
:
result
=
8
;
break
;
break
;
case
"CAT
"
:
case
"FULL
"
:
result
=
"domestic animal"
;
result
=
7
;
break
;
break
;
case
"TIGER"
:
case
"COLOR"
:
result
=
"wild animal"
;
result
=
6
;
break
;
case
"ESCALERA"
:
result
=
5
;
break
;
case
"TRIO"
:
result
=
4
;
break
;
case
"DOBLE PAREJA"
:
result
=
3
;
break
;
case
"PAREJA"
:
result
=
2
;
break
;
case
"CARTA ALTA"
:
result
=
1
;
break
;
break
;
default
:
default
:
result
=
"unknown animal"
;
result
=
-
1
;
break
;
break
;
}
}
return
result
;
return
result
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment