Hi, to whoever is going to answer this question note that they all fall under one question with different points thank y

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Hi, to whoever is going to answer this question note that they all fall under one question with different points thank y

Post by answerhappygod »

Hi, to whoever is going to answer this question note that they all fall under one question with different points thank you.
Java using proccessing.
Q1
Implement a dice-game simulator that uses the rules below. You will visualize the game as it progresses as shown on the right:
It will show your dice rolls as they happen, and keep track of your bank balance on the left. Each round of the game you roll one die to get a random number from 1 to 6. But this is a fancy spherical die. Show it by drawing a new circular image like the ones shown in the example. For each die roll, draw a white circle, with from 1 to 6 dots (called “pips”) equally spaced in a ring within the circle. Do not erase the old rolls, so that you see all of your rolls, as shown. You can see rolls from 1 to 6 in the sample image. Each die should be drawn in a random location, but be sure that the whole circle fits inside the window (and does not overlap the money bar on the left).
The game rules are as follows. Depending on what you roll, your money gets a multiplier. If you roll a:
There are two additional rules: if you get two 4s in a row, the second 4 will give you 5 times your money. (This will also happen for a 3rd, 4th, … one, if you get really lucky.) But if you get two 6s in a row, the second six bankrupts you to $0.
You will start the game with a certain amount of money ($40) and you must announce (that is, print to the console) a goal that you hope to reach (try $400). You must keep playing until either
a. 1) you reach or exceed your goal, or
b. 2) you have less than $1 left.
Show the amount of money as a vertical bar against a white background on the left side of the screen. A small bar near the bottom, as shown, means you haven’t got much money yet. A bar that reaches the top of the window means you’ve reached or exceeded your goal. If the bar disappears, you’re broke. You should also draw a horizontal line to show the most money you’ve ever had during this game. In the example, the player has about $39.94 of the goal of $400, but at some point, had a bit more (about $52), as shown by the small line. You should also show the current money left in the bank after each roll as a text at the top of the left bar (money bar).
Notes:
console, so that you can see what’s going on. This will help a lot in testing your program.
in the bank after each roll.
bar” each frame.
hint for Q1
drawDie()
- Function to draw ellipse at random location (dieCX, dieCY)
- Use rand function to generate new coordinates.
- Make sure ellipses are drawn within the box and not outside.
drawPips()
- Purpose is to draw ellipse inside each ellipse.
- Need number of pips (E.g. currentRoll) from drawDie() to know how many pips to draw.
- Can use trigonometry to define angle of each dot based on currentRoll.
E.g. 4, each pip at TWO_PI/4 starting at 0 radians.
updateDieRoll()
- save current as prevRoll.
- using rand() generate new value of currentRoll.
updateMoney()
- check for all conditions here based on values of currentRoll and prevRoll.
drawMoneyBar()
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply