Created
June 2, 2012 17:35
-
-
Save grimrose/2859293 to your computer and use it in GitHub Desktop.
amida
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
T1 = '| ' | |
T2 = '|---' | |
width = 5 | |
if ARGV[0] != nil | |
number = ARGV[0].to_i | |
if number > 52 | |
number = 52 | |
end | |
width = number | |
end | |
p 'player number is ' + width.to_s | |
max = width - 1 | |
# header | |
array = ("A" .. "Z").to_a | |
size = array.size | |
header = " " | |
width.times.map{ |i| array[i % size] }.each_with_index{ |elem, index| | |
cell = "" | |
cell << elem | |
if (index / size) == 1 | |
cell << "'" | |
else | |
cell << " " | |
end | |
if index < max | |
cell << " " | |
else | |
cell << " " | |
end | |
header << cell | |
} | |
p header | |
# body | |
height = 10 | |
height.times{ | |
line = " " | |
before = "" | |
max.times { | |
cell ="" | |
if before == T2 | |
cell = T1 | |
else | |
cell = [T1, T2].sample | |
end | |
before = cell | |
line << cell | |
} | |
line << '| ' | |
p line | |
} | |
# footer | |
footer = "" | |
point = Random.rand(width) | |
width.times{ |k| | |
if k == point | |
footer << "!!! " | |
else | |
footer << " " | |
end | |
} | |
p footer |
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
"player number is 5" | |
" A B C D E " | |
" |---| | | | " | |
" |---| | | | " | |
" |---| | | | " | |
" |---| | |---| " | |
" |---| | |---| " | |
" |---| | | | " | |
" |---| | |---| " | |
" |---| | | | " | |
" | |---| |---| " | |
" |---| |---| | " | |
" !!! " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment