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