My submission uses extreme (in)elegance ;) in accordance with this
weeks quiz saying "don't think, let the computer think for you"

I'm submitting several versions, one full version that includes the
extra credit, and several "golf" versions

Enjoy!

--Kyle

First we have this version
#########begin########### 42 lines long
elegance = nil

#########################

to100 = Hash.new()

@setlength=9#set, starting from 1 to use

@maxops=@setlength-1#the maximum number of operators (including space)
in any equation

@operator = ["", "+", "-"]

@oplength = @operator.length

keylength = @oplength.power!(@maxops)



def bogoGen()

  little=Array.new(@setlength+@maxops) do

    |i|

    if i.modulo(2)==0 then

      i=i/2

      i+=1

    else

      i=@operator[rand(@oplength)]

    end

  end

  return(little.join)

end



writingHamlet = Time.now()



while to100.keys.length<keylength

  elegance = bogoGen()

  to100.store(elegance,eval(elegance))

  #puts "Found #{to100.keys.length} formulas" if to100.keys.length%100==0

end



millionMonkeys = Time.now()



to100.sort.each do

  |answer|

  fortytwo=answer[1]==100?'*':' '

  #display the answer!

  puts "#{fortytwo} #{answer[0]}=#{answer[1]} #{fortytwo}"

end



willFinish = Time.now()

#puts "Total calculation time: #{millionMonkeys - writingHamlet} seconds"

#puts "Total run time:         #{willFinish - writingHamlet} seconds"
#####end ######




#compact v1
t={}

while t.length<(6561)

  e = Array.new(17){|i| i=i%2==0?i/2+1:["","+","-"][rand(3)]}.join

  t.store(e,eval(e))

end

t.sort.each {|a| f=a[1]==100?'*':' '; puts "#{f} #{a[0]}=#{a[1]} #{f}"}

#compact v2
t={}

while t.length<(6561)

  t.store(Array.new(17){|i| i=i%2==0?i/2+1:["","+","-"][rand(3)]}.join,'')

end

t.sort.each {|a| f=eval(a[0])==100?'*':' '; puts "#{f}
#{a[0]}=#{eval(a[0])} #{f}"}

#compact v3
t=Array.new(6561){|i|i}

t.each_index{|a| while t[a]=Array.new(17){|i|
i=i%2==0?i/2+1:["","+","-"][rand(3)]}.join and not
t.length==t.uniq.length;end}

t.sort.each {|a| f=eval(a)==100?'*':' '; puts "#{f} #{a}=#{eval(a)} #{f}"}