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
c4afadba
Commit
c4afadba
authored
Apr 27, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se crea metodo par doble
parent
3a62474d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
+28
-3
Juego.java
+25
-0
Main.java
+3
-3
out/production/poker/Juego.class
+0
-0
out/production/poker/Main.class
+0
-0
No files found.
Juego.java
View file @
c4afadba
...
...
@@ -34,10 +34,35 @@ public class Juego {
siguiente
=
false
;
System
.
out
.
println
(
"TRIO"
);
}
if
(
siguiente
&&
parDoble
(
cartas
))
{
siguiente
=
false
;
System
.
out
.
println
(
"PAR DOBLE"
);
}
if
(
siguiente
)
{
System
.
out
.
println
(
"NADA"
);
}
}
public
boolean
parDoble
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPalo
(
cartas
)<
3
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
}
Collections
.
sort
(
valores
);
int
[]
numerosArray
=
pasarAArray
(
valores
);
int
con
=
0
;
for
(
int
i
=
0
;
i
<
numerosArray
.
length
-
1
;
i
++)
{
if
(
numerosArray
[
i
]
==
numerosArray
[
i
+
1
])
{
con
++;
if
(
con
==
2
)
{
return
true
;
}
}
}
}
return
false
;
}
public
boolean
trio
(
List
<
Carta
>
cartas
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
...
...
Main.java
View file @
c4afadba
...
...
@@ -9,11 +9,11 @@ public class Main {
List
<
Carta
>
cartas
=
new
ArrayList
<>();
cartas
=
Arrays
.
asList
(
new
Carta
(
"AH"
),
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"QH"
),
new
Carta
(
"TC"
),
new
Carta
(
"TS"
),
new
Carta
(
"
9
C"
)
new
Carta
(
"
A
C"
)
);
cartas
.
forEach
(
System
.
out
::
print
);
...
...
out/production/poker/Juego.class
View file @
c4afadba
No preview for this file type
out/production/poker/Main.class
View file @
c4afadba
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