Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
java-e003-generala
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
java-e003-generala
Commits
cbe23ab0
Commit
cbe23ab0
authored
Apr 24, 2022
by
Josebaezx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mejoras con el codigo, comprueba numeros desordenados
parent
17163760
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
24 deletions
+52
-24
out/production/java-e003-generala.git/Dado.class
+0
-0
out/production/java-e003-generala.git/Generala.class
+0
-0
out/production/java-e003-generala.git/Play.class
+0
-0
src/Dado.java
+32
-15
src/Generala.java
+9
-4
src/Play.java
+11
-5
No files found.
out/production/java-e003-generala.git/Dado.class
View file @
cbe23ab0
No preview for this file type
out/production/java-e003-generala.git/Generala.class
View file @
cbe23ab0
No preview for this file type
out/production/java-e003-generala.git/Play.class
View file @
cbe23ab0
No preview for this file type
src/Dado.java
View file @
cbe23ab0
import
java.util.Arrays
;
public
class
Dado
{
public
class
Dado
{
String
jugada
(
String
dados
)
{
String
jugada
(
String
dados
)
{
int
numeros
=
Integer
.
parseInt
(
dados
);
int
numeros
=
Integer
.
parseInt
(
dados
);
int
[]
numerosArray
=
new
int
[
5
];
for
(
int
i
=
0
;
i
<
numerosArray
.
length
;
i
++)
{
numerosArray
[
i
]
=
dados
.
charAt
(
i
)
-
'0'
;
}
Arrays
.
sort
(
numerosArray
);
if
(
numeros
>
11110
&&
numeros
<
66667
)
{
if
(
numeros
>
11110
&&
numeros
<
66667
)
{
for
(
int
i
=
1
;
i
<
7
;
i
++){
for
(
int
i
=
1
;
i
<
7
;
i
++){
...
@@ -10,30 +17,40 @@ public class Dado {
...
@@ -10,30 +17,40 @@ public class Dado {
return
"GENERALA"
;
return
"GENERALA"
;
}
}
}
}
for
(
int
i
=
1
;
i
<
7
;
i
++){
String
valor
=
String
.
valueOf
((
1111
*
i
));
int
con
=
0
;
for
(
int
j
=
1
;
j
<
7
;
j
++){
for
(
int
i
=
0
;
i
<
numerosArray
.
length
-
1
;
i
++)
{
String
valor2
=
valor
+
j
;
if
(
numerosArray
[
i
]
==
numerosArray
[
i
+
1
])
{
if
(
valor2
.
equals
(
dados
))
{
con
++;
return
"PÓKER"
;
if
(
con
==
3
&&
numerosArray
[
1
]
==
numerosArray
[
2
]
&&
numerosArray
[
2
]
==
numerosArray
[
3
]){
return
"POKER"
;
}
}
}
}
}
}
con
=
0
;
for
(
int
i
=
1
;
i
<
7
;
i
++){
for
(
int
i
=
0
;
i
<
numerosArray
.
length
-
1
;
i
++)
{
String
valor
=
String
.
valueOf
((
111
*
i
));
if
(
numerosArray
[
i
]
==
numerosArray
[
i
+
1
])
{
for
(
int
j
=
1
;
j
<
7
;
j
++){
con
++;
String
valor2
=
valor
+
(
11
*
j
);
if
(
con
==
3
&&
numerosArray
[
2
]
==
numerosArray
[
4
]){
if
(
valor2
.
equals
(
dados
))
{
return
"FULL"
;
}
else
if
(
con
==
3
&&
numerosArray
[
2
]
==
numerosArray
[
0
]){
return
"FULL"
;
return
"FULL"
;
}
}
}
}
}
}
con
=
0
;
for
(
int
i
=
0
;
i
<
numerosArray
.
length
-
1
;
i
++)
{
if
(
numerosArray
[
i
]
!=
numerosArray
[
i
+
1
])
{
con
++;
}
if
(
dados
.
equals
(
"12345"
)
||
dados
.
equals
(
"23456"
)
||
dados
.
equals
(
"34561"
)
if
(
con
==
4
&&
(
numerosArray
[
3
]+
1
)
==
numerosArray
[
4
])
{
||
dados
.
equals
(
"45612"
)
||
dados
.
equals
(
"56123"
)
||
dados
.
equals
(
"61234"
))
{
return
"ESCALERA"
;
return
"ESCALERA"
;
}
}
}
return
"NADA"
;
return
"NADA"
;
}
else
{
}
else
{
...
...
src/Generala.java
View file @
cbe23ab0
import
java.io.Console
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Scanner
;
import
java.util.Scanner
;
import
java.io.File
;
import
java.io.File
;
...
@@ -48,8 +48,13 @@ public class Generala {
...
@@ -48,8 +48,13 @@ public class Generala {
}
}
// ESTO SI SE EJECUTA PARA USTEDES
// ESTO SI SE EJECUTA PARA USTEDES
String
resultado
=
p
.
lanzarDados
();
int
[]
resultado
=
p
.
lanzarDados
();
System
.
out
.
println
(
"Dados lanzados = "
+
resultado
);
System
.
out
.
println
(
"Dados lanzados = "
+
p
.
getNumerosString
());
System
.
out
.
println
(
"Resultado: "
+
g
.
jugada
(
"66667"
));
Arrays
.
sort
(
resultado
);
System
.
out
.
print
(
"Codigo ordenado: "
);
for
(
int
i
=
0
;
i
<
resultado
.
length
;
i
++)
{
System
.
out
.
print
(
resultado
[
i
]);
}
System
.
out
.
println
(
"\nResultado: "
+
g
.
jugada
(
p
.
getNumerosString
()));
}
}
}
}
src/Play.java
View file @
cbe23ab0
public
class
Play
{
public
class
Play
{
String
numeros
=
""
;
private
int
[]
numeros
;
private
String
numerosString
=
""
;
public
String
getNumeros
()
{
public
int
[]
getNumeros
()
{
return
numeros
;
return
numeros
;
}
}
public
String
lanzarDados
(){
public
String
getNumerosString
()
{
return
numerosString
;
}
public
int
[]
lanzarDados
(){
this
.
numeros
=
new
int
[
5
];
for
(
int
i
=
0
;
i
<
5
;
i
++){
for
(
int
i
=
0
;
i
<
5
;
i
++){
int
numero
=
(
int
)
Math
.
floor
(
Math
.
random
()*
6
+
1
);
this
.
numeros
[
i
]
=
(
int
)
Math
.
floor
(
Math
.
random
()*
6
+
1
);
this
.
numeros
+=
(
String
.
valueOf
(
numero
))
;
this
.
numeros
String
+=
this
.
numeros
[
i
]
;
}
}
return
this
.
numeros
;
return
this
.
numeros
;
}
}
...
...
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