EGR 141 XXXXXXXXXXOnsay EGR 1400 XXXXXXXXXXHANNA / SIADAT LAB 4 REQUIREMENTS Problem: In this lab, you will be using Visual Studio to implement the classic game of Craps. Craps is a game of numbers...

I need someone that can accomplish this lab assignment in visual studio program with c# language


EGR 141 Onsay EGR 1400 HANNA / SIADAT LAB 4 REQUIREMENTS Problem: In this lab, you will be using Visual Studio to implement the classic game of Craps. Craps is a game of numbers and dice. The challenge is that when the user rolls the dice there are two sets of rules to follow depending on whether the roll is the users first roll to set the point/goal or it is one of potentially many rolls after the point/goal has been set. The rules are detailed below. PART A The rules for the Craps game are below. The Rules THERE ARE A FEW DIFFERENT VARIATIONS OF CRAPS. IN THIS VERSION, THE PLAYER ROLLS TWO DICE, AND THE SPOTS ON THE DICE ARE ADDED TOGETHER. THE PLAYER WINS ON THE FIRST ROLL IF THE DICE SHOW A TOTAL OF 7 OR 11. THE PLAYER LOSES IF THE TOTAL IS 2, 3, OR 12. IF ANOTHER NUMBER IS THROWN ON THE FIRST ROLL – FOR EXAMPLE, A 10 – THAT NUMBER BECOMES THE POINT, OR THE GOAL OF SUBSEQUENT TOSSES. THE PLAYER CONTINUES TO ROLL THE DICE UNTIL THE POINT OR A 7 APPEARS. THROWING A TOTAL EQUAL TO THE POINT MEANS THE PLAYER WINS AND THROWING A 7 MEANS THE PLAYER LOSES. THIS IS THE VERSION OF CRAPS USUALLY PLAYED IN CASINOS. SOME EXAMPLES: FIRST TOSS: 3 IMMEDIATE LOSS FIRST TOSS: 11 IMMEDIATE WIN FIRST TOSS: 10 SECOND TOSS: 9 THIRD TOSS: 4 FOURTH TOSS: 10 WIN FIRST TOSS: 10 SECOND TOSS: 9 THIRD TOSS: 7 LOSS EGR 1400 HANNA / SIADAT Figure 1: A Flowchart for the Game of Craps In this program, you will need to use the Random class to randomly generate 2 numbers to determine what the user rolled on each die (2 dice total). When the player clicks on the 'Roll the dice' button the computer will randomly select two numbers. Using these randomly select numbers, it will display two dice representing the correct numbers that were chosen. It will also display the numbers for each die and the total. After rolling the dice, the game status will be displayed by the placement of the puck. A black puck indicates the game is in the come out roll (set roll) state. A white puck indicates a subsequent roll and the point value (or goal). A message indicating a win, loss, or other relevant information should also be displayed. This game should keep score, if a player wins, one should be added to the score and if the player loses, one should be subtracted from the score. The score can be negative. Below is a sample screen shot. You don't have to implement the Craps game exactly as shown as long as it has all of the components described in the lab. Dice totals 7 LOSE A POINT Dice totals X WIN A POINT Start Over Again Dice total equals X = 4,5,6,8,9, or 10 Dice total 7 or 11 WIN A POINT Dice total 2, 3, or 12 LOSE A POINT COME OUT ROLL (SET ROLL) Point/Goal: NONE ROLL DICE SUBSEQUENT ROLL Point/Goal: X ROLL DICE Dice totals anything except 7 or the Point/Goal EGR 1400 HANNA / SIADAT In the example shown above, on a subsequent roll, the user rolled a seven (one and six). This means that the Point value is not matched before a roll of seven and you lost. The program should be set to the first roll state for the next roll of the dice. Setup the Form for your Craps game. For the die images, copy the images from the web site for each possible die face (1, 2, 3, 4, 5, 6) and paste the image into a PictureBox control as demonstrated in class. For each die, draw six different PictureBox controls in C# .NET. Use these images for the die faces to appear in the PictureBox controls. PART B Finish creating your game by writing the code for the 'Roll the dice' button and the 'Exit' button. You will need to use a Form-level variable (field) to store the Point value (or goal). Remember, the Point value is not the same as the score, the terminology may seem confusing. If it is confusing, reread the gaming directions given above. You will also need a form-level variable (field) to keep track of the 'State' of the game. The game is either in First Roll or in Roll Again. In First Roll, the game will need to roll two dice and establish whether the user is an instant winner, an instant loser, or establish a Point (a number that is the goal to roll again before rolling a 7). In Roll Again, the game is rolling again – it already has established a Point (goal) and will roll two dice to see whether the player is a loser (rolls a 7) or is a winner (rolls the Point or goal value) or will keep rolling. It is good practice to create variables with a form scope (field variables) only when necessary. Explain why the variables for the Point (or goal) and state must be form-level (field) variables. EGR 1400 HANNA / SIADAT HERE IS A PSEUDO-EXPLANATION OF THE PROGRAM LOGIC FOR ONE ROLL OF THE DICE: HIDE ALL DICE IMAGES ROLL TWO DICE (GET TWO RANDOM NUMBERS) DISPLAY DIE VALUES, TOTAL, AND CORRECT IMAGES IF THE STATE IS 1 (MEANING FIRST ROLL) IF TOTAL IS 7 OR TOTAL IS 11 STATUS: WINNER ADD ONE TO THE SCORE STATE = 1 (FIRST ROLL) ELSE IF TOTAL IS 2 OR TOTAL IS 3 OR TOTAL IS 12 STATUS: LOSER SUBTRACT ONE FROM THE SCORE STATE = 1 (FIRST ROLL) ELSE STATUS: ROLL AGAIN STATE = 2 (ROLL AGAIN) POINT = TOTAL THE USER JUST ROLLED ELSE (WE AREN'T ROLLING A FIRST ROLL, WE ARE ROLLING AGAIN SO WE NEED TO CHECK THE ROLL WITH THE POINT – THE STATE MUST BE 2) IF TOTAL IS EQUAL TO THE POINT STATUS: WINNER STATE = 1 (BACK TO FIRST ROLL) ADD ONE TO THE SCORE ELSE IF TOTAL 7 STATUS: LOSER STATE = 1 (BACK TO FIRST ROLL) SUBTRACT ONE FROM THE SCORE ELSE STATUS: ROLL AGAIN STATE = 2 (ROLL AGAIN) **THAT SHOULD HELP YOU UNDERSTAND WHAT NEEDS TO BE DONE TO CREATE THE GAME. Test your game. Are you lucky? Be creative and add your own style to the user interface. Test and debug your program. When everything works, demonstrate your program to your lab instructor. Be sure that you have your lab instructor signs and dates your lab to receive credit. EGR 1400
Feb 28, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here