On Jan 15, 2005, at 4:41 AM, Kero wrote: >> The second strategy used was to treat each digit as a series of >> segments that >> can be "on" or "off". The numbers easily break down into seven >> positions: >> >> 6 >> 5 4 >> 3 >> 2 1 >> 0 >> >> Using that map, we can convert the two above to a binary digit, and >> some did: >> >> 0b1011101 > [snip] > > So why not use: > > LCD = [ > "-|| ||-", # 0 > " | | ", > "- |-| -", > "- |- |-", > " ||- | ", > "-| - |-", # 5 > "-| -||-", > "-|| | ", > "-||-||-", > "-||- |-", > ] > > catching the bits and the shapes at the same time. Well, it's trivial to infer the "-" or "|" from the position of the bit, but to directly answer your question, some did: http://www.io.com/~jimm/rubyquiz/quiz14/ http://ruby-talk.com/blade/126180 >> The third strategy caught my eye, so I'll examine it here. Let's look >> at the primary class of Dale Martenson's solution: >> >> class LCD >> attr_accessor( :size, :spacing ) >> >> # >> # This hash is used to define the segment display for the # given >> digit. Each entry in the array is associated with # the following >> states: >> # >> # HORIZONTAL >> # VERTICAL >> # HORIZONTAL >> # VERTICAL >> # HORIZONTAL >> # DONE > > My main program looked like > > hor(0) > ver(1, 2) > hor(3) > ver(4, 5) > hor(6) > > replacing the statemachine. > > Ah well. This was actually the first Ruby Quiz I made. > Partially because it looked like it was really short to work out. > Thanks! Thank you for following along. > (perhaps next time I'll even submit it :) I hope you will. We can't learn great tricks from it if you don't share. James Edward Gray II