lib/chess/board.rb
#returns the potential moves a rook can doo
returns the potential moves a rook can doo
returns the potential moves a rook can doo
def potential_moves
       pos_x = @position.first
       pos_y = @position.last
       positions = []
       (0...pos_x).each do |x|
         positions << [x, pos_y]
         end
      (pos_x...8).each do |x|
         positions << [x, pos_y]
       end
       (0...pos_y).each do |y|
         positions << [pos_x, y]
       end
       (pos_y...8).each do |y|
         positions << [pos_x, y]
       end
       positions.delete([pos_x, pos_y])
       return positions
    end
def potential_moves pos_x = @position . first pos_y = @position . last positions = [ ] ( 0 ... pos_x ) . each do | x | positions << [ x , pos_y ] end ( pos_x ... 8 ) . each do | x | positions << [ x , pos_y ] end ( 0 ... pos_y ) . each do | y | positions << [ pos_x , y ] end ( pos_y ... 8 ) . each do | y | positions << [ pos_x , y ] end positions . delete ( [ pos_x , pos_y ] ) return positions end
returns the potential moves a rook can doo
returns the potential moves a rook can doo