Create a dice game that allows a user input a guess number and roll 2 dice when the Submit button is clicked. The user wins if:
Otherwise the user loses.
Input a guess number:
Output:
Hawker food is a convenient and affordable food option in Singapore. To help educate non-Singaporeans about hawker food, create an app that takes a hawker dish name as input, and tells users whether the dish has a "rice", "noodle", or "other" base. Some sample dishes are: "chicken rice", "roti prata", "nasi lemak", "hokkien mee", "bak kut teh", and "laksa".
For example, if a user enters "laksa", the program should output "noodle". If a user enters "roti prata", the program could output "other".
Please use the ||
operator.
Enter the name of a dish:
Output:
4D is a popular betting game in Singapore run by Singapore Pools. Rocket Academy does not endorse gambling.
Create a version of 4D where the player wins if their guess matches any of the 4 digits. The player will input a single digit, and the computer generates 4 random digits between 0 and 9. If the player-inputted digit matches any of the randomly-generated digits, the player wins.
In addition to the win/loss result, output the player guess and all randomly-generated digits so the player can see how close they were.
Guess a single-digit number:
Output:
The uncle at your favourite hawker stall has decided to challenge himself and serve a random hawker dish to each customer. The dishes in his repertoire are: "chicken rice", "roti prata", "nasi lemak", "hokkien mee", "bak kut teh", and "laksa". Customers that correctly guess Uncle's dish receive a free meal.
Create an app that uses random numbers to help Uncle decide which dish to cook. The customer can only input dish names. If the customer correctly guesses Uncle's dish, let her know that she gets a free meal!
Enter the name of a dish:
Output:
Create a version of 4D where the player wins if they guess within 1000
(above or below) of the winning 4-digit number. Consider using
comparison operators such as less than (<
) and greater
than (>
).
Guess a number:
Output:
Uncle has decided to serve an omakase option, and output a menu based on customer input.
<br>
', which
generates a new line in HTML output.
Enter either "rice" or "noodle":
Output: