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
Yovan Martinez
poker
Commits
bff2fedd
Commit
bff2fedd
authored
Apr 28, 2022
by
Yovan Martinez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://phoebe.roshka.com/gitlab/ymartinez/poker
into develop
parents
985dd79b
78205811
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
18 deletions
+40
-18
Poker.java
+40
-18
No files found.
Poker.java
View file @
bff2fedd
...
...
@@ -35,14 +35,7 @@ public class Poker {
}
//***********CONTROLA LA JUGADA QUE SE DA EN LOS PALOS
public
String
controlPalos
(
String
palos
){
int
contador
=
0
;
for
(
int
i
=
0
;
i
<
palos
.
length
();
i
++)
{
for
(
int
j
=
0
;
j
<
palos
.
length
();
j
++)
{
if
(
palos
.
charAt
(
i
)
==
palos
.
charAt
(
j
))
{
contador
++;
}
}
}
int
contador
=
formulaYovan
(
palos
);
if
(
contador
==
25
)
{
return
"COLOR"
;
}
else
{
...
...
@@ -52,16 +45,9 @@ public class Poker {
}
//***********CONTROLA QUE JUGADA SE DA EN LOS VALORES
public
String
controlValor
(
String
valores
){
int
contador
=
0
;
int
contador
=
formulaYovan
(
valores
)
;
int
secuencial
=
0
;
boolean
thereIsLetter
=
false
;
for
(
int
i
=
0
;
i
<
valores
.
length
();
i
++)
{
for
(
int
j
=
0
;
j
<
valores
.
length
();
j
++)
{
if
(
valores
.
charAt
(
i
)
==
valores
.
charAt
(
j
))
{
contador
++;
}
}
}
if
(
contador
<
6
)
{
//controla que existan letras en los valores mandados
for
(
int
i
=
0
;
i
<
valores
.
length
();
i
++)
{
...
...
@@ -98,7 +84,7 @@ public class Poker {
return
"PAR DOBLE"
;
}
else
if
(
contador
==
7
){
return
"PAR"
;
}
}
//Para mejor manejo si no cumple ninguna de las condiciones envia una cadena vacia
return
""
;
}
...
...
@@ -116,6 +102,42 @@ public class Poker {
}
return
"0"
;
}
//Con este metodo controlo de que manera se repite el string que recibe el metodo(Formula de yorhan ;D )
public
int
formulaYovan
(
String
cadena
){
int
contador
=
0
;
for
(
int
i
=
0
;
i
<
cadena
.
length
();
i
++)
{
for
(
int
j
=
0
;
j
<
cadena
.
length
();
j
++)
{
if
(
cadena
.
charAt
(
i
)
==
cadena
.
charAt
(
j
))
{
contador
++;
}
}
}
return
contador
;
}
//Con este metodo le doy valor numerico a la cadena valor
public
int
valorCadenaNumerico
(
String
strValue
){
int
valorNumerico
=
0
;
switch
(
controlValor
(
values
))
{
case
"89JQT"
:
valorNumerico
=
50
;
break
;
case
"9JKQT"
:
valorNumerico
=
55
;
break
;
case
"AJKQT"
:
valorNumerico
=
60
;
break
;
case
"2345A"
:
valorNumerico
=
15
;
break
;
case
"789JT"
:
valorNumerico
=
45
;
break
;
case
"6789T"
:
valorNumerico
=
40
;
break
;
default
:
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
valorNumerico
=
Character
.
valueOf
(
strValue
.
charAt
(
i
));}
break
;
}
return
valorNumerico
;
}
public
static
void
main
(
String
[]
args
)
{
...
...
@@ -170,7 +192,7 @@ public class Poker {
}
//Condicional para imprimir los resultados solo si no se encontraron cartas repetidas
if
(
control
==
5
){
if
((
partida
.
controlValor
(
partida
.
getValue
())==
""
)
&&
(
partida
.
controlPalos
(
partida
.
getSuit
())
==
""
))
{
if
((
partida
.
controlValor
(
partida
.
getValue
())
==
""
)
&&
(
partida
.
controlPalos
(
partida
.
getSuit
())
==
""
))
{
System
.
out
.
println
(
"CARTA ALTA"
);
}
else
{
//Dejo a modo de comentario para posibles comprobaciones o controles
...
...
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