home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM 1995 Fall / PD-ROM F95.toast / Programming / Programming Utilities / LogoMation 1.0.1 ƒ / Examples / Lib / Add⁄Sub Tutor.lib / Add_Sub Tutor.lib
Encoding:
Text File  |  1992-12-08  |  2.4 KB  |  113 lines

  1. /////////
  2. // init //
  3. /////////
  4. Function init()
  5.     bottom = -height()/2+20
  6.     Clear 53720,64909,65535
  7.     starSize = 30
  8.     randomize()
  9.  
  10. ///////////////
  11. // make star   //
  12. ///////////////
  13. Function makeStar(frac,max)
  14.     Picture "a star"
  15.         Fill 1,64432,65535,7165
  16.             Repeat 5
  17.                 Forward starSize
  18.                 Left 144
  19.  
  20. //////////////
  21. // roll a star //
  22. //////////////
  23. Function rollStar(starNum, fx,last,n,x,n2)
  24.     Pen name=starNum, move="above", end="no"
  25.     Sound "Flens"
  26.     last = -width()/2
  27.     Repeat n, 15, 5, -1
  28.          Pen picture="a star"
  29.         n2 = n*n
  30.         Curve last+2*x, rollY(), x, -n, n
  31.         last = last+4*n
  32.         Sound "Pop",nowait
  33.     Sound "Boing",nowait
  34.     Pen speed=800, end="copy"
  35.     Goto width()/2 - 30*starNum, height()/2-30,0
  36. Function rollY()
  37.     x2 = x*x
  38.     myY = n2-x2
  39.     Pen speed=sqrt(n2-myY+5)*10
  40.     Return myY+bottom
  41.     
  42. ///////////////
  43. // drop a star //
  44. ///////////////
  45. Function dropStar(n,sx,sy)
  46.     Pen name=n, picture=""
  47.     sx = x()
  48.     sy = y()
  49.     Goto x()-3,y()-starSize/3-3,0
  50.     Fill 1,65535,65535,65535
  51.         Repeat 4
  52.             Forward starSize+6
  53.             Left 90
  54.     Sound "Eagle",nowait
  55.     Pen picture="a star",end="no",speed=200
  56.     Up
  57.     Goto sx,sy,0
  58.     Down
  59.     Goto x(), -height()/2,0
  60.     Sound "Smack"
  61.  
  62. /////////////////////////////
  63. // compose a question, ask it //
  64. /////////////////////////////
  65. Function AddQuestion()
  66.     n1 = int(random(11))
  67.     n2 = int(random(11))
  68.     askClear()
  69.     Print n1 . " + " . n2 . " = ", move
  70.     r = ask(100)
  71.     checkIfStop(r)
  72.     Return (r = n1+n2)
  73. Function SubQuestion()
  74.     n1 = int(random(10))
  75.     n2 = int(random(10))
  76.     askClear()
  77.     Print (n1+n2) . " - " . n2 . " = ", move
  78.     r = ask(100)
  79.     checkIfStop(r)
  80.     Return (r = n1)
  81. Function askClear()
  82.     Pen name="question"
  83.     Up
  84.     Goto -100,-20,0
  85.     Down
  86.     Fill 1, 65535,65535,65535
  87.         Repeat 2
  88.             Forward 200
  89.             Left 90
  90.             Forward 20
  91.             Left 90
  92.     Up
  93.     Goto x()+10,y()+5,0
  94.     
  95. Function checkIfStop(r)
  96.     If r = ""
  97.         Sound "Okie Dokey"
  98.         Pen name=0,fontstyle="Bold",fontsize=20
  99.         Up
  100.         Goto -100,-100,0
  101.         Print "DONE"
  102.         Halt
  103.         
  104. Function Score()
  105.     Pen name=0,fontstyle="Bold",fontsize=20
  106.     Up
  107.     Goto -100,-100,-90
  108.     Color 6154,23658,65535
  109.     Print "Good Answers: " . goodAnswers
  110.     Color 65535,29587,9068
  111.     Forward 40
  112.     Print "BAD Answers: " . badAnswers
  113.