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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
53 deletions
+86
-53
poker/pokerGame.java
+4
-5
poker2/PokerGame2.java
+82
-48
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 ======================"
);
for
(
Carta
c
:
mano
)
{
for
(
Carta
c
:
mano
)
{
System
.
out
.
println
(
c
.
valorPalo
());
System
.
out
.
println
(
c
.
valorPalo
());
}
}
}
}
return
"0"
;
return
"0"
;
}
}
public
static
void
main
(
String
args
[])
{
int
puntosMano1
;
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");
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 "
);
mano
.
add
(
carta1
);
mano
.
add
(
carta2
);
mano
.
add
(
carta3
);
mano
.
add
(
carta4
);
mano
.
add
(
carta5
);
// jugadas.add(m1);
// jugadas.add(m2);
public
static
void
main
(
String
args
[])
{
// pokerJugadas.jugadas(mano);
PokerGame2
mc
=
new
PokerGame2
();
List
<
Carta
[]>
jugadas
=
new
ArrayList
<
Carta
[]>();
for
(
Carta
carta
:
mano
)
{
Carta
[]
m1
=
new
Carta
[
5
];
System
.
out
.
print
(
carta
.
valorPalo
()
+
" "
);
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"
);
jugadas
.
add
(
m1
);
jugadas
.
add
(
m2
);
String
ganadores
=
mc
.
ganadores
(
jugadas
);
System
.
out
.
println
(
"Ganadores = "
+
ganadores
);
}
}
puntosMano1
=
pokerGanador
.
valorJugada
(
pokerJugadas
.
jugadas
(
mano
));
System
.
out
.
println
(
" \nPuntos Mano1 = "
+
puntosMano1
);
System
.
out
.
println
(
pokerJugadas
.
jugadas
(
mano
));
public
int
valorJugada
(
String
jugada
)
{
}
String
result
;
switch
(
animal
)
{
case
"DOG"
:
result
=
"domestic animal"
;
break
;
case
"CAT"
:
result
=
"domestic animal"
;
break
;
case
"TIGER"
:
result
=
"wild animal"
;
break
;
default
:
result
=
"unknown animal"
;
break
;
}
return
result
;
}
public
int
valorJugada
(
String
jugada
)
{
int
result
;
switch
(
jugada
)
{
case
"ESCALERA COLOR"
:
result
=
9
;
break
;
case
"POKER"
:
result
=
8
;
break
;
case
"FULL"
:
result
=
7
;
break
;
case
"COLOR"
:
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
;
default
:
result
=
-
1
;
break
;
}
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