100 doors: Difference between revisions

→‎{{header|ALGOL 68}}: Tweak the unoptimised version
imported>Grootson
(→‎{{header|ALGOL 68}}: Tweak the unoptimised version)
Line 946:
=={{header|ALGOL 68}}==
'''unoptimized'''
<syntaxhighlight lang="algol68"># declare some constants #
PROC doors = (INT limit)VOID:
INT limit = 100;
 
PROC doors = VOID:
(
MODE DOORSTATE = BOOL;
Line 960 ⟶ 958:
 
FOR i FROM LWB the doors TO UPB the doors DO
FOR j FROM LWB the doors BY i TO UPB the doors DO
IFthe doors[j] MOD i := 0NOT THENthe doors[j]
the doors[j] := NOT the doors[j]
FI
OD
OD;
FOR i FROM LWB the doors TO UPB the doors DO
printfprint(($gwhole(i,-12)," is "gl$,i,(the doors[i]|"opened"|"closed"),newline))
OD
);
doors;</syntaxhighlight>(100)
</syntaxhighlight>
'''optimized'''
<syntaxhighlight lang="algol68">PROC doors optimised = ( INT limit )VOID:
3,038

edits