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
Emanuel Lugo
poker
Commits
2307da70
Commit
2307da70
authored
Apr 28, 2022
by
Emanuel Lugo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pokerGame2 terminado
parent
63e14615
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
29 deletions
+70
-29
.vscode/settings.json
+4
-0
poker/Carta.java
+51
-2
poker/pokerGame.java
+15
-27
poker2/PokerGame2.java
+0
-0
No files found.
.vscode/settings.json
0 → 100644
View file @
2307da70
{
"java.jdt.ls.vmargs"
:
"-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m"
}
\ No newline at end of file
poker/Carta.java
View file @
2307da70
package
poker
;
import
java.util.Objects
;
public
class
Carta
{
public
String
valor
;
...
...
@@ -40,10 +41,39 @@ public class Carta {
return
this
.
valor
+
this
.
palo
;
}
//VER OPCINES DE SOLUCIONAR LETRAS
public
int
getValorInt
()
{
int
aux
=
Integer
.
parseInt
(
this
.
valor
);
int
result
=
0
;
try
{
int
aux
=
Integer
.
parseInt
(
this
.
valor
);
return
aux
;
}
catch
(
Exception
e
)
{
switch
(
this
.
valor
)
{
case
"T"
:
result
=
10
;
break
;
case
"J"
:
result
=
11
;
break
;
case
"Q"
:
result
=
12
;
break
;
case
"K"
:
result
=
13
;
break
;
case
"A"
:
result
=
14
;
break
;
}
return
result
;
}
}
...
...
@@ -52,4 +82,23 @@ public class Carta {
}
public
void
setValor
(
String
nuevoValor
){
this
.
valor
=
String
.
valueOf
(
nuevoValor
.
charAt
(
0
));
this
.
palo
=
String
.
valueOf
(
nuevoValor
.
charAt
(
1
));
}
@Override
public
boolean
equals
(
Object
b
)
{
Carta
cartab
=
(
Carta
)
b
;
if
(
this
.
valor
.
equals
(
cartab
.
valor
)
&&
(
this
.
palo
.
equals
(
cartab
.
palo
)))
{
return
true
;
}
else
return
false
;
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
this
.
valor
,
this
.
palo
);
}
}
poker/pokerGame.java
View file @
2307da70
...
...
@@ -19,6 +19,18 @@ public class pokerGame {
// COMPROBACIÓN DE CASOS DE CARTAS EN SECUENCIA - ESCALERA COLOR - ESCALERA -
// COLOR
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
}
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
// System.out.println(mano.get(i).getValorInt() + ": valor carta1");
// System.out.println(mano.get(i+1).getValorInt() + ": valor carta2");
...
...
@@ -36,7 +48,7 @@ public class pokerGame {
}
if
(
contadorValor
==
3
&&
mano
.
get
(
0
).
getValorInt
()
==
1
&&
mano
.
get
(
4
).
getValorInt
()
==
13
)
{
return
resultado
=
"ESCALERA
COLOR
"
;
return
resultado
=
"ESCALERA"
;
}
if
(
contadorValor
==
4
&&
contadorPalo
==
4
)
{
return
resultado
=
"ESCALERA COLOR"
;
...
...
@@ -106,28 +118,4 @@ public class pokerGame {
}
}
/*
* PARA TESTEAR
* Collections.sort(mano, new SortbyPalo());
*
* System.out.println("");
*
* for (i = 0; i < mano.size(); i++)
* System.out.println(mano.get(i).valorPalo());
*
* Collections.sort(mano, new SortbyValor());
*
* System.out.println("");
*
* for (i = 0; i < mano.size(); i++)
* System.out.println(mano.get(i).valorPalo());
*
* Collections.sort(mano, new SortbyValor());
*
* System.out.println("");
*
* for (i = 0; i < mano.size(); i++)
* System.out.println(mano.get(i).valorPalo());
*/
\ No newline at end of file
}
\ No newline at end of file
poker2/PokerGame2.java
View file @
2307da70
This diff is collapsed.
Click to expand it.
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