Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SEPVorprojekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Isabell Sophie Hans
SEPVorprojekt
Commits
6d0a8053
Commit
6d0a8053
authored
1 year ago
by
Isabell Hans
Browse files
Options
Downloads
Patches
Plain Diff
selfPossible integrated in other method
parent
9a9b65ae
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Game/Cards/Card.java
+1
-33
1 addition, 33 deletions
src/Game/Cards/Card.java
with
1 addition
and
33 deletions
src/Game/Cards/Card.java
+
1
−
33
View file @
6d0a8053
...
...
@@ -83,39 +83,6 @@ public class Card {
public
void
play
(
Scanner
scanner
,
ArrayList
<
Player
>
players
,
Player
turn
,
Deck
deck
,
Card
firstCard
)
{
}
/**
* This method is used to select a player which can also be the current player
*
* @param scanner The scanner used in the calling method
* @param players The list of players to play with
* @param turn The player whose turn it is
* @return The choosen player
*/
public
Player
choosePlayerInclSelf
(
Scanner
scanner
,
ArrayList
<
Player
>
players
,
Player
turn
)
{
if
(!
playerExists
(
players
,
turn
))
{
System
.
out
.
println
(
"There are no players to choose from. Your card is discarded without effect."
);
return
null
;
}
System
.
out
.
println
(
"Who do you choose?"
);
String
name
=
scanner
.
nextLine
();
boolean
found
=
false
;
while
(!
found
)
{
for
(
Player
p
:
players
)
{
if
(
p
.
getName
().
equals
(
name
)
&&
!
p
.
isProtected
()
&&
p
.
isActive
())
{
Player
player
=
players
.
get
(
players
.
indexOf
(
p
));
found
=
true
;
if
(
p
.
equals
(
turn
))
{
System
.
out
.
println
(
"You selected yourself"
);
}
return
player
;
}
}
System
.
out
.
println
(
"You can't choose this one. Try again: "
);
name
=
scanner
.
nextLine
();
}
return
null
;
}
/**
* This method is used to select a player which cannot be the player whose turn
* it is
...
...
@@ -123,6 +90,7 @@ public class Card {
* @param scanner The scanner used in the calling method
* @param players The list of players to play with
* @param turn The player whose turn it is
* @param selfPossible True if the player is allowed to select his/her self
* @return The choosen player
*/
public
Player
choosePlayer
(
Scanner
scanner
,
ArrayList
<
Player
>
players
,
Player
turn
,
boolean
selfPossible
)
{
...
...
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