Construction of the Game

  1. Construct a line segment [AB] Toolbar Image
  2. Construct a button Toolbar Image
  3. 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.
  4. a = RandomBetween(0,180)
  5. Now, it is time to rotate the line segment [AB] around A. Toolbar Image

You can test it now!

  1. Now, hide the label for the angle you created.
  2. 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.
  3. Change the minimum value to 0 and maximum to 180.
  4. Then, create the input box Toolbar Image and connect it to the variable - b.

Your turn!

Now create a control mechanism...

You have a text input to enter your guess. Now we need a button to check our answer.
  1. Create a new button Toolbar Image to check whether your guess is correct or not. In other words, is b equal to a.


How do you express this test algebraically?

New question

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.

GeoGebra Scripting...

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.
  1. Create a text on the screen stating "Your answer is ... " Toolbar Image
  2. Right click on the text and learn its name. Generally it is text1 (or metin1 in Turkish). Watch-out capitalization. It is important.
  3. Action 1: Let's change the text1 to "Your answer is correct."
  4. Action 2: Let's change the text1 to "Your answer is wrong."
  5. Create the "Check It Out!" button Toolbar Image The script is as follows:
  6. 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.