On OpenCard
If Game_on is not 1 then
  play doriru
    put 3 into ntx
   naratoranimex
  wait 2 seconds
  play bokuwo
    put 5 into ntx
   naratoranimex
end if
repeat with i = 1 to 16
put random(100) into a_number

put a_number * 0.1 into  Item i of fldarray
putFLOAT1 Item i of fldarray into fld %i%
put 0 into Item i of checkarray
end repeat


put 25 into Item 1 of btnarray
put 24 into Item 2 of btnarray
put 15 into Item 3 of btnarray
put 18 into Item 4 of btnarray
put 12 into Item 5 of btnarray
put 26 into Item 6 of btnarray
put 19 into Item 7 of btnarray
put 14 into Item 8 of btnarray
put 16 into Item 9 of btnarray
put 20 into Item 10 of btnarray
put 13 into Item 11 of btnarray
put 23 into Item 12 of btnarray
put 21 into Item 13 of btnarray
put 17 into Item 14 of btnarray
put 22 into Item 15 of btnarray
put 27 into Item 16 of btnarray


put 29 into Item 1 of hachiarray
put 33 into Item 2 of hachiarray
put 38 into Item 3 of hachiarray
put 39 into Item 4 of hachiarray
put 30 into Item 5 of hachiarray
put 34 into Item 6 of hachiarray
put 40 into Item 7 of hachiarray
put 42 into Item 8 of hachiarray
put 31 into Item 9 of hachiarray
put 35 into Item 10 of hachiarray
put 43 into Item 11 of hachiarray
put 41 into Item 12 of hachiarray
put 32 into Item 13 of hachiarray
put 36 into Item 14 of hachiarray
put 37 into Item 15 of hachiarray
put 44 into Item 16 of hachiarray




End OpenCard







On Reset34

repeat with i = 1 to 16
put random(100) into a_number

put a_number * 0.1 into  Item i of fldarray
putFLOAT1 Item i of fldarray into fld %i%
put 0 into Item i of checkarray
end repeat




put 25 into Item 1 of btnarray
put 24 into Item 2 of btnarray
put 15 into Item 3 of btnarray
put 18 into Item 4 of btnarray
put 12 into Item 5 of btnarray
put 26 into Item 6 of btnarray
put 19 into Item 7 of btnarray
put 14 into Item 8 of btnarray
put 16 into Item 9 of btnarray
put 20 into Item 10 of btnarray
put 13 into Item 11 of btnarray
put 23 into Item 12 of btnarray
put 21 into Item 13 of btnarray
put 17 into Item 14 of btnarray
put 22 into Item 15 of btnarray
put 27 into Item 16 of btnarray


put 29 into Item 1 of hachiarray
put 33 into Item 2 of hachiarray
put 38 into Item 3 of hachiarray
put 39 into Item 4 of hachiarray
put 30 into Item 5 of hachiarray
put 34 into Item 6 of hachiarray
put 40 into Item 7 of hachiarray
put 42 into Item 8 of hachiarray
put 31 into Item 9 of hachiarray
put 35 into Item 10 of hachiarray
put 43 into Item 11 of hachiarray
put 41 into Item 12 of hachiarray
put 32 into Item 13 of hachiarray
put 36 into Item 14 of hachiarray
put 37 into Item 15 of hachiarray
put 44 into Item 16 of hachiarray


lock screen
repeat with Original = 1 to 16
put Item Original of btnarray into oo
put Item Original of hachiarray into ooo
show btn %oo%
show btn %ooo%
hide fld %Original%
end repeat

unlock screen




End Reset34















On beeleft
put random(10) into h
put LocH of btn %hachi_btn_no% into x0
put LocV of btn %hachi_btn_no% into y0
put y0 - h * 10 into y1
put x0 /20 into n
put h * 10 /n into nn
repeat with i = 1 to n
 set loc of btn  %hachi_btn_no% to x0 - (i-1) * 20, y0 - nn *(i-1) + h 
end repeat
hide btn  %hachi_btn_no%
End beeleft


On beeright
put random(10) into h
put LocH of btn %hachi_btn_no% into x0
put LocV of btn %hachi_btn_no% into y0
put y0 - h * 10 into y1
put (640-x0) /20 into n
put h * 10 /n into nn
repeat with i = 1 to n
 set loc of btn  %hachi_btn_no% to x0  + (i-1) * 20, y0 - nn *(i-1) + h 
