Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created March 23, 2015 21:55
Show Gist options
  • Save pumpkincouture/422bb4ffe89b4982b136 to your computer and use it in GitHub Desktop.
Save pumpkincouture/422bb4ffe89b4982b136 to your computer and use it in GitHub Desktop.
# GameRunner before
public class GameRunner {
public static void main(String[] args) {
SetUpGame setup = new SetUpGame();
setup.startGame();
}
}
# GameRunner after
public class GameRunner {
public static void main(String[] args) {
PrintStream output = new PrintStream(System.out);
Scanner input = new Scanner(System.in);
UserInterface ui = new CommandLineInterface(output, input);
List<Configurable> userChoices= new ArrayList<>();
Configurable boardConfig = new BoardSize((CommandLineInterface) ui);
Configurable playerConfig = new ParticipantChoice((CommandLineInterface) ui);
Configurable orderConfig = new ParticipantOrder((CommandLineInterface) ui);
userChoices.add(boardConfig);
userChoices.add(playerConfig);
userChoices.add(orderConfig);
InputCollector inputCollector = new InputCollector();
inputCollector.collectUserInput(userChoices);
SetUpTicTacToeGame setup = new SetUpTicTacToeGame(inputCollector.getUserValues());
setup.setUpGame();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment