Construction of the Game
- Serkan Ozel
- Construct a line segment [AB]
- Construct a button
- The button you just constructed needs a script to produce a random angle. The following script creates a variable called `a` and assign a random number between 0 and 180 to it.
a = RandomBetween(0,180)
- Now, it is time to rotate the line segment [AB] around A.
You can test it now!
- Now, hide the label for the angle you created.
- We need to create an input box to enter our input. Before the input box is created, we need to create a new variable through "input area" - in this case, I named the new variable as b.
- Change the minimum value to 0 and maximum to 180.
- Then, create the input box and connect it to the variable - b.
Now create a control mechanism...
You have a text input to enter your guess. Now we need a button to check our answer.
- Create a new button to check whether your guess is correct or not. In other words, is b equal to a.
How do you express this test algebraically?
For the control mechanism, there is condition - if the answer is correct or not. We need to tell the computer how to behave based on the conditions. Let's think about how you would express this conditional statement in English.
We have not create the "Check It Out!" button yet. First, let's figure out the actions. The simplest way is to write a text on the screen.
- Create a text on the screen stating "Your answer is ... "
- Right click on the text and learn its name. Generally it is text1 (or metin1 in Turkish). Watch-out capitalization. It is important.
- Action 1: Let's change the text1 to "Your answer is correct."
- Action 2: Let's change the text1 to "Your answer is wrong."
- Create the "Check It Out!" button The script is as follows:
If(a==b, SetValue(text1, "Your answer is correct."), SetValue(text1, "Your answer is wrong."))
Now you can change the actions from right or wrong to constructive feedbacks.