Skip to content

Instantly share code, notes, and snippets.

@wb4r
wb4r / simulator.rb
Created October 23, 2015 11:41
Robot Simulator Challenge - Ruby
require 'pry'
class Robot
attr_reader :compass
def initialize
@compass = [:north, :east, :south, :west]
@facing_to = true
@x_axis = []
@y_axis = []
@wb4r
wb4r / triplet.rb
Created October 8, 2015 10:14
Pithagorean Triplet
class Triplet
attr_reader :alfa, :bravo, :charlie
def initialize(alfa, bravo, charlie)
@alfa = alfa
@bravo = bravo
@charlie = charlie
end
def sum
@wb4r
wb4r / ocr.rb
Created October 3, 2015 12:20
Exercism's OCR Numbers - Ruby
class OCR
attr_accessor :text
OCR_DB = {
[' _ ', '| |', '|_|'] => '0',
[' ', ' |', ' |'] => '1',
[' _ ', ' _|', '|_ '] => '2',
[' _ ', ' _|', ' _|'] => '3',
[' ', '|_|', ' |'] => '4',
[' _ ', '|_ ', ' _|'] => '5',
class SecretHandshake
def initialize(input)
@data = input
@solution = []
end
def commands
unless @data.to_i == 0
@data = @data.to_s(2)