RosettaCodeData/Task/100-doors/UTFool/100-doors.utfool
2023-07-01 13:44:08 -04:00

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."