I’ve now worked out the zero padding for the guess number and now the game looks and plays identically to the BASIC and Assembly versions I wrote.
Revisions
This line was added to the “Declare variables” section:
char array spad="00000",sguess
These lines were added to generate the zero padded guess number as a string, immediately following the start of the “do” loop:
; Zero pad guess number strb(gsnum,sguess) sassign(spad,sguess,5-sguess(0)+1,5)
The “Display guess number” section was changed to be simpler and introduces the built in printf function. Three lines consolidated into one:
printf("Guess #%S?",spad)
Complete Source Code
MODULE PROC Main() ; Declare variables byte gsnum=[1], iguess=[0], mynum byte lmarg=82 char array spad="00000",sguess ; Prep screen lmarg=0 graphics(0) ; Generate random between 1 and 100 mynum=rand(100)+1 ; Display header print("-[Number Guess, Action!, V1]------------") printe("My number is between 1 and 100.") printe("What is it?") ; Loop until number is guessed do ; Zero pad guess number strb(gsnum,sguess) sassign(spad,sguess,5-sguess(0)+1,5) ; Display guess number printf("Guess #%S?",spad) ; Get users input in byte form iguess=inputb() ; If guess is too low if iguessmynum then printe("Sorry, too high!") ; Otherwise they got it else printe("You guessed it!") exit fi ; Increment guess number gsnum == +1 until iguess=mynum od RETURN
Output
Here it is running: