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
65dd487c
Commit
65dd487c
authored
Apr 26, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se agrega metodo color
parent
be623b33
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
10 deletions
+24
-10
Juego.java
+19
-5
Main.java
+5
-5
out/production/poker/Juego.class
+0
-0
out/production/poker/Main.class
+0
-0
No files found.
Juego.java
View file @
65dd487c
...
...
@@ -16,10 +16,27 @@ public class Juego {
System
.
out
.
println
(
"ESCALERA COLOR"
);
}
if
(
siguiente
&&
escalera
(
cartas
)){
siguiente
=
false
;
System
.
out
.
println
(
"ESCALERA"
);
}
if
(
siguiente
&&
color
(
cartas
)){
siguiente
=
false
;
System
.
out
.
println
(
"COLOR"
);
}
if
(
siguiente
){
System
.
out
.
println
(
"NADA"
);
}
}
public
boolean
color
(
List
<
Carta
>
cartas
)
{
String
valuePalo
=
estraerPalo
(
cartas
);
for
(
int
i
=
0
;
i
<
cartas
.
size
();
i
++)
{
if
(!
valuePalo
.
equals
(
cartas
.
get
(
i
).
palo
))
{
return
false
;
}
}
return
true
;
}
public
boolean
escalera
(
List
<
Carta
>
cartas
)
{
int
contador
=
0
;
List
<
Integer
>
valores
=
new
ArrayList
<>();
...
...
@@ -36,8 +53,6 @@ public class Juego {
if
(
valoresArry
[
i
]
>
1
)
{
if
(
valoresArry
[
i
+
1
]
-
valoresArry
[
i
]
!=
1
)
{
return
false
;
}
else
{
return
true
;
}
}
...
...
@@ -46,7 +61,7 @@ public class Juego {
return
true
;
}
}
return
fals
e
;
return
tru
e
;
}
public
boolean
escaleraColor
(
List
<
Carta
>
cartas
)
{
...
...
@@ -72,8 +87,6 @@ public class Juego {
if
(
valoresArry
[
i
]
>
1
)
{
if
(
valoresArry
[
i
+
1
]
-
valoresArry
[
i
]
!=
1
)
{
return
false
;
}
else
{
return
true
;
}
}
...
...
@@ -82,6 +95,7 @@ public class Juego {
return
true
;
}
}
return
true
;
}
return
false
;
...
...
Main.java
View file @
65dd487c
...
...
@@ -9,11 +9,11 @@ public class Main {
List
<
Carta
>
cartas
=
new
ArrayList
<>();
cartas
=
Arrays
.
asList
(
new
Carta
(
"
7
H"
),
new
Carta
(
"
8
H"
),
new
Carta
(
"
9
H"
),
new
Carta
(
"
J
H"
),
new
Carta
(
"
T
H"
)
new
Carta
(
"
2
H"
),
new
Carta
(
"
3
H"
),
new
Carta
(
"
4
H"
),
new
Carta
(
"
5
H"
),
new
Carta
(
"
6
H"
)
);
cartas
.
forEach
(
System
.
out
::
print
);
...
...
out/production/poker/Juego.class
View file @
65dd487c
No preview for this file type
out/production/poker/Main.class
View file @
65dd487c
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