end repeat
hide btn  %hachi_btn_no%

End beeright



On GetNumber
put random(16) into r1
put 0 into found
repeat with j = r1 to 16
 if Item j of checkarray = 0 then
     put 1 into found
     exit repeat
 end if
end repeat
if found = 1 then
  exit GetNumber
end if
if found = 0 then
repeat with j = 1 to r1-1
 if Item j of checkarray = 0 then
     put 1 into found
     exit repeat
 end if
end repeat
end if
End GetNumber

On GameStart
put 0 into rightanswer
put 0 into mistake
putInt 0 into fld right_ans
putInt 0 into fld TotalQ
Repeat while 1=1
 GetNumber
 if found is not 0 then
      put j into jjj
      put Item jjj of Hachiarray into hh1
            put hh1 into hachi_btn_no
       play bee
       if hh1 = 38 or hh1 = 30 or hh1 = 34 or hh1 = 42 or hh1 = 31 or hh1=35 then
          BeeRight
       else
          BeeLeft
       end if
       put x0 into h1x
       put y0 into h1y
       Lock screen
       put Item jjj of btnarray into bbb
        hide btn %bbb%
---

if random(3)  is not 1 then
put random(10) into Item jjj of fldarray
put random(3) + random(10)/10 into xxxx
putInt  Item jjj of fldarray into fld %jjj%
else
put random(10) into xxxx
put random(20) + random(10)/10 into Item jjj of fldarray
putFloat1  Item jjj of fldarray into fld %jjj%
end if
if  Item jjj of fldarray - Int( Item jjj of fldarray) = 0 then
  putInt Int( Item jjj of fldarray) into fld %jjj%
end if
---


        show fld %jjj%
       set loc of btn hidebtn1 to LocH of btn %bbb%, LocV of btn %bbb%
       show btn hidebtn1
       unlock screen
-------------------
     repeat while 1 = 1
       GetNumber
       if j is not jjj then
          exit repeat
       end if
     end repeat
        put j into kkk
         
      put Item kkk of Hachiarray into hh2
            put hh2 into hachi_btn_no
       if hh2 = 38 or hh2 = 30 or hh2 = 34 or hh2 = 42 or hh2 = 31 or hh2=35 then
          BeeRight
       else
          BeeLeft
       end if
         put x0 into h2x
       put y0 into h2y
     Lock screen
       put Item kkk of btnarray into ccc
        hide btn %ccc%

---------


if Item jjj of fldarray - Int(Item jjj of fldarray) = 0 and xxxx - Int(xxxx) = 0  then
put random(7) + random(10)/10 into xxxx
end if
 


put Item jjj of fldarray  * xxxx into Item kkk of fldarray



If Item kkk of fldarray - Int(Item kkk of fldarray) = 0 then
putInt Int(Item kkk of fldarray)  into fld %kkk%
else
putFloat1 Item kkk of fldarray into fld %kkk%
end if
-----------

        show fld %kkk%
        set loc of btn hidebtn2 to LocH of btn %ccc%, LocV of btn %ccc%
       show btn hidebtn2
      unlock screen

if xxxx - Int(xxxx) = 0 then

      QuizDlg4 "The larger number divided by the smaller makes __ ", xxxx
else
      QuizDlg8 "The larger number divided by the smaller makes __", xxxx
end if
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat
      put 0 into quiz_quit
  if math_answer is not 1 then
       if math_answer is  -1 then
          play  uhoh2
        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
          exit repeat
        else
              play jawharp
          showwitch_surprised
          put mistake + 1 into mistake
          putInt rightanswer + mistake into fld TotalQ
        end if

        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
       else
           play good
           show_frog_good
          put rightanswer + 1 into rightanswer
          putInt rightanswer + mistake into fld TotalQ
          putInt rightanswer into fld right_ans
     put 1 into Item jjj of checkarray
     put 1 into Item kkk of checkarray
    lock screen
     hide btn %hh1%
     hide btn %hh2%
     hide btn hidebtn1
     hide btn hidebtn2
     hide fld %jjj%
     hide fld %kkk%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
     unlock screen

      end if
  else
    repeat  5 times
    set direction of btn 2 to 1
    set direction of btn 2 to 2
    set direction of btn 2 to 3
    set direction of btn 2 to 0
    end repeat
            play AlRight
    set bitmap of btn 2 to frog2
     wait 60 ticks
    set bitmap of btn 2 to frog1
     wait  2 seconds
    play toomuch



       exit repeat
   end if  




