Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kotlin-e004-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
Yannine Alvarez
kotlin-e004-poker
Commits
c7f9007f
Commit
c7f9007f
authored
Apr 20, 2020
by
Yannine Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agregar la funciòn verificar las cartas para ganador
parent
13c6becc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
15 deletions
+80
-15
Poker/.idea/workspace.xml
+18
-7
Poker/src/Poker.kt
+62
-8
No files found.
Poker/.idea/workspace.xml
View file @
c7f9007f
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"628f93ca-b7ce-4a63-90a4-4fc67deaa2b5"
name=
"Default Changelist"
comment=
""
/>
<list
default=
"true"
id=
"628f93ca-b7ce-4a63-90a4-4fc67deaa2b5"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/Poker.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/Poker.kt"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
@@ -110,24 +113,32 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1587433599286
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"5"
/>
<task
id=
"LOCAL-00005"
summary=
"Se agrega la rama poker_2 que contiene la función ganador."
>
<created>
1587433850431
</created>
<option
name=
"number"
value=
"00005"
/>
<option
name=
"presentableId"
value=
"LOCAL-00005"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1587433850431
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"6"
/>
<servers
/>
</component>
<component
name=
"VcsManagerConfiguration"
>
<MESSAGE
value=
"Unificar en una función para retornar valores en el poker"
/>
<MESSAGE
value=
"corrección de valor de retorno."
/>
<MESSAGE
value=
"corrección de valor de retorno, agregar return poker."
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"corrección de valor de retorno, agregar return poker."
/>
<MESSAGE
value=
"Se agrega la rama poker_2 que contiene la función ganador."
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"Se agrega la rama poker_2 que contiene la función ganador."
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
x=
"413"
y=
"109"
key=
"#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog"
timestamp=
"1586915044775"
>
<screen
x=
"0"
y=
"0"
width=
"1366"
height=
"728"
/>
</state>
<state
x=
"413"
y=
"109"
key=
"#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog/0.0.1366.728@0.0.1366.728"
timestamp=
"1586915044775"
/>
<state
x=
"313"
y=
"0"
key=
"CommitChangelistDialog2"
timestamp=
"1587433
753607
"
>
<state
x=
"313"
y=
"0"
key=
"CommitChangelistDialog2"
timestamp=
"1587433
848146
"
>
<screen
x=
"0"
y=
"0"
width=
"1366"
height=
"728"
/>
</state>
<state
x=
"313"
y=
"0"
key=
"CommitChangelistDialog2/0.0.1366.728@0.0.1366.728"
timestamp=
"1587433
753607
"
/>
<state
x=
"313"
y=
"0"
key=
"CommitChangelistDialog2/0.0.1366.728@0.0.1366.728"
timestamp=
"1587433
848146
"
/>
<state
width=
"1322"
height=
"145"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1587433392572"
>
<screen
x=
"0"
y=
"0"
width=
"1366"
height=
"728"
/>
</state>
...
...
@@ -160,10 +171,10 @@
<screen
x=
"0"
y=
"0"
width=
"1366"
height=
"728"
/>
</state>
<state
width=
"1322"
height=
"217"
key=
"GridCell.Tab.1.right/0.0.1366.728@0.0.1366.728"
timestamp=
"1587426755633"
/>
<state
x=
"275"
y=
"95"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"1587433
621528
"
>
<state
x=
"275"
y=
"95"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"1587433
858527
"
>
<screen
x=
"0"
y=
"0"
width=
"1366"
height=
"728"
/>
</state>
<state
x=
"275"
y=
"95"
key=
"Vcs.Push.Dialog.v2/0.0.1366.728@0.0.1366.728"
timestamp=
"1587433
621528
"
/>
<state
x=
"275"
y=
"95"
key=
"Vcs.Push.Dialog.v2/0.0.1366.728@0.0.1366.728"
timestamp=
"1587433
858527
"
/>
<state
x=
"92"
y=
"92"
width=
"1182"
height=
"544"
key=
"com.intellij.history.integration.ui.views.FileHistoryDialog"
timestamp=
"1587430678418"
>
<screen
x=
"0"
y=
"0"
width=
"1366"
height=
"728"
/>
</state>
...
...
Poker/src/Poker.kt
View file @
c7f9007f
// Repositorio https://phoebe.roshka.com/gitlab/yalvarez/kotlin-e004-poker
import
java.util.*
const
val
CARAS
=
"23456789tjqka"
const
val
LETRAS
=
"shdc"
//clase carta que recibe el valor y el palo
class
Carta
(
completo
:
String
)
{
fun
valorPalo
():
String
{
return
valor
+
palo
...
...
@@ -17,7 +19,7 @@ class Carta(completo: String) {
palo
=
completo
[
1
].
toString
()
}
}
//clase que ordena las cartas
class
OrdenarCartas
{
val
valores
=
charArrayOf
(
'A'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'T'
,
'J'
,
'Q'
,
'K'
)
val
palos
=
charArrayOf
(
'S'
,
'C'
,
'H'
,
'D'
)
...
...
@@ -73,7 +75,8 @@ class OrdenarCartas {
}
}
//completar para mostrar la mano ganadora de acuerdo a la clasificacion de jugadas del poker
fun
ganador
(
jugadas
:
MutableList
<
Array
<
Carta
?>>):
String
?
{
//Imprime la cantidad de jugadas
println
(
"Cantidad de jugadas: "
+
jugadas
.
size
)
...
...
@@ -96,13 +99,64 @@ fun ganador(jugadas: MutableList<Array<Carta?>>): String? {
if
(
mejoresManos
.
size
==
1
)
{
return
"Jugada "
+
(
mejoresManos
[
0
]
+
1
)
}
else
{
val
variasManos
=
ArrayList
<
Array
<
Carta
>>()
}
//agregar para retomar el ganador en caso de verificar la Carta
return
"Error"
}
var
mejor
=
0
fun
verificarCarta
():
Array
<
Carta
?>?
{
var
respuesta
:
ArrayList
<
Array
<
Carta
?>?>?
=
null
if
(
mejor
===
1
)
{
respuesta
=
siEsPoker
()
}
else
if
(
mejor
===
2
)
{
respuesta
=
siEsFull
()
}
else
if
(
mejor
===
3
)
{
respuesta
=
siEsColorYCartaAlta
()
}
else
if
(
mejor
===
4
)
{
respuesta
=
siEscalera
()
}
else
if
(
mejor
===
5
)
{
respuesta
=
siTrio
()
}
else
if
(
mejor
===
6
)
{
respuesta
=
siParDoble
()
}
else
if
(
mejor
===
7
)
{
respuesta
=
siPar
()
}
return
"jugador 1"
return
respuesta
!!
[
0
]
}
fun
siPar
():
ArrayList
<
Array
<
Carta
?>?>?
{
//completar
}
fun
siParDoble
():
ArrayList
<
Array
<
Carta
?>?>?
{
}
fun
siEscalera
():
ArrayList
<
Array
<
Carta
?>?>?
{
}
fun
siTrio
():
ArrayList
<
Array
<
Carta
?>?>?
{
}
fun
siEsColorYCartaAlta
():
ArrayList
<
Array
<
Carta
?>?>?
{
}
fun
siEsFull
():
ArrayList
<
Array
<
Carta
?>?>?
{
}
fun
siEsPoker
():
ArrayList
<
Array
<
Carta
?>?>?
{
}
...
...
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