-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refacto(*): Remove deprecated methods
- Loading branch information
Showing
3 changed files
with
36 additions
and
76 deletions.
There are no files selected for viewing
62 changes: 35 additions & 27 deletions
62
src/main/java/com/adaptionsoft/games/trivia/runner/GameRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,44 @@ | ||
|
||
package com.adaptionsoft.games.trivia.runner; | ||
|
||
import com.adaptionsoft.games.uglytrivia.*; | ||
|
||
import java.util.List; | ||
import java.util.Random; | ||
|
||
import com.adaptionsoft.games.uglytrivia.Game; | ||
import static java.util.Arrays.asList; | ||
|
||
|
||
public class GameRunner { | ||
|
||
private static boolean notAWinner; | ||
|
||
public static void main(String[] args) { | ||
Game aGame = new Game(); | ||
|
||
aGame.add("Chet"); | ||
aGame.add("Pat"); | ||
aGame.add("Sue"); | ||
|
||
Random rand = new Random(1L); | ||
|
||
do { | ||
|
||
aGame.roll(rand.nextInt(5) + 1); | ||
|
||
if (rand.nextInt(9) == 7) { | ||
notAWinner = aGame.wrongAnswer(); | ||
} else { | ||
notAWinner = aGame.wasCorrectlyAnswered(); | ||
} | ||
|
||
|
||
|
||
} while (notAWinner); | ||
|
||
} | ||
private static final int NB_CELLS = 12; | ||
private static final int NB_QUESTIONS = 50; | ||
private static final List<Category> CATEGORIES = asList(Category.POP, Category.SCIENCE, Category.SPORTS, Category.ROCK); | ||
private static final List<String> PLAYERS = asList("Chet", "Pat", "Sue"); | ||
|
||
public static void main(String[] args) { | ||
Game aGame = new Game( | ||
System.out, | ||
new Board(NB_CELLS, CATEGORIES), | ||
new QuestionDeck(NB_QUESTIONS, CATEGORIES), | ||
new PlayerList(PLAYERS) | ||
); | ||
|
||
Random rand = new Random(1L); | ||
|
||
boolean notAWinner; | ||
do { | ||
|
||
aGame.roll(rand.nextInt(5) + 1); | ||
|
||
if (rand.nextInt(9) == 7) { | ||
notAWinner = aGame.wrongAnswer(); | ||
} else { | ||
notAWinner = aGame.wasCorrectlyAnswered(); | ||
} | ||
|
||
|
||
} while (notAWinner); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters