Skip to content

Conversation

@Slavunderkind
Copy link
Owner

#5

@Slavunderkind Slavunderkind requested review from a user and vasil-gochev January 12, 2017 12:14
@Slavunderkind Slavunderkind force-pushed the master branch 4 times, most recently from b8e5d88 to 73f6435 Compare January 17, 2017 14:56
@Slavunderkind Slavunderkind force-pushed the power_of_thor_solution branch from 9ba0df4 to ca817fb Compare January 17, 2017 14:58
@@ -7,58 +7,52 @@ def initialize
@light_x, @light_y, @x, @y = gets.split(' ').collect(&:to_i)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't call gets here. Instead, call it from outside the object and give it to an argument to the initialize method

loop do
remaining_turns = gets.to_i # The remaining amount of turns Thor can move. Do not remove this line.
puts find_direction
find_direction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_direction does something else than just finding a direction

def move_north
self.y -= 1
if x == light_x
puts 'N'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take the puts statements out of all of the move_ methods - make the methods return the string value, and then use puts inside the loop. The reason is that if you change the way you output (in this case, puts), you will have to refactor all of the move_ methods, as opposed to just changing it in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants