lib/enjoy_markov.rb in enjoy_markov-0.0.1 vs lib/enjoy_markov.rb in enjoy_markov-0.0.2
- old
+ new
@@ -1,11 +1,19 @@
class EnjoyMarkov
- def self.start!(supinf=20)
- @@x = 0
- loop do
- @@x += [-1, 1].sample # TODO: use prefer randmGen
- raise 'ops.. ;(' if supinf == @@x.abs
- p %!#{"\s" * supinf}|#{"\s" * supinf}!.tap { |s| s[@@x + supinf] = '*' }
- sleep 0.05
+ class << self
+ def start!(supinf=20)
+ @@x = 0
+ loop do
+ @@x += [-1, 1].sample # TODO: use prefer randmGen
+ raise 'ops.. ;(' if supinf == @@x.abs
+ puts "#{wall}#{space * supinf}#{axis}#{space * supinf}#{wall}".tap { |s| s[@@x + supinf + 1] = point }
+ sleep 0.05
+ end
end
+
+ private
+ def axis; "|" end
+ def wall; "|" end
+ def point; "\e[31m*\e[0m" end
+ def space; "\s" end
end
end