Excuse Generator

The excuse generator creates random excuses to get you out of any trouble (not guaranteed).  It is a nice way to show both random numbers and storing data in arrays in BB4Win.  Students will want to add their own data to the program and this is achieved by adding to the "data" statements at the end, and changing the values of LEADS%, PERPS% and DELAYS% accordingly.


Excuses, excuses, excuses....


     REM excuse creator
     REM T Street
     REM 2014-11-24

     
LEADS%  = 6 : REM number of lead-ins
     
PERPS%  = 6 : REM number of perpetrators
     
DELAYS% = 6 : REM number of delaying factors

     REM set up arrays to hold all the excuses
     
DIM lead$( LEADS%-1 )
     DIM perp$( PERPS%-1 )
     DIM delay$( DELAYS%-1 )

     PROC_populateArrays

     PRINT "EXCUSE GENERATOR"
     PRINT "Press any key to get a new excuse"
     PRINT "---------------------------------"''
     REPEAT
       PRINT FN
_getExcuse
       g = GET
     UNTIL FALSE


     
DEFFN_getExcuse
     REM gets three random parts and sticks them together
     
= lead$(RND(LEADS%)-1)+" "+perp$(RND(PERPS%)-1)+" "+delay$(RND(DELAYS%)-1)+"!"


     DEFPROC_populateArrays
     REM puts the data into the arrays
     
LOCAL n%
     FOR n% = 0 TO LEADS%-1
       READ lead$(n%)
     NEXT
     FOR 
n% = 0 TO PERPS%-1
       READ perp$(n%)
     NEXT
     FOR 
n% = 0 TO DELAYS%-1
       READ delay$(n%)
     NEXT
     ENDPROC

     
REM lead-ins
     
DATA "I'm sorry but", "Please forgive me"
     
DATA "I apologize, however", "I'm never usually like this, but"
     
DATA "You're never going to believe this, but", "So, I was minding my own business when boom!..."

     
REM perpetrators
     
DATA "your mum", "my mum"
     
DATA "Godzilla", "the ghost of Hitler"
     
DATA "Darth Vader", "Kevin Specey"

     
REM delaying factors
     
DATA "tried to kill me", "ate my homework"
     
DATA "stole my bycyle", "stole my identity"
     
DATA "kept asking me 'why?' and wouldn't stop", "came after me"