Simulate a simple version of a game called liar dice

Assignment Help JAVA Programming
Reference no: EM13334127

You are going to simulate a simple version of a game called Liar Dice.The rules are as follows:

The first player claims a Poker hand (see "Hand Ranks" below for legal calls). When making a claim, a player says what all five dice are, not just the name of the hand. For example, a player should say, "I have a full house: three 4s and two 5s," not simply "I have a full house."

A player does not need to actually have the hand he claims.

His opponent then has a decision to make. She can do one of three things:

Claim a higher hand;
Roll again (up to two times) and claim a higher hand; or
Challenge and lift the screen.

Claiming a Higher Hand

If a player claims a higher hand, her opponent must then choose from one of the three options above.

Rolling Again

A player is entitled to a total of three rolls in a round. After the first roll and before the second, he may set aside any number of dice. (Any dice which are set aside are not revealed to his opponent.)

When a player chooses to rolls again, he must then also claim a higher hand.

After rolling the third time, a player's only choices are to claim a higher hand or lift the screen.

Challenging and Lifting the Screen

When a player challenges a claim and lifts the screen, the round comes to an end. If the challenged player has as good a hand as she claimed, or better, she wins the round. Otherwise, the player making the challenge wins.

Hand Ranks

The possible hands are ranked as follows:

Five of a kind, e.g. 4-4-4-4-4
Four of a kind, e.g. 2-2-2-2-6
Full house, e.g. 6-6-6-1-1
High straight, 6-5-4-3-2
Low straight, 5-4-3-2-1
Three of a kind, e.g. 5-5-5-2-1
Two pairs, e.g. 3-3-2-2-4
One pair, e.g. 4-4-5-3-1
Runt, e.g. 6-5-3-2-1

In this program, you are going to simulate a single hand and give the user the ability to roll again or declare a claim.You will simulate rolling 5 dice and then showing the dice to the player.They can then roll again or make a declaration of their claim.In order to do this, you will need an if statement.I would suggest the following:// print out a choice// 1. Would you like to make a claim?// 2. Would you like to roll again?// user enters 2.// you create an if statement like this:if(answer == 2){// roll again}else{// prompt the user for their claim and then print out their claim and show their hand.}

Reference no: EM13334127

Questions Cloud

Calculate the one year total rate of return for the bonds : You are choosing between one-, two-, and three-year maturity bonds all paying annual coupons of 8.75%, once a year. You strongly believe that at year-end the yield curve will be flat at 9.75%.
Write program that uses top five countries national wealth : Write a program that uses the top five countries' National Wealth to calculate the average of those five countries.
Find the new capacitance with this dielectric inserted : A parallel plate capacitor has a capacitance C when there is no dieletric inside of it. Suppose a wedge of material with dielectric constant K is inserted in between the plates of the capacitor, find the new capacitance with this dielectric inserte..
Determines the surface area and volume of a hemisphere : Write an application that reads determines the surface area and volume of a hemisphere and then calculates the radius given a surface area and volume.The first step is to read in the radius from the users and then calculate the surface area and vo..
Simulate a simple version of a game called liar dice : The first player claims a Poker hand (see "Hand Ranks" below for legal calls). When making a claim, a player says what all five dice are, not just the name of the hand. For example, a player should say, "I have a full house: three 4s and two 5s," ..
Determine what is the size of the settlement on a jury : You are serving on a jury. A plaintiff is suing the city for injuries sustained after a freak street sweeper accident. In the trial, doctors testified that it will be five years before the plaintiff is able to return to work.
Define physical property can be observed without a chemical : A chemical property of a substance can be observed without changing its composition or interacting with another substance. -A physical property can be observed without a chemical reaction.
Find an optimal global alignment : Find an optimal global alignment
What is the change in the period of the pendulum : A simple pendulum uses a steel wire as the "string." The length of this wire is 1.5 m at room temperature. What is the change in the period of the pendulum

Reviews

Write a Review

JAVA Programming Questions & Answers

  Design a java program that simulates a slot machine

Design a java program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. ? Instead of displaying images, the program will random..

  Teaching software componentization

Describe one way in which one could apply Java graphics in education. Provide one example of such use to support your response and analyze at least three commands that you would use in order to draw a bar chart. Provide a rationale for your respons..

  Write program using a switch statement that display polygon

Write a program using a switch statement that displays the name of a polygon with sides between 3 and 12 depending on the number entered by the user

  Uses a 2-d array to store the highest and lowest temperature

Write a program that uses a 2-D array to store the highest and lowest temperatures for each montjh of the year. The program should output the average high, average low, and highest and lowest temperatures of the year. Your program must consist of ..

  Java program for line item application

This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c:java1.6ch06LineItem directory and review this code.

  Write java program to select pine for furniture company

Write down the Java program for the furniture company. Ask user to select P for Pine, O for Oak or M for Mahogany.

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

  Write java program which will permit user to input data

Write the Java Program which will permit the user to input data. The data will be validated using a loop that requires the user to input the data until it is correct or in the correct range. T

  What about percent values and currencies

List three debugging techniques, within the debugger, that can be used to locate logical error in the Java code. For each of these tools, explain what purpose it serves, and how it relates to the debugging process.

  Display random numbers to simulate rolling a die

1. Display random numbers to simulate rolling a die2. Create a java program that simulate a casino game. (rollin a die)

  Draw a uml diagram of each of the shapes

Draw a UML diagram of each of the Shapes, Rectangle and Square classes using the code that has been provided. Complete this using the examples that have been provide in the lecture slides - Sample program is provided that creates a list of shapes ..

  Design a program that asks the user to enter a series of 20

Number Analysis Program: Design a program that asks the user to enter a series of 20 numbers

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