72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/tres_bot.rb', line 72
def self.execute_command(robot,command)
@robot = robot
command = command.split(' ')
if command[0] != nil
if command[0].downcase == 'place'
if place_command_valid?(command)
full_position = command[1].split(',')
@robot.place(full_position)
else
puts "Your place command is invalid. Please try again."
end
elsif ['move', 'report','left','right'].include? command[0].downcase
@robot.is_on_the_table ? @robot.send(command[0].downcase) : (puts "Put me on the table!")
end
end
end
|