Allow single play a simple two dice game of chance against

Assignment Help C/C++ Programming
Reference no: EM13166817

Program Specication:

Write a program that allows a single Player (the user) to play a simple two dice game of chance against

"The Odds".

Game Description:

There is a single player, with two six sided die.

The sides of each die are labeled with the numbers from 1 to 6, we will call this the value of the die.

A game is made up of rounds, a single round is played as such:

1. The player rolls their two dice.

d1 = (int)(Math.random() * 6) + 1;

d2 = (int)(Math.random() * 6) + 1;

d1, d2 declared as type int before the game loop.

2. The dice are displayed, in some reasonable format.

3. A determination is made as to whether or not the player won the round, this determination is

made via the following rules:

{ A Pair is when both dice have the same number on their top faces. If the player has any

pair then they win the round.

{ A Straight is when both dice have a dierent number on their top faces - but they are

consecutive numbers. If the player has any Straight then they neither win nor lose the

round.

{ A Junker is then anything that is not a Pair or a Straight. If the player has any Junker

then they lose the round.

4. The result of the round (with respect to the Player) is reported.

The player is asked if they wish to play another round.

Once the player indicates that they do not wish to play another round: Before exiting, the program

displays a short report stating how many rounds were played, of those - how many were won and

how many were lost.

 

Sample run(s):

Welcome to Computer Dice

-------------------------------------

You will first roll your dice

Next the outcome of your roll will

be determined:

any Pair and you Win

any Straight and you just roll again

anything else and you Lose

--------------------------------------

Player

--------

5 1

Sorry, you lose!

Do you wish to play again [y, n] : 5

Do you wish to play again [y, n] : yes

Do you wish to play again [y, n] : y

Player

--------

2 6

Sorry, you lose!

Do you wish to play again [y, n] : y

Player

--------

4 4

Congrats, you win!

Do you wish to play again [y, n] : y

Player

--------

3 2

Its a tie!

Do you wish to play again [y, n] : y

Player

--------

2 3

Its a tie!

Do you wish to play again [y, n] : n

Computer Dice Results

---------------------

You played 5 rounds

Rounds won : 1

Rounds lost : 2

 

 

Reference no: EM13166817

Questions Cloud

How many groups could be formed : A dancehall contains 173 men and 238 women. A certain "promenade" calls for the formation of groups, with each group consisting of one man with two women. a)How many groups could be formed? b) which sex is in excess? By how much? (show calculation..
List and describe at least three prokaryotic cellular featur : List and describe at least three prokaryotic cellular features that could be targeted in this way to inhibit or kill a bacterial pathogen.
Distinct integers that has the following property : You have an array A[0], A[1], ..., A[n - 1] of distinct integers that has the following property:The values in the array increase up to index p for some p between 0 and n - 1, and then decrease for all indices beyond p through positio
How many possible isomers could exist for diacetylferrocene : How many possible isomers could exist for diacetylferrocene? Explain. Calculate the volume of 3M aqueous sodium hydroxide needed to neutralize the acetic and phosphoric acids in the synthesis of acetylferrocene?
Allow single play a simple two dice game of chance against : Write a program that allows a single Player (the user) to play a simple two dice game of chance against
What is the osmotic pressure of a solution : What is the osmotic pressure of a solution made from dissolving 85.0g of glucose in 800ml of water at 19.0 C.
Assume an n × n matrix a is given : Assume an n × n matrix A is given, containing only 1's and 0's, such that, in each row, all 1's come before all 0's. Give an O(n log n) algorithm to count all 1's in A.
Using virtual methods, organize the animals : Using virtual methods, organize the animals in a small zoo, having as guests lions, parrots, alligators, penguins, elephants, cobras, zebras, hawks, turkeys and rabbits.
What percentang of water was in the hydrate : a 5.0 g sample of a hydrate of CaCl2 was heated, and only 4.3 g of the anhydrous salt remained. what percentang of water was in the hydrate?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd