| 1. |
For this lab you will use the random.js library to write some web applications.
|
| 2. |
Our first application is the ESP tester
- The traditional test for determining whether someone has ESP (extrasensory perception)
involves asking the person to guess randomly selected numbers.
- Your application will have four buttons labeled "Guess 1", "Guess 2", "Guess 3", and "Guess 4".
- It will also have a text box that displays the results of the test.
- You must implement a function called PickNumber which does the following:
- Picks a number between 1 and 4 using the RandomInt function from the
random.js library.
- Prints a message to the text box containing the users guess along with the machine's random selection.
|
| 3. |
Our second application is the six-sided die roller
- First you will need to download the following files to your jump drive:
- Use an image tag to display die1.gif on your web page
- Write a function called RollTheDice that picks which side of the die to display.
- The simplest way to do that is to use the RandomOneOf function with the following argument (including the square brackets):
["die1.gif", "die2.gif", "die3.gif", "die4.gif", "die5.gif", "die6.gif"]
- This will give you a string that you can use to set the src attribute of your image.
|
| 4. |
When you are done, upload the lab5.html file to the CS server using FileZilla.
(See the instructions for Lab 1 if you are unsure how to do this)
|