Construction of the Game
How can you construct the game?
1.Start with creating a slider
whose interval is between 1 to 50 and increment is 1.
2.Go to "Steps" menu and create an input b=RandomBetween(1,50)
3.Create a second input a=RandomBetween(0,b-1).
4.Form the third input as Fraction=a/b.
5.Drag this input with right click
and drop on the main page.
6.Form a text box(text2)
named as "Response".
7.Create a button
whose caption is "Change Fraction".
8.Create another 3 buttons
named as "Close to zero", "Close to half" and "Close to whole".
9.Go to the settings
of the "Change Fraction" button with right click on it.
10.In settings, firstly go to "scripting" and then "on click". Write
b=RandomBetween(1,50)
SetColor(button2,gray) SetColor(button3,gray)
Setcolor(button4,gray)
11.Right click on the "Close to zero" button, go to settings>scripting>on click. Write
If(0<=Fraction<=0.24,
SetValue(text2,"That's True!"))
If(Fraction>0.24,SetValue(text2,"No"))
If(0<=Fraction<=0.24, SetColor(button2,green))
If(Fraction>0.24, SetColor(button2,red))
12. Right click on the "Close to half" button,
go to settings>scripting>on click. Write
If(0.25<=Fraction<=0.74, SetValue(text2,"Great :)"))
If(Fraction>0.74 ,SetValue(text2,"Try Again:("))
If(Fraction<0.24 ,SetValue(text2,"Think Again"))
If(0.25<=Fraction<=0.74, SetColor(button3,green))
If(Fraction>0.74,SetColor(button3,red))
If(Fraction<0.24,SetColor(button3,red))
13. Right click on the "Close to whole" button
, go to settings>scripting>on click. Write
If(0.75<=Fraction<=1, SetValue(text2,"Congratulations! .)"))
If(Fraction<0.74,SetValue(text2,"Sorry"))
If(0.75<=Fraction<=1, SetColor(button4,green))
If(Fraction<0.74,SetColor(button4,red))
14. Go to the settings of the "Change Fraction"
with right click on it. Go to settings>scripting>on click and add SetValue(text2," ")
15. Now, you can improve design
of your tool to make it visually attractive if you want :)
![Toolbar Image](/images/ggb/toolbar/mode_slider.png)
![Toolbar Image](/images/ggb/toolbar/mode_move.png)
![Toolbar Image](/images/ggb/toolbar/mode_text.png)
![Toolbar Image](/images/ggb/toolbar/mode_buttonaction.png)
![Toolbar Image](/images/ggb/toolbar/mode_buttonaction.png)
![Toolbar Image](/images/ggb/toolbar/mode_tool.png)
![Toolbar Image](/images/ggb/toolbar/mode_buttonaction.png)
![Toolbar Image](/images/ggb/toolbar/mode_buttonaction.png)
![Toolbar Image](/images/ggb/toolbar/mode_buttonaction.png)
![Toolbar Image](/images/ggb/toolbar/mode_copyvisualstyle.png)