Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Project3_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
9831113
Project3_Uno
Commits
c579398c
Commit
c579398c
authored
Apr 16, 2020
by
amir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
point of cards and each player
parent
7eb21396
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
10 deletions
+42
-10
Black.java
Black.java
+5
-0
Card.java
Card.java
+5
-1
Main.java
Main.java
+14
-9
Movemention.java
Movemention.java
+5
-0
Numeric.java
Numeric.java
+5
-0
Player.java
Player.java
+8
-0
No files found.
Black.java
View file @
c579398c
...
@@ -17,4 +17,9 @@ public class Black extends Card {
...
@@ -17,4 +17,9 @@ public class Black extends Card {
"blackType="
+
blackType
+
"blackType="
+
blackType
+
'}'
;
'}'
;
}
}
@Override
public
int
getCardPoint
()
{
return
50
;
}
}
}
Card.java
View file @
c579398c
...
@@ -3,7 +3,7 @@ package com.company;
...
@@ -3,7 +3,7 @@ package com.company;
public
class
Card
{
public
class
Card
{
protected
String
cardColor
;
protected
String
cardColor
;
private
boolean
isSeen
=
false
;
private
boolean
isSeen
=
false
;
private
int
cardPoint
;
public
Card
(
String
color
){
public
Card
(
String
color
){
this
.
cardColor
=
color
;
this
.
cardColor
=
color
;
}
}
...
@@ -25,4 +25,8 @@ public class Card {
...
@@ -25,4 +25,8 @@ public class Card {
public
void
setSeen
(
boolean
seen
)
{
public
void
setSeen
(
boolean
seen
)
{
isSeen
=
seen
;
isSeen
=
seen
;
}
}
public
int
getCardPoint
()
{
return
cardPoint
;
}
}
}
Main.java
View file @
c579398c
...
@@ -72,22 +72,27 @@ public class Main {
...
@@ -72,22 +72,27 @@ public class Main {
/*for (int i = 0; i < 108; i++){
/*for (int i = 0; i < 108; i++){
System.out.println(cards.get(i).toString());
System.out.println(cards.get(i).toString());
}*/
}*/
Random
r
=
new
Random
();
Random
r
=
new
Random
();
int
next
;
ArrayList
<
Player
>
players
=
new
ArrayList
<>();
ArrayList
<
Player
>
players
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<
5
;
i
++)
{
for
(
int
i
=
1
;
i
<
5
;
i
++)
{
Player
p
=
new
Player
();
Player
p
=
new
Player
();
players
.
add
(
p
);
players
.
add
(
p
);
for
(
int
j
=
1
;
j
<
8
;
j
++){
for
(
int
j
=
1
;
j
<
8
;
j
++){
if
(
cards
.
get
(
r
.
nextInt
(
108
)).
isSeen
()){
next
=
r
.
nextInt
(
cards
.
size
());
do
{
p
.
getPlayerCards
().
add
(
cards
.
get
(
next
));
r
.
nextInt
(
108
);
cards
.
remove
(
next
);
}
while
(
cards
.
get
(
r
.
nextInt
(
108
)).
isSeen
());
//System.out.println("cardNumber = " + next);
}
p
.
getPlayerCards
().
add
(
cards
.
get
(
r
.
nextInt
(
108
)));
cards
.
get
(
r
.
nextInt
(
108
)).
setSeen
(
false
);
}
}
p
.
printAllCards
(
i
);
//p.printAllCards(i);
}
// first random card from the storage of cards
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
players
.
get
(
i
).
printAllCards
(
i
+
1
);
System
.
out
.
println
(
players
.
get
(
i
).
getPlayerPoint
());
}
}
next
=
r
.
nextInt
(
cards
.
size
());
// unicode of black color: "\033[0;30m"
// unicode of black color: "\033[0;30m"
// unicode of red color: "\033[0;31m"
// unicode of red color: "\033[0;31m"
// unicode of green color: "\033[0;32m"
// unicode of green color: "\033[0;32m"
...
...
Movemention.java
View file @
c579398c
...
@@ -16,4 +16,9 @@ public class Movemention extends Colored {
...
@@ -16,4 +16,9 @@ public class Movemention extends Colored {
public
String
toString
()
{
public
String
toString
()
{
return
"cardColor='"
+
cardColor
+
'\''
+
'}'
;
return
"cardColor='"
+
cardColor
+
'\''
+
'}'
;
}
}
@Override
public
int
getCardPoint
()
{
return
20
;
}
}
}
Numeric.java
View file @
c579398c
...
@@ -12,4 +12,9 @@ public class Numeric extends Colored {
...
@@ -12,4 +12,9 @@ public class Numeric extends Colored {
return
"Numeric{ Color="
+
cardColor
+
return
"Numeric{ Color="
+
cardColor
+
", number="
+
number
+
'}'
;
", number="
+
number
+
'}'
;
}
}
@Override
public
int
getCardPoint
()
{
return
number
;
}
}
}
Player.java
View file @
c579398c
...
@@ -20,4 +20,12 @@ public class Player {
...
@@ -20,4 +20,12 @@ public class Player {
}
}
System
.
out
.
println
();
System
.
out
.
println
();
}
}
public
int
getPlayerPoint
()
{
Iterator
<
Card
>
cardIterator
=
playerCards
.
iterator
();
while
(
cardIterator
.
hasNext
()){
playerPoint
+=
cardIterator
.
next
().
getCardPoint
();
}
return
playerPoint
;
}
}
}
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