Class: PlayerOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/player_options.rb

Constant Summary collapse

HUMAN_VS_HUMAN =
"Human vs Human"
HUMAN_VS_AI =
"Human vs Ai"
AI_VS_HUMAN =
"Ai vs Human"
ID_TO_PLAYER_TYPE =
{
  1 => HUMAN_VS_HUMAN,
  2 => HUMAN_VS_AI,
  3 => AI_VS_HUMAN
}

Class Method Summary collapse

Class Method Details

.allObject



27
28
29
# File 'lib/player_options.rb', line 27

def self.all
  ID_TO_PLAYER_TYPE
end

.display_player_optionsObject



20
21
22
23
24
25
# File 'lib/player_options.rb', line 20

def self.display_player_options
  player_options_for_display = ID_TO_PLAYER_TYPE.each_pair.map do |id, option|
    open_bracket + id.to_s + close_bracket + space + option
  end
  player_options_for_display.join(comma + space)
end

.player_type_for_id(id) ⇒ Object



16
17
18
# File 'lib/player_options.rb', line 16

def self.player_type_for_id(id)
  game_value_of_player = ID_TO_PLAYER_TYPE.fetch(id)
end

.valid_idsObject



12
13
14
# File 'lib/player_options.rb', line 12

def self.valid_ids
  ID_TO_PLAYER_TYPE.keys
end