Tuesday, May 29, 2012

Small Basic Fortune Teller

This is an example of accessing arrays. I suppose a better way to do this is to read a file into said array. You don't really need to answer the question since the program doesn't do anything with it.


'Clairvoyant - PZH705
'Fortune telling in Small Basic
'Example tutorial in how to access arrays.
'There are different ways to access arrays depending upon the codes.
'You can put this in one line if you're willing to string the text together
'and do proper calculation.
'
Init:
A[1]="It is certain"
A[2]="Yes - definitely"
A[3]="Most likely"
A[4]="Outlook good"
A[5]="Yes"
A[6]="Reply hazy"
A[7]="My reply is no"
A[8]="Outlook not so good"
A[9]="Very doubtful"
A_length=Array.GetItemCount(A)
NL=Text.GetCharacter(13)+Text.GetCharacter(10) 'newline


Loop:
TextWindow.Write(("What is your Yes/No Question? "+ NL))
TextWindow.Read()
TextWindow.WriteLine((A[Math.GetRandomNumber(A_length)]+NL+NL))
Goto Loop

No comments: