home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / bbs / quiz / quiz.hlp < prev    next >
Text File  |  1989-07-12  |  4KB  |  125 lines

  1. script
  2.  
  3. Define quiz_type = 'Black History'
  4. Define questions                  ;used to get number of questions
  5. Define count                      ;used in 'for' loops to count
  6. Define ask                        ;displays the question
  7. Define actual                     ;displays possible answer
  8. Define choices                    ;
  9. Define answer = '1'
  10. Define check
  11. Array choice
  12. Define pick
  13. Define look
  14. Define number_of_choices = '3'    ;max number of choices
  15. Define right = 0
  16. Define missed = 0
  17. Define correct = 0
  18. Define compare
  19. Define theirs
  20. Define dummy
  21. Define path = 'd:\menus_80\'
  22. Define quest = 'quest.txt'     ;file where the questions are kept
  23. Define pos_ans = 'choices.txt' ;here are the possible answers
  24. Define good = 'correct.txt'    ;here are the correct answers
  25. Define results = 'results.txt' ;results of the test go here
  26. Define taker = &01             ;taker of the test
  27. Define send_it                  ;used to concatenate strings
  28. Define good_ansr               ;an array holding the correct answers
  29. Define users                   ;
  30. Define taken = 'taken.txt'
  31. Define previous_takers
  32. Define temp
  33.  
  34.  
  35.  
  36. Clear screen
  37. print 'The following is a quiz on [quiz_type], would you like to take it ? '
  38. input dummy 1 noreturn
  39. if dummy = 'n' then
  40.  exit
  41. endif
  42. CLEAR SCREEN
  43.  
  44. previous_takers = table_load ('[path][taken]')
  45.  
  46. for count = 1 to previous_takers      ;check to see if it's already been
  47. temp = table_get (count)              ;taken
  48.  if [taker] = [temp] then
  49.   BREAK
  50.  endif
  51. endfor 
  52. if taker # temp then                  ;if their name wasn't found let them
  53.   goto test                           ;take the test 
  54. endif
  55. printe 'You have already taken the test'  ;sorry, you can only take it once
  56. exit
  57.  
  58.  
  59. TEST:                                   ;let's begin
  60.  
  61. correct = table_load ('[path][good]')    ;get the correct answers
  62. array_clear (good_ansr)
  63.  
  64. for count = 1 to correct
  65. right = table_get (count)
  66. array_put (good_ansr, count, right) ; fill array with all the correct
  67.                                     ; answers
  68. endfor
  69.  
  70.  
  71. questions = table_load ('[path][quest]')
  72.  
  73. for count = 1 to questions         ;ask x amount of questions
  74.   ask = table_get (count)          ;find out exactly how many questions
  75.   printe '[ask]'                   ;ask the question 
  76.   printe
  77.    choices = table_load ('[path][pos_ans]')  ; get the possible answers
  78.  
  79. NEXT_answer:
  80.       actual = table_get (answer)  ;answer is intialized as 1 at top of file
  81.       printe 'actual'              ;show the choice, had to do it this way
  82.        increase answer             ;nested for loops not allowed.
  83.        increase check
  84.         if check = number_of_choices then ;have we reached the maximum number
  85.          check = 0                        ;of choices, if yes then back to 0
  86.          print 'your answer ? ==>'        ;user input
  87.          input pick 1 noreturn
  88.          array_put (choice, count, pick)      ;save their answer
  89.          right = array_get (good_ansr, COUNT) ;get the correct answer
  90.          printe
  91.          print 'The correct answer is [right]' ;and show it to them 
  92.          printe
  93.          printe
  94.          printe
  95.         goto reload                            ;get another question
  96.        endif
  97.  goto next_answer                              ;back to the top of the loop
  98.                                                ;for more possible answers
  99. Reload:
  100.   questions = table_load ('[path][quest]')  ;load questions again
  101. endfor
  102.  
  103.  
  104. printe 'Checking answers .... one moment'
  105.  
  106.  
  107. for compare = 1 to questions
  108.  theirs = array_get (choice, compare)       ;get their answers
  109.  correct = array_get (good_ansr, compare)   ;get correct answers
  110.  
  111.   if theirs # correct then                  ;if it's not correct
  112.    increase missed                          ;add to their misses
  113.    ef theirs = correct then                 ;if it's correct
  114.    increase right                           ;give them credit
  115.   endif
  116.  
  117. endfor
  118.  
  119. printe ' you got [right] correct and [missed] wrong ' ;tellem how many
  120.                                                       ;they got
  121. open ('[path][taken]',append)
  122. fprint taker                                          ;add them to the list
  123. close                                                 ;of the tested  
  124. exit
  125.