Created
September 24, 2014 15:31
-
-
Save pumpkincouture/e9f96d10e718cb17265d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class SetUp | |
attr_reader :player, :human_player, :ui, :board | |
def create_instances | |
@human_player = HumanPlayer.new | |
@ui = UserInterface.new | |
end | |
def choose_board | |
@ui.prompt_for_board | |
board_choice = @ui.get_board_choice | |
if board_choice.to_i != 0 | |
@board = Board.new(@ui, board_choice) | |
else | |
@ui.print_player_error | |
self.choose_board | |
end | |
@board | |
end | |
def choose_player | |
@ui.prompt_for_player_type | |
player_choice = @ui.get_player_choice | |
if player_choice == "E" | |
@player = ComputerPlayer.new | |
elsif player_choice == "H" | |
@player = IntelComputerPlayer.new | |
else | |
@ui.print_player_error | |
self.choose_player | |
end | |
@player | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment