/**************************************************************************\
|*                                                                        *|
|* The Wheel of Fortune, v6.0; SETUP MODULE, by DOTORAN of Frontiers BBS! *|
|*                                                                        *|
\**************************************************************************/
options results ; tr=transmit ; se=sendstring ; gu=getuser
changewhere 'WOF, v6.0 SETUP' ; oldwh=result
tr 'f1n1cfPlease hold... ceSetting Up cbWheel of Fortunec6...'
call open(f1,'pfiles:WoFortune.Config','r') ; do 2 ; j=readln(f1) ; end
dfile=readln(f1) ; call close(f1) ; gu 1 ; handle=result ; a=handle||'|0|0|1|0|0|0|0|0|x'
b='No One|0|x' ; c='No One|NO PUZZLE YET|19931114|x' ; d='No One|NO PUZZLE YET|19931114|0|x'
e='No One|NO PUZZLE YET|19931114|0|0|x' ; f='0|No One|No Where|0|0|x'
consonants=0 ; vowels=0 ; cons='BCDFGHJKLMNPQRSTVWXYZ' ; vows='AEIOU' ; da=date('s')
dateL=date('m',da,'s')||' '||strip(right(da,2),'l','0')||', '||left(da,4)
tr '[4;1Hc6Creatingc9: cdPlayers[K' ; call open(f1,dfile||'Players','w') ; call writeln(f1,a) ; call close(f1)
tr '[4;1Hc6Creatingc9: cbStats[K' ; call open(f1,dfile||'Stats','w') ; do i=1 to 6 ; call writeln(f1,b) ; end i ; call close(f1)
tr '[4;1Hc6Creatingc9: cdWinners[K' ; call open(f1,dfile||'Winners','w') ; call writeln(f1,c) ; call close(f1)
tr '[4;1Hc6Creatingc9: cbBwinners[K' ; call open(f1,dfile||'BWinners','w') ; call writeln(f1,d) ; call close(f1)
tr '[4;1Hc6Creatingc9: cdWinner[K' ; call open(f1,dfile||'Winner','w') ; call writeln(f1,e) ; call close(f1)
tr '[4;1Hc6Creatingc9: cbBWinner[K' ; call open(f1,dfile||'BWinner','w') ; call writeln(f1,e) ; call close(f1)
tr '[4;1Hc6Creatingc9: cdLastPlayer[K' ; call open(f1,dfile||'LastPlayer','w') ; call writeln(f1,f) ; call close(f1)
se '[6;1H c6Readingc9: ca' ; call open(f1,dfile||'PuzData','r') ; total=strip(readch(f1,5),'t',d2c(0))
do i=1 to total ; se right(i,4,'-')'<4' ; p.i=readch(f1,90) ; end i
call close(f1) ; tot=total%2 ; do k=7 to 1 by -1 ; se '[8;1Hc6Mixing cf'||k||'c9: cbShuffle c7[    ][K<5ca'
do i=1 to tot ; a=random(1,total) ; b=random(1,total)
c=p.a ; p.a=p.b ; p.b=c ; se right(i,4,'-')'<4' ; end i
se '>6c9Cut c7[    ]<5ca' ; do i=1 to tot
j=tot+i ; c=p.i ; p.i=p.j ; p.j=c ; se right(i,4,'-')'<4' ; end i
end k ; se '[10;1Hc6 Writingc9: ca'
call open(f1,dfile||'PuzData','w') ; call writech(f1,left(total,5,d2c(0)))
do i=1 to total ; se right(i,4,'-')'<4' ; call writech(f1,left(p.i,90,d2c(0))) ; end i
call close(f1) ; call open(f1,dfile||'PuzData','r') ; call seek(f1,5,'b')
p=strip(readch(f1,50),'t',d2c(0)) ; c=strip(readch(f1,20),'t',d2c(0))
a=strip(readch(f1,20),'t',d2c(0)) ; call close(f1)
puzzle=translate(p,reverse(xrange('!','~')),xrange('!','~'))
clue=translate(c,reverse(xrange('!','~')),xrange('!','~'))
author=translate(a,reverse(xrange('!','~')),xrange('!','~'))
a1=puzzle ; puz=translate(puzzle,,xrange('A','Z'),'@') ; puz1=puz
ans=translate(a1,reverse(xrange('!','~')),xrange('!','~'))
puz=translate(puz,reverse(xrange('!','~')),xrange('!','~'))
aut=translate(author,reverse(xrange('!','~')),xrange('!','~'))
clu=translate(clue,reverse(xrange('!','~')),xrange('!','~'))
do i=1 to length(a1) ; z=substr(a1,i,1)
if index(cons,z)>0 then consonants=consonants+1
if index(vows,z)>0 then vowels=vowels+1
end i ; a2=consonants'|'vowels'|x' ; call open(f1,dfile||'GameData','w')
call writeln(f1,'1') ; call writeln(f1,puz) ; call writeln(f1,ans) ; call writeln(f1,'')
call writeln(f1,clu) ; call writeln(f1,aut||'|2|'||total||'|x') ; call writeln(f1,a2)
call close(f1) ; log.1='cfNEW cbGame c6Started Onc9: cb'||dateL
log.2='cf     The NEW Puzzlec9: ce'||puz1 ; log.3='cf    NEW Puzzle Cluec9: ca'||clue
log.4='cf  NEW Puzzle Authorc9: cd'||author ; log.5='cc'||right('cf'||dateL,78,'=')||'cc==='
logs=5 ; a='ANS IBM ASC' ; do i=1 to 3 ; b=subword(a,i,1) ; f='Log.NEW.'||b
call open(f1,dfile||f,substr('wa',exists(dfile||f)+1,1)) ; do j=1 to logs
if i=1 then call writeln(f1,log.j) ; if i=2 then call writeln(f1,translate(log.j,'ÄÍ','-='))
if i=3 then do ; do until c=0 ; c=index(log.j,'') ; if c>0 then log.j=delstr(log.j,c,3) ; end
call writeln(f1,log.j) ; end ; end j ; call close(f1) ; end i
tr 'n2cfThanks! cbWheel of Fortune ceSetUp Complete!' ; changewhere (oldwh)
/* Completed: November 11, 1993              Frontiers BBS (716)/823-9892 */
