Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Help with a program?

$
0
0
This is an untranslated version of what i need (Pseudo Code) I desperately need this

Bet=startbalance

Get users choice (Field, Craps, or Quit)

While they didn’t choose quit

If they chose field

Get the persons bet

Until it is valid (not greater than 1000, not negative, not more money than they have)

Roll dice

If roll is 2 or 12

Winloss= twice the bet

Newbalance=balance+winloss

Show balance,’ field’, bet, roll, winloss, newbalance

Balance=newbalance

If roll is 3, 4,9,10, or 11

Winloss=bet

Newbalance=balance+winloss

Show balance,’ field’, bet, roll, winloss, newbalance

Balance=newbalance

If roll is 5, 6, 7, or 8

Winloss=bet

Newbalance=balance-winloss

Show balance,’ field’, bet, roll, winloss, newbalance

Balance=newbalance

If they chose craps

Get the persons bet

Until it is valid (not greater than 1000, not negative, not more money than they have)

Roll dice

If roll is 2, 3, or 12

Winloss=bet

Newbalance=balance-winloss

Show balance,’craps’, bet, roll, winloss, newbalance

Balance=newbalance

If roll is 7 or 11

Winloss=bet

Newbalance=balance+winloss

Show balance,’craps’, bet, roll, winloss, newbalance

Balance=newbalance

If roll is 4, 5, 6, 8, 9, or 10

Roll=point

Show balance, ’craps’, bet, roll

Repeat

Roll dice

Show roll

Until

Roll is point

Winloss=bet

Newbalance=balance+winloss

Show winloss, newbalance

Balance=newbalance

Else

Roll is 7

Winloss=bet

Newbalance=balance-winloss

Show balance,’craps’, bet, roll, winloss, newbalance

Balance=newbalance

If they chose quit

Write ‘thank you for stopping by.

If (startbalance>balance)

Write ‘you entered with’, startbalance, ’and you left with’, balance.

Write ‘thanks for the’, startbalance-balance, ‘donation.’

If (startbalance<balance)

Write ‘you entered with’, startbalance,’and you left with’, balance.

Write ‘You gained’, balance-startbalance,’dollars. Thanks for playing.’






Viewing all articles
Browse latest Browse all 2703

Trending Articles