Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
assignment1.0
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
qingyuw2
assignment1.0
Commits
e83c27e9
Commit
e83c27e9
authored
4 years ago
by
qingyuw2
Browse files
Options
Downloads
Patches
Plain Diff
misc added
parent
8ff907a6
Branches
assignment1.2
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
out/production/assignment1.0/Player/Player.class
+0
-0
0 additions, 0 deletions
out/production/assignment1.0/Player/Player.class
src/Deck/Deck.java
+2
-0
2 additions, 0 deletions
src/Deck/Deck.java
src/Player/Player.java
+15
-0
15 additions, 0 deletions
src/Player/Player.java
with
17 additions
and
0 deletions
out/production/assignment1.0/Player/Player.class
+
0
−
0
View file @
e83c27e9
No preview for this file type
This diff is collapsed.
Click to expand it.
src/Deck/Deck.java
+
2
−
0
View file @
e83c27e9
...
...
@@ -60,6 +60,8 @@ public class Deck {
}
deck
.
add
(
new
ActionCard
(
3
,
4
));
deck
.
add
(
new
ActionCard
(
4
,
4
));
deck
.
add
(
new
ActionCard
(
5
,
i
));
deck
.
add
(
new
ActionCard
(
6
,
i
));
}
}
...
...
This diff is collapsed.
Click to expand it.
src/Player/Player.java
+
15
−
0
View file @
e83c27e9
...
...
@@ -83,6 +83,21 @@ public class Player {
if
(
hand
.
get
(
color
).
size
()
>
0
)
{
ret
.
addAll
(
hand
.
get
(
color
));
}
ret
.
addAll
(
returnIfNumberMatch
(
card
));
if
(
ret
.
size
()
==
0
&&
hand
.
get
(
4
).
size
()
>
0
)
{
ret
.
addAll
(
hand
.
get
(
4
));
}
return
ret
;
}
/**
* Helper function to return a list of card that number or action is matched.
* @param card card to be compared with
* @return Arraylist of cards that matched with card by number or action.
*/
private
ArrayList
<
Card
>
returnIfNumberMatch
(
Card
card
)
{
ArrayList
<
Card
>
ret
=
new
ArrayList
<
Card
>();
int
color
=
card
.
getColor
();
int
number
=
card
instanceof
NumberCard
?
((
NumberCard
)
card
).
getNumber
()
:
((
ActionCard
)
card
).
getAction
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
if
(
i
==
color
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment