Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
34
Task/100-doors/GFA-Basic/100-doors.gfa
Normal file
34
Task/100-doors/GFA-Basic/100-doors.gfa
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
'
|
||||
' 100 doors problem
|
||||
'
|
||||
DIM doors!(101) ! use indices 1 to 100
|
||||
@close_doors
|
||||
@do_passes
|
||||
@show_doors
|
||||
'
|
||||
PROCEDURE close_doors
|
||||
ARRAYFILL doors!(),FALSE
|
||||
RETURN
|
||||
'
|
||||
PROCEDURE do_passes
|
||||
LOCAL i%,j%
|
||||
FOR i%=1 TO 100
|
||||
FOR j%=i% TO 100 STEP i%
|
||||
doors!(j%)=NOT doors!(j%)
|
||||
NEXT j%
|
||||
NEXT i%
|
||||
RETURN
|
||||
'
|
||||
PROCEDURE show_doors
|
||||
LOCAL i%
|
||||
OPENW 1
|
||||
CLEARW 1
|
||||
FOR i%=1 TO 100
|
||||
IF doors!(i%)
|
||||
PRINT "Door ";i%;" is open"
|
||||
ENDIF
|
||||
NEXT i%
|
||||
PRINT "(press a key to end program)"
|
||||
~INP(2)
|
||||
CLOSEW 1
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue