Horton Hears a Foo

Mar 14, 2017 00:00 · 120 words · 1 minute read foo

Foo

A foo is thing. A marvelous thing. But a foo is not a bar, and therefore:

$$qux=\frac{\pi}{\sqrt{2}}$$

And more stuff, carefully avoiding any mention of baz — (oops) — and then a random code snippet:

#!/usr/bin/ruby -w

Fib = Hash.new{|h,n| n<2 ? h[n]=n : h[n] = h[n-1] + h[n-2]}

def fibicle(n,dia=[])
  return dia if n == 0
  cols, rows = Fib[n+1], Fib[n]
  cols, rows = rows, cols if n%2 != 0
  cols *= 2
  (0..rows).each{dia << [" "]*cols} if dia.empty?
  (0..cols).each{|i|dia[0][i]    = i%2!=0?"_":" "}    # top
  (0..cols).each{|i|dia[rows][i] = i%2!=0?"_":" "}    # bottom
  dia[1..rows].each{|row| row[0],row[cols] = "|","|"} # sides
  fibicle(n-1,dia)
end

fibicle(ARGV[0].to_i).each{|r|puts r.join}

and that’s all folks.

This was just a random first test post, left here for posterity

__END__