Differences From Artifact [1f90031d9fb9c90a]:
File hangman/dict.retro part of check-in [f07b468712] - start using ^ rather than open the full vocabulary (hangman) by crc on 2010-11-16 18:20:14. [annotate] [view]
To Artifact [fbfedb99e670cbaf]:
File hangman/dict.retro part of check-in [25b3671a47] - use ^ in all areas of hangman by crc on 2010-11-16 19:45:38. [annotate] [view]
@@ -5,35 +5,33 @@
( Copyright [c] 2010, Marc Simpson )
( License: ISC )
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
-with files'
-
( --[ Variables ]--------------------------------------------- )
-: sys-dict "wordlist.txt" :r ;
+: sys-dict "wordlist.txt" ^files':r ;
variable dict 0 dict !
here 80 allot constant dict-word
variable dict-size
( --[ Access ]------------------------------------------------ )
-: open-dict ( -h ) sys-dict open dup 0 =if
+: open-dict ( -h ) sys-dict ^files'open dup 0 =if
cr "Error: can't open dictionary." puts then ;
: initialise ( - ) dict @ 0 =if open-dict 0; dup
- dict ! size dict-size ! then ;
+ dict ! ^files'size dict-size ! then ;
: rand-off ( -n ) dict-size @ ^math'toRandom ;
-: rand-pos ( -n ) rand-off dict @ seek drop ;
+: rand-pos ( -n ) rand-off dict @ ^files'seek drop ;
-: >line ( - ) repeat dict @ read 10 =if ;then again ;
-: fread! ( ha-f ) swap read dup rot ! ;
+: >line ( - ) repeat dict @ ^files'read 10 =if ;then again ;
+: fread! ( ha-f ) swap ^files'read dup rot ! ;
: readline ( - ) dict-word repeat dict @ over fread! drop
dup @ 10 =if 0 swap ! ;else 1+ then again ;
: rand-word ( - ) rand-pos >line readline ;
-: close-dict ( - ) dict @ close 0 =if
+: close-dict ( - ) dict @ ^files'close 0 =if
"Error: Can't close dictionary." puts then ;
( --[ Retrieval ]--------------------------------------------- )