This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def forward | |
puts "forward" | |
end | |
def backward | |
puts "backward" | |
end | |
def right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@coordinates = [0, 0] | |
@fired_at = [] | |
end | |
def forward | |
end | |
def backward |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@coordinates = [0, 0] | |
@fired_at = [] | |
end | |
def forward(n) | |
@coordinates[0] += n | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@coordinates = [0, 0] | |
@fired_at = [] | |
end | |
def forward(n) | |
@coordinates[0] += n | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@coordinates = [0, 0] | |
@fired_at = [] | |
end | |
def forward(n) | |
@coordinates[0] += n | |
puts @coordinates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@coordinates = [0, 0] | |
@fired_at = [] | |
end | |
def forward(n) | |
@coordinates[0] += n | |
puts @coordinates, "-----" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
def initialize | |
@coordinates = [0, 0] | |
@fired_at = [] | |
end | |
def forward(n) | |
@coordinates[0] += n | |
puts @coordinates, "-----" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install eventmachine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
class Echo < EM::Connection | |
def receive_data(data) | |
send_data(data) | |
end | |
end | |
EM.run do | |
EM.start_server("0.0.0.0", 1337, Echo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
telnet 127.0.0.1 1337 |