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
Jose Baez
poker
Commits
3944d7cf
Commit
3944d7cf
authored
Apr 26, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se crea metodo full
parent
cb4a47c9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
4 deletions
+43
-4
Juego.java
+39
-0
Main.java
+4
-4
out/production/poker/Juego.class
+0
-0
out/production/poker/Main.class
+0
-0
No files found.
Juego.java
View file @
3944d7cf
...
@@ -19,6 +19,10 @@ public class Juego {
...
@@ -19,6 +19,10 @@ public class Juego {
siguiente
=
false
;
siguiente
=
false
;
System
.
out
.
println
(
"POKER"
);
System
.
out
.
println
(
"POKER"
);
}
}
if
(
siguiente
&&
full
(
cartas
))
{
siguiente
=
false
;
System
.
out
.
println
(
"FULL"
);
}
if
(
siguiente
&&
escalera
(
cartas
))
{
if
(
siguiente
&&
escalera
(
cartas
))
{
siguiente
=
false
;
siguiente
=
false
;
System
.
out
.
println
(
"ESCALERA"
);
System
.
out
.
println
(
"ESCALERA"
);
...
@@ -31,6 +35,41 @@ public class Juego {
...
@@ -31,6 +35,41 @@ public class Juego {
System
.
out
.
println
(
"NADA"
);
System
.
out
.
println
(
"NADA"
);
}
}
}
}
//Dos cartas iguales (mismo valor) junto con tres cartas iguales (mismo valor).
public
boolean
full
(
List
<
Carta
>
cartas
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
}
Collections
.
sort
(
valores
);
int
counter
=
0
;
int
numero
=
0
;
int
cantidadNumero
=
0
;
int
cantidadNumero2
=
0
;
for
(
int
i
=
1
;
i
<
14
;
i
++){
for
(
int
j
=
0
;
j
<
valores
.
size
();
j
++)
{
int
s
=
valores
.
get
(
j
);
if
(
s
==
i
){
counter
++;
}
}
if
(
counter
>
cantidadNumero
){
numero
=
i
;
cantidadNumero
=
counter
;
cantidadNumero2
=
counter
;
}
if
((
counter
-
1
)
>
cantidadNumero
){
cantidadNumero2
=
counter
;
}
counter
=
0
;
}
if
(
cantidadNumero
==
3
&&
(
cantidadNumero2
-
1
)==
2
){
return
true
;
}
else
{
return
false
;
}
}
//Cuatro cartas iguales (mismo valor).
//Cuatro cartas iguales (mismo valor).
public
boolean
poker
(
List
<
Carta
>
cartas
)
{
public
boolean
poker
(
List
<
Carta
>
cartas
)
{
...
...
Main.java
View file @
3944d7cf
...
@@ -10,10 +10,10 @@ public class Main {
...
@@ -10,10 +10,10 @@ public class Main {
List
<
Carta
>
cartas
=
new
ArrayList
<>();
List
<
Carta
>
cartas
=
new
ArrayList
<>();
cartas
=
Arrays
.
asList
(
cartas
=
Arrays
.
asList
(
new
Carta
(
"2H"
),
new
Carta
(
"2H"
),
new
Carta
(
"
6
H"
),
new
Carta
(
"
2
H"
),
new
Carta
(
"
6
H"
),
new
Carta
(
"
7
H"
),
new
Carta
(
"
6
S"
),
new
Carta
(
"
7
S"
),
new
Carta
(
"
6
H"
)
new
Carta
(
"
7
H"
)
);
);
cartas
.
forEach
(
System
.
out
::
print
);
cartas
.
forEach
(
System
.
out
::
print
);
...
...
out/production/poker/Juego.class
View file @
3944d7cf
No preview for this file type
out/production/poker/Main.class
View file @
3944d7cf
No preview for this file type
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