Hi Everyone!
Just Recently my cousin was up for the holidays, he is a bit of a newbie programmer. To teach him some of the basics of DarkBASIC I wrote an EXTREMEMLY Basic 8-Ball Program. It uses the Random Number Generator to pick something to say. It runs WITHOUT any MEDIA, and is fully commented (If you want to add media then that is encouraged).
This program will be useful if you want to learn how to use variables, the difference between Integer Number Variables and Word(String) Variables, and how to use basic text commands.
Changes to the program are encouraged.
Here is the Code:
`|-------------------|
`|-8-Ball Program----|
`|-By Axel Williams--|
`|-Started 10/07/05--|
`|-Finished 10/07/05-|
`|-------------------|
Main:
`Initialise
HIDE MOUSE
CLS
`Reseed the Random Number Generator
RANDOMIZE Random
`Possibilities (P stands for possibility)
P1$ = "Yes"
P2$ = "No"
P3$ = "Without a Doubt"
P4$ = "Certainly Not"
P5$ = "Maybe, Maybe Not"
P6$ = "Ask me at a Later Date"
P7$ = "I Cannot Say at this Moment in Time"
P8$ = "Find out for Yourself"
`Coversation Text
PRINT "Welcome to the Eight-Ball Program"
PRINT " "
PRINT "Do you have a Question?"
PRINT " "
INPUT "What is your Question? >"
PRINT " "
PRINT "The Eight-Ball is Thinking..."
WAIT 3000
PRINT " "
`Another Variable
eightball = RND(8)
`Printing the Answer
IF eightball = 1 THEN PRINT "The Eight-Ball Says: ",P1$
IF eightball = 2 THEN PRINT "The Eight-Ball Says: ",P2$
IF eightball = 3 THEN PRINT "The Eight-Ball Says: ",P3$
IF eightball = 4 THEN PRINT "The Eight-Ball Says: ",P4$
IF eightball = 5 THEN PRINT "The Eight-Ball Says: ",P5$
IF eightball = 6 THEN PRINT "The Eight-Ball Says: ",P6$
IF eightball = 7 THEN PRINT "The Eight-Ball Says: ",P7$
IF eightball = 8 THEN PRINT "The Eight-Ball Says: ",P8$
WAIT 3000
`Do you have another question?
PRINT " "
INPUT "Do You Have Another Question? Y/N >",A$
IF A$ = "Y" OR A$ = "y"
`RANDOMIZE command's value (Random2). Change this each time to have a completely random scenario!
Random2 = RND(100)
Random = Random2
GOSUB Main
ENDIF
IF A$ = "N" OR A$ = "n" THEN END
Have Fun!
Cya Later,
Axelman
The only problem is that there can never be a completely random scenario.
THIS SPACE FOR RENT