home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 7 Games
/
07-Games.zip
/
hangman1.zip
/
texthang.cmd
< prev
Wrap
OS/2 REXX Batch file
|
1996-03-12
|
944b
|
45 lines
/* Plane English text -> hangman data */
/* TEXTHANG.CMD by The Creative CAT 1996 */
if arg() < 1 then do
say 'Usage : TEXTHANG source destination min max'
exit
end
arg sourcefile destfile minch maxch
count = 0
do while (lines(sourcefile) = 1) & (count < 10000)
s = linein(sourcefile)
ii = words(s) - 1
do i = 2 to ii
w = translate(word(s, i))
b = verify(w, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
l = length(w)
if (b = 0) & (l >= minch) & (l <= maxch) then do
call lineout 'hangman.$$1', w
count = count + 1
end
end
end
call stream sourcefile, 'C', 'close'
call stream 'hangman.$$1', 'C', 'close'
'sort < hangman.$$1 > hangman.$$2'
erase 'hangman.$$1'
ss = ''
do while lines('hangman.$$2') = 1
s = linein('hangman.$$2')
if \(s = ss) then do
call lineout destfile, s
ss = s
end
end
call stream 'hangman.$$2', 'C', 'close'
erase 'hangman.$$2'