home *** CD-ROM | disk | FTP | other *** search
- /* $VER: Greed 2.0.2 (5/2/95) by Spike Dethman
- */
- /**********************/
- /* Greed 2.0 */
- /* From The Codex BBS */
- /* Atlanta, GA */
- /* (770) 473 - 6173 */
- /* Written by */
- /* Fizban & Cregan */
- /* 3/5/92 3:12am. */
- /* Re-told from the */
- /* original Latin by */
- /* Spike */
- /* for C-Net BBS */
- /**********************/
- options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
-
- bonustime=15 ; /* <<< minutes awarded for making the Top 5 */
- call GetPaths
-
- INIT:
- tr=transmit ; gc=getchar ; gu=getuser
- changewhere 'caBeing GREEDY!'
- gu 1 ; handle=result ; gu 40 ; acctnum=result
- gu 28 ; term=result
- spaces=' '
- seed=random(,,time(s))
- fn='GreedIntro' ; call FILEOUT
-
- PLAY:
- /* re-sense term in case ET'd during game! */
- gu 28 ; term=result
- gu 27 ; width=result
- sp2=0 ; sp='' ; if width>59 then do ; sp2=20 ; sp=' ' ; end
- bufferflush ; c=0 ; b=0 ; gt=0 ; tr 'n1'
- tr sp'cc[I]nstructions' ; tr sp'[V]iew High Scores' ; tr sp'[S]ingle Hand
- Game' ; tr sp'[F]ull Game to 5,000' ; tr sp'[C-Net command]' ; tr sp'[Q]uit'
- query 'n1ca'||sp||' Your Choice?cf ' ; call GCCHECK
- ans=upper(ans)
-
- if ans='I' then do
- call INSTRUCT
- signal PLAY
- end
- if ans='V' then do
- call SHOWHIGHS
- call SHOWSHIGHS
- call WAIT
- signal PLAY
- end
- if ans='S' then do
- gs=1 ; gt=0
- tr sp'OK, a Single Hand Game.n1'
- signal MAIN
- end
- if ans='F' then do
- gs=0 ; gt=4999
- tr sp'OK, a Game to 5,000.n1'
- signal MAIN
- end
-
- if ans='Q' then signal QUIT
-
- BBSCOMMAND ans ; signal PLAY ; /* try to execute C-Net command */
- MAIN:
- b=0 ; c=0 ; a=0 ; tr sp'ccLet Me Get The Dice, 'handle'!n1w2' ; hl=0
- L14:
- a=0 ; cs=0 ; sb=0 ; j1=0 ; i2=0 ; od=1 ; it=1 ; bs=1
-
- L18:
- f=6 ; od=1 ; if hl>0 then tr 'n1cc'handle"'s Last Turn:w2" ; signal L22
- tr 'n1cc'handle"'s Turn:"
- L22:
- call ROLLDICE
- L24:
- call L94 ; if bs=2 then signal L36
- call L110 ; call L118 ; if it=2 then signal L24
- if f=0 then tr "can1You get to roll ALL 6 Again!!b1"
- bufferflush ; tr "n1caAre You still GREEDY?" ; gc ; call GCCHECK2 ; tr
- if ans~='Y' then signal L38
- if od=2 then signal L18
- signal L22
-
- L36:
- tr sp"c9You Busted! Ha Ha! A bit too GREEDY!b2w2"
- L38:
- tr "n1"sp"cbTotal for the Hand "a" Points" ; c=c+a
- if gs~=1 then tr 'n1cbThe Score is: You '||c||' to Me '||b
- if gs=1 then do ;
- tr sp"Single Hand Total= "c ; call CHECKHI ; signal PLAY
- end
- if hl=1 then signal L86
-
- if c>gt then do ; tr "n1ccComputer's Last Turn:w2" ; signal L46 ; end
- tr "n1ccComputer's Turn:"
- L46:
- bs=1 ; d=a ; a=0
- L48:
- f=6
- L50:
- od=1 ; call ROLLDICE ; call L94
- if bs=2 then do
- tr sp"c9Computer was too GREEDY!b2w2" ; signal L68 ; end
- call L142 ; call L118
- if (c>gt) & (c>b+a) then signal L60
- if (c>gt) & (c<b+a) then signal L74
- if (f~=0)&(a~<1000) then signal L74
- if (f~=0)&(a~<400)&(f<3) then signal L74
- if (f~=0)&(a<400)&(f<3) then signal L74
- /* if (f~=0)&((a>=1000)|((a>=400)&(f<3))|((a<400)&(f<3))) then signal L74 */
- L60:
- tr "n1caComputer is still GREEDY!n1w2"
- if od=2 then signal L48
- else signal L50
-
- L74:
- tr 'n1'sp'ccComputer keeps this hand 'a ; b=b+a ; signal L68
- L68:
- if a<d then tr sp"caYou won this hand "d" to "a
- if a=d then tr sp"ccHand is a TIE "a" TO "d
- if a>d then tr sp"caComputer won this hand "a" TO "d
- L80:
- tr 'n1ccTotal scores:' ; tr handle' Has 'c', Computer Has' b
- if hl>0 then signal L86
- if c>gt then signal L86
- if b>gt then do ; hl=1 ; signal L14 ; end
-
- LOOP:
- bufferflush ; tr "ccReady for the Next Hand?" ; gc ; call GCCHECK2 ; tr
- if ans='Y' then signal L14
- bufferflush ; tr 'Do you really want to quit?' ; gc ; call GCCHECK2
- if ans~='N' then signal PLAY
- signal L14
-
- L86:
- if c>b then do
- tr sp'c9You WON!' c 'To' b
- call CHECKHI
- signal PLAY
- end
- if c<b then do
- tr sp'cbComputer WON!' b 'To' c
- signal PLAY
- end
- signal LOOP
-
- L94:
- do i=1 to 6 ; a2.i=0 ; end i
- call SHOWDICE
- do k = 1 to f
- i9=di.k ; a2.i9 = a2.i9 + 1 ; end k
- if (a2.1~=0)|(a2.5~=0) then signal L108
- if (a2.2>2)|(a2.3>2) then signal L108
- if (a2.4>2)|(a2.6>2) then signal L108
- a=0 ; bs=2
- L108:
- return
-
- L110:
- do i=1 to 6 ; a.i=0 ; end i ; j1=0
- do k=1 to f
-
- bufferflush
- if term=2 then tr ''||k*11-1+((6-f)*5)||'HccRemove?cbg1'
- else tr sp"ccRemove die "k"? cbg1"
- gu 71 ; call GCCHECK
- if ans='Y' then do ; j1=j1+1 ; a.j1=di.k ; end
- end k ; return
-
- L118:
- tr
- if j1=0 then signal ILLEGAL
- if j1=1 then tr sp"cbRemoved "a.1
- if j1=2 then tr sp"cbRemoved "a.1" "a.2
- if j1=3 then tr sp"cbRemoved "a.1" "a.2" "a.3
- if j1=4 then tr sp"cbRemoved "a.1" "a.2" "a.3" "a.4
- if j1=5 then tr sp"cbRemoved "a.1" "a.2" "a.3" "a.4" "a.5
- if j1=6 then tr sp"cbRemoved "a.1" "a.2" "a.3" "a.4" "a.5" "a.6
- do i=1 to j1 ; i9=a.i ; ao.i9=ao.i9 + 1 ; end i
- STR6:
- if j1~=6 then signal STR5
- if (ao.1~=1)|(ao.2~=1)|(ao.3~=1)|(ao.4~=1)|(ao.5~=1)|(ao.6~=1)then signal ONES
- tr sp"c9A 6 Die Straight! :2000 pts" ; sb=sb+2000 ; signal TOTAL
-
- STR5:
- if (j1~=5)|(f~=5) then signal ONES
- if (ao.2~=1)|(ao.3~=1)|(ao.4~=1)|(ao.5~=1) then signal ONES
- if (ao.1=1)|(ao.6=1) then do ; tr sp" c9A 5 Die Straight! :1500 pts"
- sb=sb+1500 ; signal TOTAL ; end
-
- ONES:
- tr 'cc'
- if ao.1=1 then do ; tr sp"One 1 : 100 pts" ; sb=sb+100 ; signal TWOS ; end
- if ao.1=2 then do ; tr sp"Two 1's : 200 pts" ; sb=sb+200 ; signal TWOS ; end
- if ao.1=3 then do ; tr sp"Three 1's :1000 pts"
- sb=sb+1000 ; signal TWOS ; end
- if ao.1=4 then do ; tr sp"Four 1's :1100 pts"
- sb=sb+1100 ; signal TWOS ; end
- if ao.1=5 then do ; tr sp"Five 1's :1200 pts"
- sb=sb+1200 ; signal TWOS ; end
- if ao.1=6 then do ; tr sp"Six 1's :2000 pts"
- sb=sb+2000 ; signal TOTAL ; end
-
- TWOS:
- if ao.2=1 then do ; tr sp"One 2 : illegal" ; signal ILLEGAL ; end
- if ao.2=2 then do ; tr sp"Two 2's : illegal" ; signal ILLEGAL ; end
- if ao.2=3 then do ; tr sp"Three 2's : 200 pts"
- sb=sb+200 ; signal THREES ; end
- if ao.2=4 then do ; tr sp"Four 2's : illegal" ; signal ILLEGAL ; end
- if ao.2=5 then do ; tr sp"Five 2's : illegal" ; signal ILLEGAL ; end
- if ao.2=6 then do ; tr sp"Six 2's : 400 pts"
- sb=sb+400 ; signal TOTAL ; end
-
- THREES:
- if ao.3=1 then do ; tr sp"One 3 : illegal" ; signal ILLEGAL ; end
- if ao.3=2 then do ; tr sp"Two 3's : illegal" ; signal ILLEGAL ; end
- if ao.3=3 then do ; tr sp"Three 3's : 300 pts"
- sb=sb+300 ; signal FOURS ; end
- if ao.3=4 then do ; tr sp"Four 3's : illegal" ; signal ILLEGAL ; end
- if ao.3=5 then do ; tr sp"Five 3's : illegal" ; signal ILLEGAL ; end
- if ao.3=6 then do ; tr sp"Six 3's : 600 pts"
- sb=sb+600 ; signal TOTAL ; end
-
- FOURS:
- if ao.4=1 then do ; tr sp"One 4 : illegal" ; signal ILLEGAL ; end
- if ao.4=2 then do ; tr sp"Two 4's : illegal" ; signal ILLEGAL ; end
- if ao.4=3 then do ; tr sp"Three 4's : 400 pts"
- sb=sb+400 ; signal FIVES ; end
- if ao.4=4 then do ; tr sp"Four 4's : illegal" ; signal ILLEGAL ; end
- if ao.4=5 then do ; tr sp"Five 4's : illegal" ; signal ILLEGAL ; end
- if ao.4=6 then do ; tr sp"Six 4's : 800 pts"
- sb=sb+800 ; signal TOTAL ; end
-
- FIVES:
- if ao.5=1 then do ; tr sp"One 5 : 50 pts" ; sb=sb+50 ; signal SIXES ; end
- if ao.5=2 then do ; tr sp"Two 5's : 100 pts"
- sb=sb+100 ; signal SIXES ; end
- if ao.5=3 then do ; tr sp"Three 5's : 500 pts"
- sb=sb+500 ; signal SIXES ; end
- if ao.5=4 then do ; tr sp"Four 5's : 550 pts"
- sb=sb+550 ; signal SIXES ; end
- if ao.5=5 then do ; tr sp"Five 5's : 600 pts"
- sb=sb+600 ; signal SIXES ; end
- if ao.5=6 then do ; tr sp"Six 5's :1000 pts"
- sb=sb+1000 ; signal TOTAL ; end
-
- SIXES:
- if ao.6=1 then do ; tr sp"One 6 : illegal" ; signal ILLEGAL ; end
- if ao.6=2 then do ; tr sp"Two 6's : illegal" ; signal ILLEGAL ; end
- if ao.6=3 then do ; tr sp"Three 6's : 600 pts"
- sb=sb+600 ; signal TOTAL ; end
- if ao.6=4 then do ; tr sp"Four 6's : illegal" ; signal ILLEGAL ; end
- if ao.6=5 then do ; tr sp"Five 6's : illegal" ; signal ILLEGAL ; end
- if ao.6=6 then do ; tr sp"Six 6's :1200 pts"
- sb=sb+1200 ; signal TOTAL ; end
-
- TOTAL:
- a=sb+a
- tr sp"cbScore = "a ; sb=0
- do i=1 to 6 ; ao.i=0 ; end i ; f=f-j1
- if f=0 then od=2
- it=1 ; j1=0 ; return
-
- L142:
- do i=1 to 6 ; a4.i=0 ; end i
- do k=1 to f ; i9=di.k ; a4.i9=a4.i9 + 1 ; end k
- do i=1 to 6 ; a.i=0 ; a3.i=0 ; end i ; j1=0
- do k=1 to f
- dk=di.k ; ans="Y"
- if (dk~=1)&(dk~=5)&(a4.dk<3) then ans='N'
- if (dk~=1)&(dk~=5)&(a4.dk<6)&(a3.dk>2) then ans='N'
- if f=6 & a4.1=1 & a4.2=1 & a4.3=1 & a4.4=1 & a4.5=1 then ans='Y'
- if f=5 & a4.2=1 & a4.3=1 & a4.4=1 & a4.5=1 then ans='Y'
- if ans='Y' then do ; a3.dk=a3.dk +1 ; j1=j1 +1 ; a.j1=di.k ; end
- end k ; return
-
- ILLEGAL:
- sb=0 ; tr "c9You are not allowed to select that combination of dice."
- bufferflush ; tr "cbDo you need to see the rules?" ; gc ; call GCCHECK2
- if ans~='Y' then signal L240
- INSTRUCT:
- fn='GreedRules' ; call FILEOUT
- L240:
- it=2 ; do i=1 to 6 ; ao.i=0 ; end i ; j1=0 ; return
-
- SHOWDICE:
- if term=1 then signal CGTERM
- if term=2 then signal ANSITERM
- signal NOTERM
- CGTERM:
- /* C=C/G term */
- tr 'f1}'
- do f2=1 to f ; f1=f-f2+1 ; call DOCGDIE ; end f2
- transmit
- return
- DOCGDIE:
- col = f1*6-5+((6-f)*3)+sp2 ; lab='CGDIE'||di.f1 ; signal (lab)
- CGDIE1:
- tr 'f0}cf'||left(spaces,col)||'r1 r0'
- tr left(spaces,col)||'r1 o r0'
- tr left(spaces,col)||'r1 r0'
- tr 'n1'||left(spaces,col)||'cc-'||f1||'-'
- return
- CGDIE2:
- tr 'f0}cf'||left(spaces,col)||'r1o r0'
- tr left(spaces,col)||'r1 r0'
- tr left(spaces,col)||'r1 or0'
- tr 'n1'||left(spaces,col)||'cc-'||f1||'-'
- return
- CGDIE3:
- tr 'f0}cf'||left(spaces,col)||'r1 or0'
- tr left(spaces,col)||'r1 o r0'
- tr left(spaces,col)||'r1o r0'
- tr 'n1'||left(spaces,col)||'cc-'||f1||'-'
- return
- CGDIE4:
- tr 'f0}cf'||left(spaces,col)||'r1o or0'
- tr left(spaces,col)||'r1 r0'
- tr left(spaces,col)||'r1o or0'
- tr 'n1'||left(spaces,col)||'cc-'||f1||'-'
- return
- CGDIE5:
- tr 'f0}cf'||left(spaces,col)||'r1o or0'
- tr left(spaces,col)||'r1 o r0'
- tr left(spaces,col)||'r1o or0'
- tr 'n1'||left(spaces,col)||'cc-'||f1||'-'
- return
- CGDIE6:
- tr 'f0}cf'||left(spaces,col)||'r1o or0'
- tr left(spaces,col)||'r1o or0'
- tr left(spaces,col)||'r1o or0'
- tr 'n1'||left(spaces,col)||'cc-'||f1||'-'
- return
-
- ANSITERM:
- tr 'f1}'
- do f1=1 to f ; call DOANSIDIE
- end f1 ; return
- DOANSIDIE:
- col=f1 * 11 - 1 + ((6 - f) * 5)
- lab='ANSIDIE'||di.f1
- signal (lab)
- ANSIDIE1:
- tr ''||col||'Hcf███████'
- tr ''||col||'H███▀███'
- tr ''||col||'H███████'
- tr ''||col||'H▀▀▀▀▀▀▀'
- return
-
- ANSIDIE2:
- tr ''||col||'Hcf█▀█████'
- tr ''||col||'H███████'
- tr ''||col||'H█████▀█'
- tr ''||col||'H▀▀▀▀▀▀▀'
- return
-
- ANSIDIE3:
- tr ''||col||'Hcf█████▀█'
- tr ''||col||'H███▀███'
- tr ''||col||'H█▀█████'
- tr ''||col||'H▀▀▀▀▀▀▀'
- return
-
- ANSIDIE4:
- tr ''||col||'Hcf█▀███▀█'
- tr ''||col||'H███████'
- tr ''||col||'H█▀███▀█'
- tr ''||col||'H▀▀▀▀▀▀▀'
- return
-
- ANSIDIE5:
- tr ''||col||'Hcf█▀███▀█'
- tr ''||col||'H███▀███'
- tr ''||col||'H█▀███▀█'
- tr ''||col||'H▀▀▀▀▀▀▀'
- return
-
- ANSIDIE6:
- tr ''||col||'Hcf█▀███▀█'
- tr ''||col||'H█▀███▀█'
- tr ''||col||'H█▀███▀█'
- tr ''||col||'H▀▀▀▀▀▀▀'
- return
-
- NOTERM:
- /* ASCII term: */
- tr "n1"sp"ccDie #1 #2 #3 #4 #5 #6cf"
- if f=1 then tr sp" "di.1
- if f=2 then tr sp" "di.1" "di.2
- if f=3 then tr sp" "di.1" "di.2" "di.3
- if f=4 then tr sp" "di.1" "di.2" "di.3" "di.4
- if f=5 then tr sp" "di.1" "di.2" "di.3" "di.4" "di.5
- if f=6 then tr sp" "di.1" "di.2" "di.3" "di.4" "di.5" "di.6
- tr sp" k1-----------------k0"
- return
-
- ROLLDICE:
- if f=1 then tr sp"cc Rolling a Single Die...w2"
- else tr sp"cc Rolling "f" Dice...w2"
- do i=1 to 6 ; di.i=random(1,6) ; ao.i=0 ; end i ; return
- SHOWSHIGHS:
- tr 'n1'sp'ca Single Hand Game'
- fn="GreedFive-sh" ; call READHIGH ; call SHOWFIVE
- return
-
- SHOWHIGHS:
- fn="GreedFive"
- tr 'n1'sp'ca Full Game of 5,000'
- call READHIGH ; call SHOWFIVE ; return
-
- READHIGH:
- if ~exists(GreedPath||fn) then do
- call open(f1,GreedPath||fn,'w')
- do x=1 to 5
- call writeln(f1,"Nobody Yet!") ; call writeln(f1,"0") ; call writeln(f1,"0")
- end x ; call close(f1)
- end
-
- call open(f1,GreedPath||fn,'r')
- do x=1 to 5
- do y=1 to 3
- zp.x.y=readln(f1)
- end y
- end x ; call close(f1)
- return
-
- SHOWFIVE:
- tr sp"cbCurrent Top Five Greed Champions:"
- tr sp" NAME TOTAL SCORE!"
- do x=1 to 5
- tr sp'<'||x||'> '||left(zp.x.1' ',20)zp.x.2
- end x
- return
-
- WAIT:
- bufferflush ; tr "n1ccPress Return: g1n1" ; return
-
- CHECKHI:
- fn="GreedFive" ; if gs=1 then fn="GreedFive-sh"
- call READHIGH
- x=0 ; gp=c ; if gp<=0 then signal L288
- L276:
- x=x+1 ; if x>5 then signal L288
- z=5 ; if zp.x.2=0 then signal L283
- if gp<zp.x.2 then signal L276
-
- L283:
- z1=z-1
- do y=1 to 3
- zp.z.y=zp.z1.y
- end y
- z=z-1 ; if z~<x then signal L283
-
- zp.x.1=handle ; zp.x.2=gp ; zp.x.3=acctnum
- tr "n1c9Congratulations! You Are One Of The Top 5 Players!b3w2"
- if bonustime>0 then do
- tr 'And you get' bonustime 'EXTRA MINUTES THIS CALL!'
- addtime bonustime
- end
- call open(f1,GreedPath||fn,'w')
- do x=1 to 5
- do y=1 to 3
- call writeln(f1,zp.x.y)
- end y
- end x ; call close(f1)
- if gs=1 then call SHOWSHIGHS
- if gs=0 then call SHOWHIGHS
- call WAIT
- return
-
- L288:
- tr "n1ccSorry, You Did Not Make It In The Top Five. Try Again Next Time."
- return
-
- FILEOUT:
- if exists(GreedPath'tt'term'.'fn) then do ; sendfile GreedPath'tt'term'.'fn ; return ;
- end
- if exists(GreedPath'sys.'fn) then sendfile GreedPath'sys.'fn
- return
-
- GCCHECK:
- ans=result
- if ans ='###PANIC' then do ; bufferflush ; exit ; end
- return
-
- GCCHECK2:
- ans=result
- if ans ='###PANIC' then do ; bufferflush ; exit ; end
- if ans ='Y' then tr 'cfYes!'
- else tr 'c9Not Me!'
- return
-
- SYNTAX:
- ERROR:
- IOERR:
- tr sp'Error detected:' ; tr sp'ER: 'rc' ('errortext(rc)') @ 'sigl
- bufferflush ; exit
-
- QUIT:
- tr 'n1'||sp'caGREED 2.0 brought to you by'
- tr sp'The Codex BBS, Atlanta, GA'
- tr sp ' (770) 473 - 6173'
- tr sp' Sysop: Cregan.'
- tr 'n1'sp'cfThanks for playing!'
- bufferflush ; exit
-
- GetPaths:
-