Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#minatork01
#!/usr/bin/env ruby
cols = (ARGV[0] || 5).to_i - 1
rows = (ARGV[1] || 9).to_i
begin
table = (0...rows).map do |i|
(0...cols).map { rand(2) }.join
end
end until table.join =~ /1/
table.map! do |r|
r.gsub /11/, '10'
end
name = 'A'
(0..cols).each do
print name + (' ' * (4 - name.length))
name.succ!
end
puts
table.each do |r|
puts "|" + r.gsub(/1/, "---|").gsub(/0/, " |")
end
atari = rand(cols+1) * 4
puts " " * atari + '!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.