Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
live-coding-fr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Admin message
Gitlab will be unavailable Friday, April 11 at 12:00 a.m. for an update.
Show more breadcrumbs
twitch
live-coding-fr
Merge requests
!23
Resolve "format trivia"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "format trivia"
26-format-trivia
into
master
Overview
0
Commits
1
Pipelines
0
Changes
26
Merged
Colin DAMON
requested to merge
26-format-trivia
into
master
4 years ago
Overview
0
Commits
1
Pipelines
0
Changes
26
Expand
Closes
#26 (closed)
Edited
4 years ago
by
Colin DAMON
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
0915e0b9
1 commit,
4 years ago
26 files
+
971
−
986
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
26
Search (e.g. *.vue) (Ctrl+P)
ugly-trivia/src/main/java/com/adaptionsoft/games/uglytrivia/Answer.java
+
24
−
25
Options
package
com.adaptionsoft.games.uglytrivia
;
public
class
Answer
{
private
final
Notifications
notifications
;
private
final
AnswerRandomSimulator
answerRandom
;
public
Answer
(
Notifications
notifications
,
AnswerRandomSimulator
answerRandom
)
{
this
.
notifications
=
notifications
;
this
.
answerRandom
=
answerRandom
;
}
private
final
Notifications
notifications
;
private
final
AnswerRandomSimulator
answerRandom
;
public
Player
answer
(
Player
player
)
{
if
(!
answerRandom
.
isRight
())
{
return
wrongAnswer
(
player
)
;
}
public
Answer
(
Notifications
notifications
,
AnswerRandomSimulator
answerRandom
)
{
this
.
notifications
=
notifications
;
this
.
answerRandom
=
answerRandom
;
}
return
goodAnswer
(
player
);
public
Player
answer
(
Player
player
)
{
if
(!
answerRandom
.
isRight
())
{
return
wrongAnswer
(
player
);
}
private
Player
goodAnswer
(
Player
player
)
{
if
(!
player
.
isInPenaltyBox
())
{
notifications
.
correctAnswer
();
player
=
player
.
addCoin
();
notifications
.
actualGoldCoins
(
player
.
getName
(),
player
.
getPurse
());
}
return
player
;
}
return
goodAnswer
(
player
);
}
private
Player
wrongAnswer
(
Player
player
)
{
notifications
.
incorrectlyAnswered
();
notifications
.
sendInPenaltyBox
(
player
.
getName
());
return
player
.
inPenaltyBox
();
private
Player
goodAnswer
(
Player
player
)
{
if
(!
player
.
isInPenaltyBox
())
{
notifications
.
correctAnswer
();
player
=
player
.
addCoin
();
notifications
.
actualGoldCoins
(
player
.
getName
(),
player
.
getPurse
());
}
return
player
;
}
private
Player
wrongAnswer
(
Player
player
)
{
notifications
.
incorrectlyAnswered
();
notifications
.
sendInPenaltyBox
(
player
.
getName
());
return
player
.
inPenaltyBox
();
}
}
Loading