Skip to content

Instantly share code, notes, and snippets.

@loqi
loqi / 0.2.1-boggle_class_from_methods.rb
Last active December 29, 2015 07:59 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
module Comparable
def not_below(n) self < n ? n : self ; end
def not_above(n) self > n ? n : self ; end
end
class BoggleBoard
attr_reader :width, :height, :vert_range, :horiz_range, :diag_range
def initialize(grid)
@width , @height = grid.first.length , grid.length
raise ArgumentError.new("BoggleBoard needs rectangular array of one-char strings."
) unless ( @width > 0 && @height > 0 &&