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
8183c0aa
Commit
8183c0aa
authored
Apr 27, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correccion metodo full
parent
fe215e30
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
1 deletions
+32
-1
Juego.java
+31
-0
Main.java
+1
-1
out/production/poker/Juego.class
+0
-0
out/production/poker/Main.class
+0
-0
No files found.
Juego.java
View file @
8183c0aa
...
@@ -71,6 +71,7 @@ public class Juego {
...
@@ -71,6 +71,7 @@ public class Juego {
//Dos cartas iguales (mismo valor) junto con tres cartas iguales (mismo valor).
//Dos cartas iguales (mismo valor) junto con tres cartas iguales (mismo valor).
public
boolean
full
(
List
<
Carta
>
cartas
)
{
public
boolean
full
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPoker
(
cartas
)==
3
){
List
<
Integer
>
valores
=
new
ArrayList
<>();
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
valores
.
add
(
extraer
(
c
.
valor
));
...
@@ -89,11 +90,16 @@ public class Juego {
...
@@ -89,11 +90,16 @@ public class Juego {
}
}
}
}
return
false
;
return
false
;
}
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
)
{
if
(
comprobarPoker
(
cartas
)==
4
){
List
<
Integer
>
valores
=
new
ArrayList
<>();
List
<
Integer
>
valores
=
new
ArrayList
<>();
comprobarPoker
(
cartas
);
for
(
Carta
c
:
cartas
)
{
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
valores
.
add
(
extraer
(
c
.
valor
));
}
}
...
@@ -120,6 +126,31 @@ public class Juego {
...
@@ -120,6 +126,31 @@ public class Juego {
return
false
;
return
false
;
}
}
}
else
{
return
false
;
}
}
private
int
comprobarPoker
(
List
<
Carta
>
cartas
)
{
int
contador
=
0
;
for
(
Carta
c:
cartas
)
{
if
(
c
.
palo
.
equals
(
"K"
))
{
contador
++;
}
if
(
c
.
palo
.
equals
(
"Q"
))
{
contador
++;
}
if
(
c
.
palo
.
equals
(
"K"
))
{
contador
++;
}
if
(
c
.
palo
.
equals
(
"C"
))
{
contador
++;
}
}
return
contador
;
}
}
public
boolean
color
(
List
<
Carta
>
cartas
)
{
public
boolean
color
(
List
<
Carta
>
cartas
)
{
...
...
Main.java
View file @
8183c0aa
...
@@ -12,7 +12,7 @@ public class Main {
...
@@ -12,7 +12,7 @@ public class Main {
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"
5
S"
),
new
Carta
(
"
T
S"
),
new
Carta
(
"9C"
)
new
Carta
(
"9C"
)
);
);
...
...
out/production/poker/Juego.class
View file @
8183c0aa
No preview for this file type
out/production/poker/Main.class
View file @
8183c0aa
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