From: Matthew Moss Date: 2008-07-14T04:50:19+09:00 Subject: Re: Symbolify (#169) Shindo-san, I think I understand the basic idea you were attempting to code, but you might want to revise it; as it is written below, it doesn't quite work. On Jul 12, 11:43 pm, SHINDO Motoaki wrote: > #!/usr/bin/env ruby -Ku > > #Oh, by the way... You may only use the characters `?`, `*`, `(`, `)`   > and `-`. > #s > #Specifically, define a function `symbolify` that accepts an integer > #and returns a string composed of only the five characters shown above. > #The string, when evaluated, will equal the original number passed in. > > def init >         str = ':?:*:(:):-' >         5.times { |i| >                 letters[i] = str[i] >         } > end #init > > def symb1(i) >         s = "" >         p = i / 5 > #       p = (i.abs) / 5 >         unless p < 1 >                 symb1(p) >         end >         q = i.mod(5) > >         s += letters(q) > end > > def symbolify(i) > letters = [] >         init > >         puts i >         symb1(i) > #       symb2(i) > end > > puts symbolify(ARGV[1].to_i) >