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
# Rule 1: Farthest from the door | |
# Rule 2: Dont stand next to occupied | |
# Rule 3: Dont stand between 2 dudes | |
# Except: If line => Ignore 2 & 3 | |
# Except: If 2 or 3 is broken, ignore them | |
def which_stall(stalls, line) | |
if line || rules_broken?(stalls) | |
return furthest_empty(stalls) | |
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
require 'time' | |
class BerlinClock | |
ON = '*' | |
OFF = '.' | |
def initialize(time) | |
@time = time | |
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
require 'rrobots' | |
class Gml_robot | |
include Robot | |
INIT_SCAN_DEG = 60 | |
CLOSE_ENOUGH_DEG = 5 | |
MAX_GUN_TURN_DEG = 30 | |
def initialize() |
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
source 'https://rubygems.org' | |
gem 'celluloid' | |
gem 'celluloid-io' |