End Repeat 

reset34


     
    
 
End GameStart

-------------

On GameStart2
put 0 into rightanswer
put 0 into mistake
putInt 0 into fld right_ans
putInt 0 into fld TotalQ
Repeat 2 times
 GetNumber
 if found is not 0 then
      put j into jjj
      put Item jjj of Hachiarray into hh1
            put hh1 into hachi_btn_no
       play bee
       if hh1 = 38 or hh1 = 30 or hh1 = 34 or hh1 = 42 or hh1 = 31 or hh1=35 then
          BeeRight
       else
          BeeLeft
       end if
       put x0 into h1x
       put y0 into h1y
       Lock screen
       put Item jjj of btnarray into bbb
        hide btn %bbb%
---

if random(3)  is not 1 then
put random(10) into Item jjj of fldarray
put random(3) + random(10)/10 into xxxx
putInt  Item jjj of fldarray into fld %jjj%
else
put random(10) into xxxx
put random(20) + random(10)/10 into Item jjj of fldarray
putFloat1  Item jjj of fldarray into fld %jjj%
end if
if  Item jjj of fldarray - Int( Item jjj of fldarray) = 0 then
  putInt Int( Item jjj of fldarray) into fld %jjj%
end if
---


        show fld %jjj%
       set loc of btn hidebtn1 to LocH of btn %bbb%, LocV of btn %bbb%
       show btn hidebtn1
       unlock screen
-------------------
     repeat while 1 = 1
       GetNumber
       if j is not jjj then
          exit repeat
       end if
     end repeat
        put j into kkk
         
      put Item kkk of Hachiarray into hh2
            put hh2 into hachi_btn_no
       if hh2 = 38 or hh2 = 30 or hh2 = 34 or hh2 = 42 or hh2 = 31 or hh2=35 then
          BeeRight
       else
          BeeLeft
       end if
         put x0 into h2x
       put y0 into h2y
     Lock screen
       put Item kkk of btnarray into ccc
        hide btn %ccc%

---------


if Item jjj of fldarray - Int(Item jjj of fldarray) = 0 and xxxx - Int(xxxx) = 0  then
put random(7) + random(10)/10 into xxxx
end if
 


put Item jjj of fldarray  * xxxx into Item kkk of fldarray



If Item kkk of fldarray - Int(Item kkk of fldarray) = 0 then
putInt Int(Item kkk of fldarray)  into fld %kkk%
else

putFloat1 Item kkk of fldarray into fld %kkk%
end if
-----------

        show fld %kkk%
        set loc of btn hidebtn2 to LocH of btn %ccc%, LocV of btn %ccc%
       show btn hidebtn2
      unlock screen

if xxxx - Int(xxxx) = 0 then

      QuizDlg4 "The larger number divided by the smaller makes __", xxxx
else
      QuizDlg8 "The larger number divided by the smaller makes __", xxxx
end if
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat
      put 0 into quiz_quit
  if math_answer is not 1 then
       if math_answer is  -1 then
          play  uhoh2
        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
          exit repeat
        else
              play jawharp
          showwitch_surprised
          put mistake + 1 into mistake
          putInt rightanswer + mistake into fld TotalQ
        end if

        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
        exit repeat
       else
           play good
           show_frog_good
          put rightanswer + 1 into rightanswer
          putInt rightanswer + mistake into fld TotalQ
          putInt rightanswer into fld right_ans
     put 1 into Item jjj of checkarray
     put 1 into Item kkk of checkarray
    lock screen
     hide btn %hh1%
     hide btn %hh2%
     hide btn hidebtn1
     hide btn hidebtn2
     hide fld %jjj%
     hide fld %kkk%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
     unlock screen

      end if
  else
    repeat  5 times
    set direction of btn 2 to 1
    set direction of btn 2 to 2
    set direction of btn 2 to 3
    set direction of btn 2 to 0
    end repeat
            play AlRight
    set bitmap of btn 2 to frog2
     wait 60 ticks
    set bitmap of btn 2 to frog1
     wait  2 seconds
    play toomuch



       exit repeat
   end if  




End Repeat 

reset34


     
    
 
End GameStart2
