Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
generalCompartido
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
Gonzalo Jara
generalCompartido
Commits
d6484dd9
Commit
d6484dd9
authored
6 years ago
by
gjara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actua 1
parents
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
0 deletions
+144
-0
PokerJV/Carta.java
+21
-0
PokerJV/GetJugada.java
+68
-0
PokerJV/PokerE005.java
+55
-0
No files found.
PokerJV/Carta.java
0 → 100644
View file @
d6484dd9
package
PokerJV
;
import
java.util.*
;
/**
*
* @author krosha
*/
public
class
Carta
{
Carta
(
String
completo
)
{
this
.
valor
=
String
.
valueOf
(
completo
.
charAt
(
0
));
this
.
palo
=
String
.
valueOf
(
completo
.
charAt
(
1
));
}
String
valorPalo
()
{
return
this
.
valor
+
this
.
palo
;
}
String
valor
;
String
palo
;
}
This diff is collapsed.
Click to expand it.
PokerJV/GetJugada.java
0 → 100644
View file @
d6484dd9
package
PokerJV
;
import
java.util.*
;
/**
*
* @author arshko
*/
public
class
GetJugada
{
public
String
getJugada
(
Carta
[]
carta
){
// A cada jugada le añado un valor, que luego usaré para comparar entre sí las manos.
int
ereal
=
0
;
int
ecolor
=
0
;
int
pker
=
0
;
int
fooll
=
0
;
int
colour
=
0
;
int
estair
=
0
;
int
tri
=
0
;
int
dpar
=
0
;
int
parr
=
0
;
int
calta
=
0
;
// Estos serían métodos "bandera" que usaría, donde compararía las cartas de las manos y definir qué jugada tendría la mano.
if
(
this
.
escaleraReal
()
==
1
){
//System.out.println("ESCALERA REAL");
ereal
=
10
;
}
if
(
this
.
escaleraColor
()
==
1
){
//System.out.println("ESCALERA COLOR");
ecolor
=
9
;
}
if
(
this
.
poker
()
==
1
){
//System.out.println("POKER");
pker
=
8
;
}
if
(
this
.
full
()
==
1
){
//System.out.println("FULL");
fooll
=
7
;
}
if
(
this
.
color
()
==
1
){
//System.out.println("COLOR");
colour
=
6
;
}
if
(
this
.
escalera
()
==
1
){
//System.out.println("ESCALERA");
estair
=
5
;
}
if
(
this
.
trio
()
==
1
){
//System.out.println("TRIO");
tri
=
4
;
}
if
(
this
.
doblePar
()
==
1
){
//System.out.println("DOBLE PAR");
dpar
=
3
;
}
if
(
this
.
par
()
==
1
){
//System.out.println("PAR");
parr
=
2
;
}
//CARTA ALTA requeriría comparar las dos manos entre sí y analizar cuál de las cartas sería la mayor.
if
(
this
.
cartaAlta
()
==
1
){
//System.out.println("CARTA ALTA");
calta
=
1
;
}
// fijaría un "else" acá para el empate. <<<<<
/* No planeo convertir ninguna carta independiente a un valor numérico, ya que en la clase/objeto Carta[]
ya se especifíca independientemente cada carta (valor && palo).
Verificaría simplemente por cada valor de la carta y luego por sus manos,
ya que sólo para los casos de póker, escalera color y real, compararía los palos
(D, H, S, C) que son cuatro.
*/
}
This diff is collapsed.
Click to expand it.
PokerJV/PokerE005.java
0 → 100644
View file @
d6484dd9
package
PokerJV
;
import
java.util.*
;
/**
*
* @author shka-Ro
*/
public
class
PokerE005
{
public
String
ganadores
(
List
<
Carta
[]>
jugadas
)
//OJO: NO SE TOCA <---
{
System
.
out
.
println
(
"Cantidad de jugadas: "
+
jugadas
.
size
());
for
(
Carta
[]
mano
:
jugadas
)
{
System
.
out
.
println
(
"JUGADA ======================"
);
for
(
Carta
c
:
mano
)
{
System
.
out
.
println
(
c
.
valorPalo
());
}
}
return
"0"
;
}
public
static
void
main
(
String
[]
args
)
{
int
x
=
10
;
int
y
=
25
;
int
z
=
x
+
y
;
PokerE005
mc
=
new
PokerE005
();
GetJugada
PokerE005
=
new
GetJugada
();
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"
);
jugadas
.
add
(
m1
);
jugadas
.
add
(
m2
);
String
ganadores
=
mc
.
ganadores
(
jugadas
);
//System.out.println("Sum of x+y = " + z);
//System.out.println("Ganadores = " + ganadores);
//System.out.println(m2[3].palo);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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