Excuse me again(^_^;)
Thanks to the post;
--> On 2008/07/14, at 10:45, Rick DeNatale wrote:
being inspired&encouraged, I made refinements to my code;
Still I failed to convince eval() to back my string to original numbers,
but some folks're talk 'bout ASCII codes, I'm not too far to the punch ine.
# but after long long the other-way-'round, sigh
Making wish this help somebody.
# I'm now going to sleep
== source follows ==
#!/usr/bin/env ruby -Ku
Base = 5
def i_to_penta(i, penta)
# think of only Positive numbers
p = i / Base
if 0 < i
q = i % Base
penta << q
if p < Base
penta << p
else
i_to_penta(p, penta)
end
end
end
def penta_to_sym(penta)
outlet = []
# penta.reverse.each { |msd|
penta.each { |msd|
case msd
when 0
# outlet << '('
# outlet << '-'
outlet << '?'
when 1
# outlet << ')'
outlet << '*'
when 2
# outlet << '('
# outlet << '*'
outlet << '-'
when 3
# outlet << '?'
# outlet << '-'
# outlet << '*'
outlet << '('
# outlet << ')'
when 4
# outlet << '('
outlet << ')'
# outlet << '?'
# outlet << '-'
else
outlet << '!'
end
}
outlet
end
def symb1(i)
penta = Array.new
i_to_penta(i, penta)
outlet = penta_to_sym(penta)
end
def symbolify(i)
outlet = symb1(i)
#outlet
s = outlet.to_s
end
puts symbolify(ARGV[0].to_i)
== source ends ==
=============================
ContextSwitcher
Shindo Motoakira
<motoakira / mac.com>
=============================