- unit
- class Trivia
- export Start
- var FileStream:int
- var HighScores:flexible array 1..1 of string
- procedure Init()
- open : FileStream, "HighScoresTable.hs", get
- end Init
- procedure DisplayHighScores()
- put "nnn", "":14, "-----------------------------------------------"
- put "":14, "|", "":14, "High Score Table", "":15, "|"
- put "":14, "-----------------------------------------------n", "":14, "|", "":45, "|n", "":14, "|", "":45, "|"
- loop
- get : FileStream, HighScores(upper(HighScores))
- exit when eof(FileStream)
- new HighScores, upper(HighScores) + 1
- end loop
- for i : 1 .. upper(HighScores)
- for j : 1 .. length(HighScores(i))
- if HighScores(i)(j) = "-" then
- put "":14, "|", "":8, HighScores(i)(1 .. (j - 1)):15, "":5, HighScores(i)(j), "":5, HighScores(i)((j + 1) .. length(HighScores(i))):2, "":9, "|"
- HighScores(i) := HighScores(i)(1 .. (j - 1)) + " " + HighScores(i)(j) + " " + HighScores(i)((j + 1) .. length(HighScores(i)))
- exit
- end if
- end for
- end for
- put "":14, "|", "":45, "|n", "":14, "|", "":45, "|"
- put "":14, "-----------------------------------------------"
- end DisplayHighScores
- function GetCategory(category:int):string
- if category > 5 or category < 1 then
- result "Invalid Category Number: "" + intstr(category) + """
- end if
- case category of
- label 1: result "General"
- label 2: result "Equipment"
- label 3: result "Techniques"
- label 4: result "Types of DJs"
- label 5: result "DJ Related Events"
- end case
- end GetCategory
- function GetDifficulty(difficulty:int):string
- if difficulty > 5 or difficulty < 1 then
- result "Invalid Difficulty Number: "" + intstr(difficulty) + """
- end if
- case difficulty of
- label 1: result "Easy"
- label 2: result "Normal"
- label 3: result "Hard"
- end case
- end GetDifficulty
- % GenerateQuestion() prints out a question/answer and then generates 'dummy' answers based on
- % difficulty and category.
- procedure GenerateQuestion(category:int, difficulty:int, question:string, answer:string, fillblank:boolean)
- cls
- if fillblank = true then
- put "This is a fill in the blank question.n"
- else
- put "This is NOT a fill in the blank question.n"
- end if
- put "Category: ", GetCategory(category)
- put "Difficulty: ", GetDifficulty(difficulty)
- put "n----------------------------------------------"
- put "nn", question, "n"
- case Rand.Int(1, 4) of
- label 1:
- put "nA) ", answer, "nB) ", /* dummyanswer, */ "nC) ", /* dummyanswer, */ "nD) " /* dummyanswer, */
- label 2:
- put "nA) ", /* dummyanswer, */ "nB) ", answer, "nC) ", /* dummyanswer, */ "nD) " /* dummyanswer, */
- label 3:
- put "nA) ", /* dummyanswer, */ "nB) ", /* dummyanswer, */ "nC) ", answer, "nD) " /* dummyanswer, */
- label 4:
- put "nA) ", /* dummyanswer, */ "nB) ", /* dummyanswer, */ "nC) ", /* dummyanswer, */ "nD) ", answer
- end case
- % GetCategory(Rand.Int(1, 5))
- end GenerateQuestion
- procedure Start()
- Init()
- DisplayHighScores()
- delay(2000)
- GenerateQuestion(2, 1, "Which of the following is considered advanced equipment?", "Effects processors (delay, reverb, octave, equalizer, chorus, etc). ", false)
- end Start
- end Trivia
Turing Trivia
By: Oxygenn | Date: Oct 21 2006 20:54 | Format: None | Expires: never | Size: 3.94 KB | Hits: 1475
Latest pastes
5 days ago
6 days ago
7 days ago
8 days ago
9 days ago