Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jweb-e002-JSP
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
Pedro Rolon
jweb-e002-JSP
Commits
505741f7
Commit
505741f7
authored
Nov 29, 2018
by
Pedro Rolon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se corrigió la generación aleatoria. Ya no genera cartas iguales
parent
624d5403
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
17 deletions
+34
-17
jweb-e002/build/classes/clases/Poker.class
+0
-0
jweb-e002/build/classes/servlets/ManoDoc.class
+0
-0
jweb-e002/src/clases/Poker.java
+31
-14
jweb-e002/src/servlets/ManoDoc.java
+3
-3
No files found.
jweb-e002/build/classes/clases/Poker.class
View file @
505741f7
No preview for this file type
jweb-e002/build/classes/servlets/ManoDoc.class
View file @
505741f7
No preview for this file type
jweb-e002/src/clases/Poker.java
View file @
505741f7
...
...
@@ -669,42 +669,59 @@ public class Poker {
Random
random
=
new
Random
();
String
nuevaCarta
=
""
;
int
valor
;
int
palo
;
int
valor
[]
=
new
int
[
n
];
int
palo
[]
=
new
int
[
n
];
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
valor
[
i
]
=
random
.
nextInt
(
13
)
+
1
;
palo
[
i
]
=
random
.
nextInt
(
4
)
+
1
;
for
(
int
j
=
0
;
j
<
i
;
j
++)
{
if
(
valor
[
j
]==
valor
[
i
]
&&
palo
[
j
]==
palo
[
i
])
{
valor
[
i
]
=
random
.
nextInt
(
13
)
+
1
;
palo
[
i
]
=
random
.
nextInt
(
4
)
+
1
;
j
=
0
;
}
}
}
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
valor
=
random
.
nextInt
(
13
)
+
1
;
if
(
valor
==
1
)
{
//
valor = random.nextInt(13) + 1;
if
(
valor
[
i
]
==
1
)
{
nuevaCarta
+=
"A"
;
}
else
if
(
valor
==
10
)
{
else
if
(
valor
[
i
]
==
10
)
{
nuevaCarta
+=
"T"
;
}
else
if
(
valor
==
11
)
{
else
if
(
valor
[
i
]
==
11
)
{
nuevaCarta
+=
"J"
;
}
else
if
(
valor
==
12
)
{
else
if
(
valor
[
i
]
==
12
)
{
nuevaCarta
+=
"Q"
;
}
else
if
(
valor
==
13
)
{
else
if
(
valor
[
i
]
==
13
)
{
nuevaCarta
+=
"K"
;
}
else
{
nuevaCarta
+=
valor
;
nuevaCarta
+=
valor
[
i
]
;
}
palo
=
random
.
nextInt
(
4
)
+
1
;
//
palo = random.nextInt(4) + 1;
if
(
palo
==
1
){
if
(
palo
[
i
]
==
1
){
nuevaCarta
+=
"H"
;
}
else
if
(
palo
==
2
){
else
if
(
palo
[
i
]
==
2
){
nuevaCarta
+=
"S"
;
}
else
if
(
palo
==
3
){
else
if
(
palo
[
i
]
==
3
){
nuevaCarta
+=
"D"
;
}
else
if
(
palo
==
4
){
else
if
(
palo
[
i
]
==
4
){
nuevaCarta
+=
"C"
;
}
...
...
jweb-e002/src/servlets/ManoDoc.java
View file @
505741f7
...
...
@@ -65,7 +65,7 @@ public class ManoDoc extends HttpServlet {
mano
[
i
].
valor
=
"R"
;
}
else
if
(
mano
[
i
].
valor
.
equals
(
"T"
)){
mano
[
i
].
valor
=
"
10
"
;
mano
[
i
].
valor
=
"
B
"
;
}
manoString
.
add
(
mano
[
i
].
valor
+
mano
[
i
].
palo
);
}
...
...
@@ -76,8 +76,8 @@ public class ManoDoc extends HttpServlet {
if
(
manoString
.
get
(
i
).
charAt
(
0
)==
'R'
)
{
mano
[
i
]
=
new
Carta
(
"A"
+
manoString
.
get
(
i
).
charAt
(
1
));
}
else
if
(
manoString
.
get
(
i
).
charAt
(
0
)==
'
1'
&&
manoString
.
get
(
i
).
charAt
(
1
)==
'0
'
){
mano
[
i
]
=
new
Carta
(
"T"
+
manoString
.
get
(
i
).
charAt
(
2
));
else
if
(
manoString
.
get
(
i
).
charAt
(
0
)==
'
B
'
){
mano
[
i
]
=
new
Carta
(
"T"
+
manoString
.
get
(
i
).
charAt
(
1
));
}
else
{
mano
[
i
]
=
new
Carta
(
manoString
.
get
(
i
));
...
...
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