Dear David, Thanks for this.
I'm happy to use idiomatic Scheme concepts. Are you able to make this a function which can work for n doors? Example: http://programming.dojo.net.nz/languages/cpp/index Kind regards, Samuel On 4/05/2010, at 3:31 PM, David Mitchell wrote: > Doh! Was only playing with 10 doors. This makes it 100. > > | count doors | > count := 100. > "Initialize the array of doors to 0 (closed)" > doors := (Array new: count) atAllPut: false. > > "Process the doors" > 1 to: count do: > [ :pass | > pass to: count by: pass do: > [ :door | > doors > at: door > put: (doors at: door) not ] ]. > > "Print out the results" > 1 to: count do: > [ :n | > Transcript > show: 'door #', n, ' is '; > show: ((doors at: door) ifTrue: [#open] ifFalse: [#closed]); > cr] > _______________________________________________ > Beginners mailing list > Beginners@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners