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
91785b0f
Commit
91785b0f
authored
Apr 20, 2020
by
amir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some bugs detected
parent
a408c34f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
Comp.java
Comp.java
+2
-0
Human.java
Human.java
+2
-0
Main.java
Main.java
+48
-2
No files found.
Comp.java
View file @
91785b0f
...
...
@@ -16,6 +16,7 @@ public class Comp extends Player {
}
else
{
c
=
randomPunishmentCard
(
cards
);
cards
.
remove
(
c
);
getPlayerCards
().
add
(
c
);
if
(
c
instanceof
Colored
)
{
if
(
card
instanceof
Colored
)
{
...
...
@@ -62,6 +63,7 @@ public class Comp extends Player {
else
{
System
.
out
.
println
(
"kirekhar"
);
c
=
randomPunishmentCard
(
cards
);
cards
.
remove
(
c
);
System
.
out
.
println
(
c
.
toString
());
getPlayerCards
().
add
(
c
);
if
(
c
instanceof
Colored
)
{
...
...
Human.java
View file @
91785b0f
...
...
@@ -26,6 +26,7 @@ public class Human extends Player {
System
.
out
.
println
(
"gaav!"
);
}
card
=
getPlayerCards
().
get
(
number
-
1
);
cards
.
remove
(
card
);
getPlayerCards
().
remove
(
number
-
1
);
return
card
;
}
else
{
...
...
@@ -81,6 +82,7 @@ public class Human extends Player {
}
}
else
{
card
=
randomPunishmentCard
(
cards
);
cards
.
remove
(
card
);
getPlayerCards
().
add
(
card
);
if
(
card
instanceof
Colored
)
{
if
(!
card
.
cardColor
.
equals
(
Color
))
{
...
...
Main.java
View file @
91785b0f
...
...
@@ -5,9 +5,9 @@ import java.util.Iterator;
import
java.util.Random
;
public
class
Main
{
static
Card
previousCard
=
null
;
static
int
drawCounter
;
static
ArrayList
<
Card
>
cards
=
new
ArrayList
<>();
public
static
void
main
(
String
[]
args
)
{
ArrayList
<
Card
>
cards
=
new
ArrayList
<>();
String
Color
;
String
Color1
;
for
(
int
i
=
1
;
i
<
5
;
i
++)
{
...
...
@@ -150,6 +150,7 @@ public class Main {
nextColor
=
players
.
get
(
turns
).
chooseColorIfBlack
(
card
);
if
(
nextColor
==
null
)
nextCard
=
card
;
}
if
(
nextColor
==
null
)
System
.
out
.
println
(
nextCard
.
toString
());
...
...
@@ -198,4 +199,49 @@ public class Main {
System.out.println("|");
}*/
}
public
static
void
switches
(
Card
next
,
int
turns
,
int
move
,
ArrayList
<
Player
>
players
){
if
(
previousCard
instanceof
Draw
){
drawCounter
+=
2
;
if
(
next
instanceof
Draw
)
drawCounter
+=
2
;
else
{
for
(
int
i
=
1
;
i
<=
drawCounter
;
i
++)
players
.
get
(
turns
).
getPlayerCards
().
add
(
randomCard
());
turns
+=
move
;
drawCounter
=
0
;
}
}
if
(
previousCard
instanceof
WildDraw
){
drawCounter
+=
4
;
if
(
next
instanceof
Draw
){
drawCounter
+=
2
;
}
else
{
if
(
next
instanceof
WildDraw
){
drawCounter
+=
4
;
}
else
{
for
(
int
i
=
1
;
i
<=
drawCounter
;
i
++)
players
.
get
(
turns
).
getPlayerCards
().
add
(
randomCard
());
turns
+=
move
;
drawCounter
=
0
;
}
}
}
if
(
next
instanceof
Reverse
)
move
*=
-
1
;
else
{
if
(
next
instanceof
Skip
)
turns
+=
move
;
System
.
out
.
println
(
"Player"
+
(
turns
+
1
)
+
"'s turns skipped"
);
}
previousCard
=
next
;
}
public
static
Card
randomCard
(){
Random
r
=
new
Random
();
int
next
=
r
.
nextInt
(
cards
.
size
());
return
cards
.
get
(
next
);
}
}
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