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
b05dcd6c
Commit
b05dcd6c
authored
Apr 27, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Poker app final 1.1
parent
53958d7c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
64 deletions
+39
-64
.idea/runConfigurations.xml
+0
-11
Juego.java
+35
-38
Main.java
+4
-4
out/production/poker/.idea/runConfigurations.xml
+0
-11
out/production/poker/Juego.class
+0
-0
out/production/poker/Main.class
+0
-0
No files found.
.idea/runConfigurations.xml
deleted
100644 → 0
View file @
53958d7c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
Juego.java
View file @
b05dcd6c
...
...
@@ -48,7 +48,7 @@ public class Juego {
}
public
boolean
par
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPalo
(
cartas
)<
3
)
{
if
(
comprobarPalo
(
cartas
)
<
3
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
...
...
@@ -67,8 +67,9 @@ public class Juego {
}
return
false
;
}
public
boolean
parDoble
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPalo
(
cartas
)<
3
)
{
if
(
comprobarPalo
(
cartas
)
<
3
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
...
...
@@ -87,6 +88,7 @@ public class Juego {
}
return
false
;
}
public
boolean
trio
(
List
<
Carta
>
cartas
)
{
List
<
Integer
>
valores
=
new
ArrayList
<>();
for
(
Carta
c
:
cartas
)
{
...
...
@@ -94,96 +96,91 @@ public class Juego {
}
//Collections.sort(valores);
int
[]
numerosArray
=
pasarAArray
(
valores
);
int
counter
=
0
;
int
cantidadNumero
=
0
;
for
(
int
i
=
11
;
i
<
14
;
i
++)
{
int
counter
=
0
;
int
cantidadNumero
=
0
;
for
(
int
i
=
11
;
i
<
14
;
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
){
if
(
counter
>
cantidadNumero
)
{
cantidadNumero
=
counter
;
cantidadNumero
=
counter
;
}
counter
=
0
;
counter
=
0
;
}
if
(
cantidadNumero
==
3
)
{
if
(
cantidadNumero
==
3
)
{
return
true
;
}
else
{
}
else
{
return
false
;
}
}
//Dos cartas iguales (mismo valor) junto con tres cartas iguales (mismo valor).
public
boolean
full
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPalo
(
cartas
)==
3
)
{
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
])
{
int
con
=
0
;
for
(
int
i
=
0
;
i
<
numerosArray
.
length
-
1
;
i
++)
{
if
(
numerosArray
[
i
]
==
numerosArray
[
i
+
1
])
{
con
++;
if
(
con
==
3
&&
numerosArray
[
2
]
==
numerosArray
[
4
])
{
if
(
con
==
3
&&
numerosArray
[
2
]
==
numerosArray
[
4
])
{
return
true
;
}
else
if
(
con
==
3
&&
numerosArray
[
2
]
==
numerosArray
[
0
])
{
}
else
if
(
con
==
3
&&
numerosArray
[
2
]
==
numerosArray
[
0
])
{
return
true
;
}
}
}
return
false
;
}
else
{
}
else
{
return
false
;
}
}
//Cuatro cartas iguales (mismo valor).
public
boolean
poker
(
List
<
Carta
>
cartas
)
{
if
(
comprobarPalo
(
cartas
)==
4
){
List
<
Integer
>
valores
=
new
ArrayList
<>();
comprobarPalo
(
cartas
);
for
(
Carta
c
:
cartas
)
{
valores
.
add
(
extraer
(
c
.
valor
));
}
Collections
.
sort
(
valores
);
int
counter
=
0
;
int
numero
=
0
;
int
cantidadNumero
=
0
;
for
(
int
i
=
1
;
i
<
14
;
i
++)
{
for
(
int
j
=
0
;
j
<
valores
.
size
();
j
++)
{
int
s
=
valores
.
get
(
j
);
if
(
s
==
i
)
{
int
counter
=
0
;
int
numero
=
0
;
int
cantidadNumero
=
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
;
if
(
counter
>
cantidadNumero
)
{
numero
=
i
;
cantidadNumero
=
counter
;
}
counter
=
0
;
counter
=
0
;
}
if
(
cantidadNumero
==
4
)
{
if
(
cantidadNumero
==
4
)
{
return
true
;
}
else
{
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
private
int
comprobarPalo
(
List
<
Carta
>
cartas
)
{
int
contador
=
0
;
for
(
Carta
c:
cartas
)
{
for
(
Carta
c
:
cartas
)
{
if
(
c
.
palo
.
equals
(
"K"
))
{
contador
++;
...
...
Main.java
View file @
b05dcd6c
...
...
@@ -9,11 +9,11 @@ public class Main {
List
<
Carta
>
cartas
=
new
ArrayList
<>();
cartas
=
Arrays
.
asList
(
new
Carta
(
"TH"
),
new
Carta
(
"TD"
),
new
Carta
(
"TC"
),
new
Carta
(
"4D"
),
new
Carta
(
"AD"
)
new
Carta
(
"KD"
),
new
Carta
(
"AD"
),
new
Carta
(
"JD"
),
new
Carta
(
"QD"
)
);
cartas
.
forEach
(
System
.
out
::
print
);
...
...
out/production/poker/.idea/runConfigurations.xml
deleted
100644 → 0
View file @
53958d7c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
out/production/poker/Juego.class
View file @
b05dcd6c
No preview for this file type
out/production/poker/Main.class
View file @
b05dcd6c
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