home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1B
/
DATAFILE_PDCD1B.iso
/
_pocketbk
/
pocketbook
/
opl
/
psion_gam
< prev
next >
Wrap
Text File
|
1994-10-13
|
948b
|
61 lines
Number Guessing Game by Klaus Ernst in OPL (for Psion Organiser II)
MMIND:
GLOBAL num%(5),g%(5),a%,b%,c%,d%,e%
start::
c%=1
DO
num%(c%)=INT(10*RND)
c%=c%+1
UNTIL c%=6
IF num%(1)=num%(2) OR num%(1)=num%(3) OR num%(1)=num%(4) OR num%(1)=num%(5)
GOTO start::
ELSEIF num%(2)=num%(3) OR num%(2)=num%(4) OR num%(2)=num%(5)
GOTO start::
ELSEIF num%(3)=num%(4) OR num%(3)=num%(5)
GOTO start::
ELSEIF num%(4)=num%(5)
GOTO start::
ENDIF
e%=1
guess::
c%=1
DO
PRINT"Enter digit";c%
INPUT d%
g%(c%)=d%
c%=c%+1
UNTIL c%=6
c%=1
DO
PRINT g%(c%);
c%=c%+1
UNTIL c%=6
GET
c%=1
a%=0
b%=0
DO
IF g%(c%)=99
STOP
ELSEIF num%(c%)=g%(c%)
a%=a%+1
IF a%=5
PRINT" ALL RIGHT";CHR$(33)
PRINT e%,"Guesses"
GET
STOP
ENDIF
ELSEIF g%(c%)=num%(1) OR g%(c%)=num%(2) OR g%(c%)=num%(3) OR g%(c%)=num%(4) OR
.g%(c%)=num%(5)
b%=b%+1
ENDIF
c%=c%+1
UNTIL c%=6
PRINT " Right:", a%
PRINT "Wrong place:",b%
GET
e%=e%+1
GOTO guess::