20 lines
624 B
Text
20 lines
624 B
Text
···
|
|
http://rosettacode.org/wiki/100_doors
|
|
···
|
|
■ HundredDoors
|
|
§ static
|
|
▶ main
|
|
• args⦂ String[]
|
|
open⦂ boolean: true
|
|
closed⦂ boolean: false
|
|
doors⦂ boolean[1+100] · all initially closed
|
|
🔁 pass from 1 to 100
|
|
∀ visited ∈ pass‥100 by pass
|
|
· toggle the visited doors
|
|
if the doors[visited] are closed
|
|
let the doors[visited] be open
|
|
else
|
|
let the doors[visited] be closed
|
|
for each door #n in doors⦂ boolean
|
|
if the door is open
|
|
System.out.println "Door #⸨n⸩ is open."
|