From: Brad Phelan Date: 2006-07-26T00:20:11+09:00 Subject: Re: there has got to be a better way... Michael Barinek wrote: > i'm looking to simplify the below... > > @tournament.rounds = Array.new(4) { Round.new } > > @tournament.rounds[0].matches = Array.new(8) { Match.new } > @tournament.rounds[1].matches = Array.new(4) { Match.new } > @tournament.rounds[2].matches = Array.new(2) { Match.new } > @tournament.rounds[3].matches = Array.new(1) { Match.new } > > thoughts/suggestions? > for i in 0..3 @tournament.rounds[i] = Array.new( 1 << ( 3 - i ) ) { Match. new } end perhapps. -- Brad Phelan http://xtargets.com