Created
July 5, 2009 16:33
-
-
Save hitode909/141026 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
def getnewline(line, rule) | |
(0..(line.size-1)).map { |i| | |
rule[line[i-1..i+1].join.to_i(2)] # 端がおかしくなりそう | |
} | |
end | |
token = ARGV.first.to_i || raise | |
rule = (0..7).map{|i| token[i]} | |
line = Array.new(80, 0) | |
line[40] = 1 | |
40.times do | |
puts line.map{|i| [' ', '*'][i]}.join(' ') + '|' | |
line = getnewline(line, rule) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment