Version: 4.2.1 +
In this exercise we will display a game and create an action.
- The Futurama Editor must be installed.
- Futurama Runtime must be installed.
- Completing the tutorial Working with Actions in Futurama first, is recommended.
Reversed Guessing is a game where Futurama guesses the number between 0 and 100 you have in mind.
We want a webpage in which you can click a Lower or Higher button each time Futurama guesses a number between 0 and 100. Depending on whether the number should be higher or lower, Futurama adjusts its guess. And off course it will do that in the most efficient way: by chosing the number exactly in the middle of the remaning boundaries.
Take the following steps to do so:
- Create a WebPage and within the WebPage a button 'Higher' and 'Lower'.
- Outside the WebPage, create two UserVariables, both type Double, named Limit Low and Limit High.
- The Default Value of Limit Low should be 0, the Default Value of Limit High should be 100.
- Create a Formula 'Guess', Type Double: =Round((Limit_Low + Limit_High) / 2, 0)
- Name the RadioGroup: Options, and the three RadioButtons: ‘Higher’, ‘Lower’ and ‘Correct’. Fill in the Properties, Text the same name in as you did in the Editor. (Higher, Lower and Correct)
- Within the Button 'Higher', create a ChangeValue that adapts the lower limit of Futurama: The UserVariable Lower Limit gets the value of the Formula 'Guess'. (Explanation: When the button 'Higher' is clicked, the current Futurama guess can serve as the new lower limit.)
- Likewise, create a corresponding ChangeValue in the Button 'Lower'.
- Create a WebPanel 'New guess', that will display Futurama's guess: create a WebLable that displays the current value of the 'Guess' formula. For instance a concatenate formula that says: Concatenate(New guess: , FormatNumber(Guess, ))
- Your application should work now. There's no natural ending to the game yet, as there's no button that you can click to confirm that Futurama's Guess is correct.
- Instead, we do create a reset-button:
Create a WebPanel 'Reset', that holds a button. Within the button, create ChangeValues that reset the Lower and Upper Limit to their default value.
- Do not forgot to refer to your WebPage in the StartWebPage property of your Document.
- Fill in the text property of the buttons to see them displayed in your website. You could also use CSS or an image to give the buttons an approriate look.
You can download our solution for this assignment by clicking the image at the right. (Futurama 184.108.40.206)
Please note that you can very well have a different solution that is just as good as ours.
- (Medium:) Create a button 'Correct', that confirms that Futurama has guessed the number you had in mind correctly.
- (Difficult:) Add a counter to your application. When Futurama has guessed the correct number, show the number of guesses that were needed.