Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need to create a program in Perl that will allow the user to play craps. Here are some of the specifics and the rules for craps:
The program should allow the player
to make a wager before each “turn”. Before each turn, allow the user to either
place a bet or exit the game. After each turn display the player’s current balance.

Specifics
Each player will start with $500.00. Initially, and after each turn give the user the
option of betting or leaving the program. Implement this any way you wish, but
make it clear to the user what their options are. If the user chooses to place a
bet, ask for the amount that will be wagered and start that “turn,” or bet. Each
turn will consist of one or more rolls of the dice. For each roll, the program should
display the result of both die and the total value of the roll. Then indicate the
outcome from that roll (win/lose/continue rolling). Once a turn, or bet is finished,
indicate the outcome of the bet and the updated balance. When the user
chooses to exit the program display their final balance. The use of vertical
whitespace in the output may be very useful in making the output readable.

Rules for craps
Total value of dice after first roll:
7 or 11 – player wins
2, 3, or 12 – player loses
Any other value and the player rolls again – the total of the dice is now their
“point”

I just need some guidance on how to tackle this problem. Thanks!

What I have tried:

I haven't started because I am unfamiliar with the Perl coding language.
Posted
Updated 29-Sep-19 18:03pm
Comments
Richard MacCutchan 30-Sep-19 5:07am    
Use a language that you are familiar with. Perl is never a great choice.
[no name] 30-Sep-19 7:33am    
Write a program to generate a random number between 1 and 6. Make two.

If you're not familiar with Perl, what do you want from anyone answering this?

Step 1: You MUST learn the language before you start writing code in it.
 
Share this answer
 
Quote:
I am unfamiliar with the Perl coding language.

Bad idea !
It is like trying to win a Formula 1 GP while learning to drive, it don't work that way.
Millions of people have learned programming:
1) Lean programming with courses or tutorials, do tiny exercises.
2) Solve more complicated projects as you gain experience.
3) Tackle personal projects.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900