Sha256: 0c9f2b44ccacdf4228ebaf3a9ac84af441f28d678fc2a4a82eeb22e13c30561d
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
require_relative 'human_player' require_relative 'computer_player_expert' require_relative 'computer_player_novice' module MM class PlayersFactory < Shared::PlayersFactory def generate_players player_1 = generate_player_1 [player_1] end def generate_player_1 code_guesser = io_helpers.computer_or_human_guesser_inquiry if code_guesser == :human generate_player_1_new else computer_knowledge_level = io_helpers.get_computer_knowledge_level if computer_knowledge_level == :novice generate_player_1_computer_novice else generate_player_1_computer_expert end end end def generate_player_1_new player_name = io_helpers.get_player_1_name MM::HumanPlayer.new(name: player_name) end def generate_player_1_computer_novice MM::ComputerPlayerNovice.new(name: "Computer") end def generate_player_1_computer_expert MM::ComputerPlayerExpert.new(name: "Computer") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
games_bfox-0.4.0 | lib/games/mastermind/players_factory.rb |