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
53958d7c
Commit
53958d7c
authored
Apr 27, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Poker app final 1.0
parent
c4afadba
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
11 deletions
+37
-11
Juego.java
+33
-7
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 @
53958d7c
...
...
@@ -38,11 +38,35 @@ public class Juego {
siguiente
=
false
;
System
.
out
.
println
(
"PAR DOBLE"
);
}
if
(
siguiente
&&
par
(
cartas
))
{
siguiente
=
false
;
System
.
out
.
println
(
"PAR"
);
}
if
(
siguiente
)
{
System
.
out
.
println
(
"
NAD
A"
);
System
.
out
.
println
(
"
CARTA ALT
A"
);
}
}
public
boolean
par
(
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
==
1
)
{
return
true
;
}
}
}
}
return
false
;
}
public
boolean
parDoble
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPalo
(
cartas
)<
3
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
...
...
@@ -69,18 +93,20 @@ public class Juego {
valores
.
add
(
extraer
(
c
.
valor
));
}
//Collections.sort(valores);
int
[]
numerosArray
=
pasarAArray
(
valores
);
int
counter
=
0
;
int
numero
=
0
;
int
cantidadNumero
=
0
;
for
(
int
i
=
11
;
i
<
14
;
i
++){
for
(
int
j
=
0
;
j
<
valores
.
size
();
j
++)
{
int
s
=
valores
.
get
(
j
);
if
(
s
==
i
){
for
(
int
j
=
0
;
j
<
numerosArray
.
length
-
1
;
j
++)
{
if
(
numerosArray
[
j
]
==
numerosArray
[
j
+
1
])
{
counter
++;
if
(
counter
==
2
)
{
return
true
;
}
}
}
if
(
counter
>
cantidadNumero
){
numero
=
i
;
cantidadNumero
=
counter
;
}
counter
=
0
;
...
...
@@ -229,7 +255,7 @@ public class Juego {
valores
.
add
(
extraer
(
c
.
valor
));
}
Collections
.
sort
(
valores
);
valores
.
forEach
(
System
.
out
::
println
);
//
valores.forEach(System.out::println);
int
[]
valoresArry
=
pasarAArray
(
valores
);
for
(
int
i
=
0
;
i
<
valoresArry
.
length
-
1
;
i
++)
{
...
...
Main.java
View file @
53958d7c
...
...
@@ -9,11 +9,11 @@ public class Main {
List
<
Carta
>
cartas
=
new
ArrayList
<>();
cartas
=
Arrays
.
asList
(
new
Carta
(
"
A
H"
),
new
Carta
(
"
QH
"
),
new
Carta
(
"
T
H"
),
new
Carta
(
"
TD
"
),
new
Carta
(
"TC"
),
new
Carta
(
"
TS
"
),
new
Carta
(
"A
C
"
)
new
Carta
(
"
4D
"
),
new
Carta
(
"A
D
"
)
);
cartas
.
forEach
(
System
.
out
::
print
);
...
...
out/production/poker/Juego.class
View file @
53958d7c
No preview for this file type
out/production/poker/Main.class
View file @
53958d7c
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