Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
UNO
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9628055
UNO
Commits
e5c08ae4
Commit
e5c08ae4
authored
Apr 07, 2020
by
nargessalehi98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cards preview
parent
ac3a1766
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
148 additions
and
103 deletions
+148
-103
Cards.class
out/production/UNO/Cards.class
+0
-0
Main.class
out/production/UNO/Main.class
+0
-0
Repository.class
out/production/UNO/Repository.class
+0
-0
Cards.java
src/Cards.java
+84
-82
Main.java
src/Main.java
+15
-13
Repository.java
src/Repository.java
+49
-8
No files found.
out/production/UNO/Cards.class
View file @
e5c08ae4
No preview for this file type
out/production/UNO/Main.class
View file @
e5c08ae4
No preview for this file type
out/production/UNO/Repository.class
View file @
e5c08ae4
No preview for this file type
src/Cards.java
View file @
e5c08ae4
...
...
@@ -7,9 +7,9 @@ public class Cards {
public
static
final
String
yellow
=
"\u001B[33m"
;
public
static
final
String
blue
=
"\u001B[34m"
;
private
String
Y
Skip
=
yellow
+
"\u2503ski
p\u2503"
;
private
String
Y
Rotate
=
yellow
+
"\u2503rvr
s\u2503"
;
private
String
Y
Plus2
=
yellow
+
"\u2503 +2
\u2503"
;
private
String
Y
skip
=
yellow
+
"\u2503sk
p\u2503"
;
private
String
Y
rotate
=
yellow
+
"\u2503rv
s\u2503"
;
private
String
Y
plus2
=
yellow
+
"\u2503+ 2
\u2503"
;
private
String
Y0
=
yellow
+
"\u2503 0 \u2503"
;
private
String
Y1
=
yellow
+
"\u2503 1 \u2503"
;
private
String
Y2
=
yellow
+
"\u2503 2 \u2503"
;
...
...
@@ -21,9 +21,9 @@ public class Cards {
private
String
Y8
=
yellow
+
"\u2503 8 \u2503"
;
private
String
Y9
=
yellow
+
"\u2503 9 \u2503"
;
private
String
B
Skip
=
blue
+
"\u2503ski
p\u2503"
;
private
String
B
Rotate
=
blue
+
"\u2503rvr
s\u2503"
;
private
String
B
Plus2
=
blue
+
"\u2503 +2
\u2503"
;
private
String
B
skip
=
blue
+
"\u2503sk
p\u2503"
;
private
String
B
rotate
=
blue
+
"\u2503rv
s\u2503"
;
private
String
B
plus2
=
blue
+
"\u2503+ 2
\u2503"
;
private
String
B0
=
blue
+
"\u2503 0 \u2503"
;
private
String
B1
=
blue
+
"\u2503 1 \u2503"
;
private
String
B2
=
blue
+
"\u2503 2 \u2503"
;
...
...
@@ -35,9 +35,9 @@ public class Cards {
private
String
B8
=
blue
+
"\u2503 8 \u2503"
;
private
String
B9
=
blue
+
"\u2503 9 \u2503"
;
private
String
R
Skip
=
red
+
"\u2503ski
p\u2503"
;
private
String
R
Rotate
=
red
+
"\u2503rvr
s\u2503"
;
private
String
R
Plus2
=
red
+
"\u2503 +2
\u2503"
;
private
String
R
skip
=
red
+
"\u2503sk
p\u2503"
;
private
String
R
rotate
=
red
+
"\u2503rv
s\u2503"
;
private
String
R
plus2
=
red
+
"\u2503+ 2
\u2503"
;
private
String
R0
=
red
+
"\u2503 0 \u2503"
;
private
String
R1
=
red
+
"\u2503 1 \u2503"
;
private
String
R2
=
red
+
"\u2503 2 \u2503"
;
...
...
@@ -49,9 +49,9 @@ public class Cards {
private
String
R8
=
red
+
"\u2503 8 \u2503"
;
private
String
R9
=
red
+
"\u2503 9 \u2503"
;
private
String
G
Skip
=
green
+
"\u2503ski
p\u2503"
;
private
String
G
Rotate
=
green
+
"\u2503rvr
s\u2503"
;
private
String
G
Plus2
=
green
+
"\u2503 +2
\u2503"
;
private
String
G
skip
=
green
+
"\u2503sk
p\u2503"
;
private
String
G
rotate
=
green
+
"\u2503rv
s\u2503"
;
private
String
G
plus2
=
green
+
"\u2503+ 2
\u2503"
;
private
String
G0
=
green
+
"\u2503 0 \u2503"
;
private
String
G1
=
green
+
"\u2503 1 \u2503"
;
private
String
G2
=
green
+
"\u2503 2 \u2503"
;
...
...
@@ -63,9 +63,8 @@ public class Cards {
private
String
G8
=
green
+
"\u2503 8 \u2503"
;
private
String
G9
=
green
+
"\u2503 9 \u2503"
;
//14
private
String
wildPlus4
=
black
+
"\u2503+4🌈"
+
green
+
black
+
"\u2503"
;
private
String
wildColor
=
black
+
"\u2503"
+
" 🌈 "
+
green
+
black
+
"\u2503"
;
private
String
wildPlus4
=
black
+
"\u2503"
+
blue
+
"+ "
+
red
+
"4"
+
black
+
"\u2503"
;
private
String
wildColor
=
black
+
"\u2503"
+
blue
+
"\u2503"
+
green
+
"\u2503"
+
red
+
"\u2503"
+
green
+
black
+
"\u2503"
;
private
HashMap
<
Integer
,
String
>
cards
;
...
...
@@ -98,12 +97,12 @@ public class Cards {
cards
.
put
(
282
,
G8
);
cards
.
put
(
291
,
G9
);
cards
.
put
(
292
,
G9
);
cards
.
put
(
2101
,
G
R
otate
);
cards
.
put
(
2102
,
G
R
otate
);
cards
.
put
(
2111
,
G
S
kip
);
cards
.
put
(
2112
,
G
S
kip
);
cards
.
put
(
2121
,
G
P
lus2
);
cards
.
put
(
2122
,
G
P
lus2
);
cards
.
put
(
2101
,
G
r
otate
);
cards
.
put
(
2102
,
G
r
otate
);
cards
.
put
(
2111
,
G
s
kip
);
cards
.
put
(
2112
,
G
s
kip
);
cards
.
put
(
2121
,
G
p
lus2
);
cards
.
put
(
2122
,
G
p
lus2
);
cards
.
put
(
301
,
B0
);
cards
.
put
(
311
,
B1
);
...
...
@@ -124,12 +123,12 @@ public class Cards {
cards
.
put
(
382
,
B8
);
cards
.
put
(
391
,
B9
);
cards
.
put
(
392
,
B9
);
cards
.
put
(
3101
,
B
R
otate
);
cards
.
put
(
3102
,
B
R
otate
);
cards
.
put
(
3111
,
B
S
kip
);
cards
.
put
(
3112
,
B
S
kip
);
cards
.
put
(
3121
,
B
P
lus2
);
cards
.
put
(
3122
,
B
P
lus2
);
cards
.
put
(
3101
,
B
r
otate
);
cards
.
put
(
3102
,
B
r
otate
);
cards
.
put
(
3111
,
B
s
kip
);
cards
.
put
(
3112
,
B
s
kip
);
cards
.
put
(
3121
,
B
p
lus2
);
cards
.
put
(
3122
,
B
p
lus2
);
cards
.
put
(
401
,
Y0
);
cards
.
put
(
411
,
Y1
);
...
...
@@ -150,12 +149,12 @@ public class Cards {
cards
.
put
(
482
,
Y8
);
cards
.
put
(
491
,
Y9
);
cards
.
put
(
492
,
Y9
);
cards
.
put
(
4101
,
Y
R
otate
);
cards
.
put
(
4102
,
Y
R
otate
);
cards
.
put
(
4111
,
Y
S
kip
);
cards
.
put
(
4112
,
Y
S
kip
);
cards
.
put
(
4121
,
Y
P
lus2
);
cards
.
put
(
4122
,
Y
P
lus2
);
cards
.
put
(
4101
,
Y
r
otate
);
cards
.
put
(
4102
,
Y
r
otate
);
cards
.
put
(
4111
,
Y
s
kip
);
cards
.
put
(
4112
,
Y
s
kip
);
cards
.
put
(
4121
,
Y
p
lus2
);
cards
.
put
(
4122
,
Y
p
lus2
);
cards
.
put
(
501
,
R0
);
cards
.
put
(
511
,
R1
);
...
...
@@ -176,17 +175,17 @@ public class Cards {
cards
.
put
(
582
,
R8
);
cards
.
put
(
591
,
R9
);
cards
.
put
(
592
,
R9
);
cards
.
put
(
5101
,
RRotate
);
cards
.
put
(
5102
,
RRotate
);
cards
.
put
(
5111
,
RSkip
);
cards
.
put
(
5112
,
RSkip
);
cards
.
put
(
5121
,
RPlus2
);
cards
.
put
(
5122
,
RPlus2
);
cards
.
put
(
5101
,
Rrotate
);
cards
.
put
(
5102
,
Rrotate
);
cards
.
put
(
5111
,
Rskip
);
cards
.
put
(
5112
,
Rskip
);
cards
.
put
(
5121
,
Rplus2
);
cards
.
put
(
5122
,
Rplus2
);
}
public
HashMap
getCardList
(){
return
cards
;
}
public
void
addCard
(
Integer
key
,
String
value
)
{
cards
.
put
(
key
,
value
);
}
...
...
@@ -198,4 +197,7 @@ public class Cards {
public
String
getCard
(
Integer
key
)
{
return
cards
.
get
(
key
);
}
public
void
printACard
(
Integer
key
){
System
.
out
.
println
(
getCard
(
key
));
}
}
src/Main.java
View file @
e5c08ae4
public
class
Main
{
// public static final String ANSI_RESET = "\u001B[0m";
// public static final String black = "\u001B[30m";
// public static final String red= "\u001B[31m";
// public static final String green = "\u001B[32m";
public
static
final
String
yellow
=
"\u001B[33m"
;
// public static final String blue= "\u001B[34m";
// public static final String purple= "\u001B[35m";
// public static final String cyan = "\u001B[36m";
// public static final String white = "\u001B[37m";
public
static
void
main
(
String
[]
args
)
{
Cards
cards
=
new
Cards
();
//System.out.println("\u23B8 \u23B9");
cards
.
printHand
();
System
.
out
.
println
(
"|"
);
Cards
cards
=
new
Cards
();
Repository
repository
=
new
Repository
();
repository
.
addCard
(
431
);
repository
.
addCard
(
521
);
repository
.
addCard
(
112
);
repository
.
addCard
(
121
);
repository
.
addCard
(
461
);
repository
.
addCard
(
361
);
repository
.
addCard
(
272
);
repository
.
addCard
(
2101
);
repository
.
addCard
(
401
);
repository
.
addCard
(
2111
);
repository
.
addCard
(
2121
);
repository
.
print
();
}
...
...
src/Repository.java
View file @
e5c08ae4
import
java.util.ArrayList
;
import
java.util.HashMap
;
public
class
Repository
{
public
static
final
String
black
=
"\u001B[30m"
;
public
static
final
String
red
=
"\u001B[31m"
;
public
static
final
String
green
=
"\u001B[32m"
;
public
static
final
String
yellow
=
"\u001B[33m"
;
public
static
final
String
blue
=
"\u001B[34m"
;
private
ArrayList
<
String
>
repository
;
private
Cards
cards
;
public
Repository
(){
cards
=
new
Cards
();
//cards.addCard(R0,);
public
Repository
()
{
repository
=
new
ArrayList
<>();
cards
=
new
Cards
();
}
public
void
addCard
(
Integer
key
)
{
repository
.
add
(
cards
.
getCard
(
key
));
}
public
String
getCard
(
int
key
)
{
return
cards
.
getCard
(
key
);
}
public
String
top
=
"\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513"
+
"\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513\u250F\u2501\u2501\u2501\u2513"
;
public
String
middle
=
"\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503\u2503 \u2503"
;
public
String
down
=
"\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B"
+
"\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B"
;
public
void
removeCard
(
String
card
)
{
repository
.
remove
(
card
);
}
public
String
getColor
(
String
card
){
if
(
card
.
contains
(
"\u001B[30m"
))
return
black
;
if
(
card
.
contains
(
"\u001B[33m"
))
return
yellow
;
if
(
card
.
contains
(
"\u001B[31m"
))
return
red
;
if
(
card
.
contains
(
"\u001B[32m"
))
return
green
;
if
(
card
.
contains
(
"\u001B[34m"
))
return
blue
;
else
return
black
;
}
public
void
print
()
{
for
(
String
card
:
repository
)
System
.
out
.
print
(
getColor
(
card
)+
"\u250F\u2501\u2501\u2501\u2513"
);
System
.
out
.
println
();
for
(
String
card
:
repository
)
System
.
out
.
print
(
card
);
System
.
out
.
println
();
for
(
String
card
:
repository
)
System
.
out
.
print
(
getColor
(
card
)
+
"\u2517\u2501\u2501\u2501\u251B"
);
}
}
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