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
63e14615
Commit
63e14615
authored
Apr 27, 2022
by
Emanuel Lugo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
COMPARACION DE MANOS AGREGADA
parent
d37aa914
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
29 deletions
+58
-29
poker2/PokerGame2.java
+58
-29
No files found.
poker2/PokerGame2.java
View file @
63e14615
...
...
@@ -19,49 +19,78 @@ public class PokerGame2 {
}
public
static
void
main
(
String
args
[])
{
int
puntosMano1
;
int
puntosMano1
,
puntosMano2
;
ArrayList
[]
manos
;
PokerGame2
pokerGanador
=
new
PokerGame2
();
pokerGame
pokerJugadas
=
new
pokerGame
();
ArrayList
<
Carta
>
mano
=
new
ArrayList
<
Carta
>();
// List<Carta[]> jugadas = new ArrayList<Carta[]>();
// Carta[] m1 = new Carta[5];
// m1[0] = new Carta("AH");
// m1[1] = new Carta("AD");
// m1[2] = new Carta("TH");
// m1[3] = new Carta("TC");
// m1[4] = new Carta("6S");
// Carta[] m2 = new Carta[5];
// m2[0] = new Carta("AH");
// m2[1] = new Carta("KD");
// m2[2] = new Carta("QH");
// m2[3] = new Carta("3C");
// m2[4] = new Carta("3S");
ArrayList
<
Carta
>
mano1
=
new
ArrayList
<
Carta
>();
ArrayList
<
Carta
>
mano2
=
new
ArrayList
<
Carta
>();
// agregamos la mano 1
Carta
carta1
=
new
Carta
(
"2S "
);
Carta
carta2
=
new
Carta
(
"2C "
);
Carta
carta3
=
new
Carta
(
"4H "
);
Carta
carta4
=
new
Carta
(
"5D "
);
Carta
carta5
=
new
Carta
(
"5C "
);
mano1
.
add
(
carta1
);
mano1
.
add
(
carta2
);
mano1
.
add
(
carta3
);
mano1
.
add
(
carta4
);
mano1
.
add
(
carta5
);
// agregamos la mano2
Carta
carta6
=
new
Carta
(
"AS "
);
Carta
carta7
=
new
Carta
(
"AC "
);
Carta
carta8
=
new
Carta
(
"AH "
);
Carta
carta9
=
new
Carta
(
"4D "
);
Carta
carta10
=
new
Carta
(
"4C "
);
mano2
.
add
(
carta6
);
mano2
.
add
(
carta7
);
mano2
.
add
(
carta8
);
mano2
.
add
(
carta9
);
mano2
.
add
(
carta10
);
// IMPRIMIMOS LAS MANOS
System
.
out
.
println
(
"MANO1:"
);
for
(
Carta
c1
:
mano1
)
{
System
.
out
.
print
(
c1
.
valorPalo
()
+
" "
);
}
mano
.
add
(
carta1
);
mano
.
add
(
carta2
);
mano
.
add
(
carta3
);
mano
.
add
(
carta4
);
mano
.
add
(
carta5
);
// jugadas.add(m1);
// jugadas.add(m2);
System
.
out
.
println
(
" "
);
// pokerJugadas.jugadas(mano);
System
.
out
.
println
(
"MANO2:"
);
for
(
Carta
c2
:
mano2
)
{
System
.
out
.
print
(
c2
.
valorPalo
()
+
" "
);
}
puntosMano1
=
pokerGanador
.
valorJugada
(
pokerJugadas
.
jugadas
(
mano1
));
puntosMano2
=
pokerGanador
.
valorJugada
(
pokerJugadas
.
jugadas
(
mano2
));
System
.
out
.
println
(
" "
);
/*
* System.out.println(" \nPuntos Mano1 = " + puntosMano1);
* System.out.println(pokerJugadas.jugadas(mano1));
*
* System.out.println(" \nPuntos Mano2 = " + puntosMano2);
* System.out.println(pokerJugadas.jugadas(mano2));
*/
// FUNCION QUE COMPARA LAS JUGADAS
if
(
puntosMano1
>
puntosMano2
)
{
System
.
out
.
println
(
"LA MANO GANADORA ES:"
);
for
(
Carta
carta
:
mano
)
{
System
.
out
.
print
(
carta
.
valorPalo
()
+
" "
);
for
(
Carta
c1
:
mano1
)
{
System
.
out
.
print
(
c1
.
valorPalo
()
+
" "
);
}
puntosMano1
=
pokerGanador
.
valorJugada
(
pokerJugadas
.
jugadas
(
mano
));
System
.
out
.
println
(
pokerJugadas
.
jugadas
(
mano1
));
}
else
{
System
.
out
.
println
(
" \nPuntos Mano1 = "
+
puntosMano1
);
System
.
out
.
println
(
pokerJugadas
.
jugadas
(
mano
));
System
.
out
.
println
(
"LA MANO GANADORA ES:"
);
for
(
Carta
c2
:
mano2
)
{
System
.
out
.
print
(
c2
.
valorPalo
()
+
" "
);
}
System
.
out
.
println
(
pokerJugadas
.
jugadas
(
mano2
));
}
}
public
int
valorJugada
(
String
jugada
)
{
...
...
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