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
78205811
Commit
78205811
authored
Apr 27, 2022
by
Yovan Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Agregados los metodos valorCadenaNumerico y formulaYovan
parent
180c5a5c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
17 deletions
+39
-17
Poker.java
+39
-17
No files found.
Poker.java
View file @
78205811
...
...
@@ -34,14 +34,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
{
...
...
@@ -51,16 +44,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
++)
{
...
...
@@ -115,6 +101,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
)
{
...
...
@@ -140,7 +162,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