Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TP-Kotlin-miguel
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
Miguel Do Carmo
TP-Kotlin-miguel
Commits
483af2ce
Commit
483af2ce
authored
Apr 17, 2020
by
Miguel Do Carmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parche para la escalera que no estaba detectando correctamente
parent
4e714a8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
24 deletions
+33
-24
out/production/tp-kotlin-miguel/codigos/PokerKt.class
+0
-0
src/codigos/poker.kt
+33
-24
No files found.
out/production/tp-kotlin-miguel/codigos/PokerKt.class
View file @
483af2ce
No preview for this file type
src/codigos/poker.kt
View file @
483af2ce
...
...
@@ -51,7 +51,8 @@ fun encuentraRepetidos(cartasMesa: String) : Boolean{
var
mantieneCorrecto
=
false
for
(
caracteres
in
0
..
4
step
2
){
for
(
caracteresRepite
in
caracteres
+
2
..
8
step
2
){
if
((
cartasMesa
[
caracteres
]
==
cartasMesa
[
caracteresRepite
])
&&
(
cartasMesa
[
caracteres
+
1
]
==
cartasMesa
[
caracteresRepite
+
1
])){
if
((
cartasMesa
[
caracteres
]
==
cartasMesa
[
caracteresRepite
])
&&
(
cartasMesa
[
caracteres
+
1
]
==
cartasMesa
[
caracteresRepite
+
1
])){
mantieneCorrecto
=
true
}
}
...
...
@@ -90,10 +91,11 @@ fun analizaJugadaOrdenada(jugadaOrdenada : List<CartaJugada>): String{
'K'
->
valoresJugados
[
12
]++
}
}
var
noEsColor
=
true
for
(
palo
in
palosJugados
){
if
(
palo
==
5
){
result
=
"COLOR"
noEsColor
=
false
for
(
position
in
valoresJugados
.
indices
){
result
=
if
(
position
<
9
){
if
(
1
==
valoresJugados
[
position
]
&&
1
==
valoresJugados
[
position
+
1
]
&&
1
==
valoresJugados
[
position
+
2
]
&&
1
==
valoresJugados
[
position
+
3
]
&&
1
==
valoresJugados
[
position
+
4
])
"ESCALERA COLOR"
else
continue
...
...
@@ -103,31 +105,39 @@ fun analizaJugadaOrdenada(jugadaOrdenada : List<CartaJugada>): String{
}
}
}
// Jugadas posibles para 5 palos iguales
var
tieneTrio
=
false
var
cantDobles
=
0
for
(
position
in
valoresJugados
.
indices
)
{
if
(
valoresJugados
[
position
]
==
4
){
result
=
"POKER"
break
}
else
{
if
(
valoresJugados
[
position
]
==
3
)
tieneTrio
=
true
if
(
valoresJugados
[
position
]
==
2
)
cantDobles
++
result
=
if
((
cantDobles
==
1
)
&&
tieneTrio
)
"FULL"
else
if
((
cantDobles
==
0
)
&&
tieneTrio
)
"TRIO"
else
if
(
cantDobles
==
1
)
"PAREJA"
else
if
(
cantDobles
==
2
)
"PAREJA DOBLE"
else
"CARTA ALTA"
if
(
valoresJugados
[
position
]
==
1
&&
position
<=
9
)
{
result
=
if
(
position
<
9
)
{
if
(
1
==
valoresJugados
[
position
]
&&
1
==
valoresJugados
[
position
+
1
]
&&
1
==
valoresJugados
[
position
+
2
]
&&
1
==
valoresJugados
[
position
+
3
]
&&
1
==
valoresJugados
[
position
+
4
])
"ESCALERA"
else
continue
if
(
noEsColor
)
{
var
tieneTrio
=
false
var
cantDobles
=
0
for
(
position
in
valoresJugados
.
indices
)
{
if
(
valoresJugados
[
position
]
==
4
)
{
result
=
"POKER"
break
}
else
if
(
valoresJugados
[
position
]
==
1
&&
position
<=
9
)
{
if
(
position
<
9
)
{
if
(
1
==
valoresJugados
[
position
]
&&
1
==
valoresJugados
[
position
+
1
]
&&
1
==
valoresJugados
[
position
+
2
]
&&
1
==
valoresJugados
[
position
+
3
]
&&
1
==
valoresJugados
[
position
+
4
])
{
result
=
"ESCALERA"
break
}
else
{
continue
}
}
else
if
(
position
==
9
)
{
if
(
1
==
valoresJugados
[
position
]
&&
1
==
valoresJugados
[
position
+
1
]
&&
1
==
valoresJugados
[
position
+
2
]
&&
1
==
valoresJugados
[
position
+
3
]
&&
1
==
valoresJugados
[
0
])
"ESCALERA FIGURAS"
else
break
if
(
1
==
valoresJugados
[
position
]
&&
1
==
valoresJugados
[
position
+
1
]
&&
1
==
valoresJugados
[
position
+
2
]
&&
1
==
valoresJugados
[
position
+
3
]
&&
1
==
valoresJugados
[
0
])
{
result
=
"ESCALERA FIGURAS"
break
}
else
break
}
else
break
}
// Controla para ESCALERA
else
{
if
(
valoresJugados
[
position
]
==
3
)
tieneTrio
=
true
if
(
valoresJugados
[
position
]
==
2
)
cantDobles
++
result
=
if
((
cantDobles
==
1
)
&&
tieneTrio
)
"FULL"
else
if
((
cantDobles
==
0
)
&&
tieneTrio
)
"TRIO"
else
if
(
cantDobles
==
1
)
"PAREJA"
else
if
(
cantDobles
==
2
)
"PAREJA DOBLE"
else
"CARTA ALTA"
}
}
}
return
result
}
\ No newline at end of file
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