Class: ConnectN::HumanPlayer
- Defined in:
- lib/connect_n/player/human_player/human_player.rb
Instance Attribute Summary collapse
-
#save_key ⇒ Object
Returns the value of attribute save_key.
Attributes inherited from Player
Instance Method Summary collapse
-
#initialize(name: 'Human', disc: '🔥', save_key: ':w') ⇒ HumanPlayer
constructor
A new instance of HumanPlayer.
- #pick ⇒ Object
Constructor Details
#initialize(name: 'Human', disc: '🔥', save_key: ':w') ⇒ HumanPlayer
Returns a new instance of HumanPlayer.
11 12 13 14 |
# File 'lib/connect_n/player/human_player/human_player.rb', line 11 def initialize(name: 'Human', disc: '🔥', save_key: ':w') @save_key = save_key super name: name, disc: disc end |
Instance Attribute Details
#save_key ⇒ Object
Returns the value of attribute save_key.
9 10 11 |
# File 'lib/connect_n/player/human_player/human_player.rb', line 9 def save_key @save_key end |
Instance Method Details
#pick ⇒ Object
16 17 18 19 |
# File 'lib/connect_n/player/human_player/human_player.rb', line 16 def pick input = PROMPT.ask('Please enter a column number : ') input == save_key ? input : input.to_i - 1 end |