Class: Computer
- Inherits:
-
Object
- Object
- Computer
- Defined in:
- lib/connect_four_2211/computer.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#piece ⇒ Object
readonly
Returns the value of attribute piece.
Instance Method Summary collapse
- #give_input ⇒ Object
-
#initialize ⇒ Computer
constructor
A new instance of Computer.
Constructor Details
#initialize ⇒ Computer
Returns a new instance of Computer.
4 5 6 7 |
# File 'lib/connect_four_2211/computer.rb', line 4 def initialize @input = nil @piece = "O" end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
2 3 4 |
# File 'lib/connect_four_2211/computer.rb', line 2 def input @input end |
#piece ⇒ Object (readonly)
Returns the value of attribute piece.
2 3 4 |
# File 'lib/connect_four_2211/computer.rb', line 2 def piece @piece end |
Instance Method Details
#give_input ⇒ Object
9 10 11 12 |
# File 'lib/connect_four_2211/computer.rb', line 9 def give_input valid_input = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] @input = valid_input.sample end |