Class: Computer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeComputer

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

#inputObject (readonly)

Returns the value of attribute input.



2
3
4
# File 'lib/connect_four_2211/computer.rb', line 2

def input
  @input
end

#pieceObject (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_inputObject



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