3 Replies - 9468 Views - Last Post: 24 March 2010 - 12:40 PM Rate Topic: -----

#1 RGLAsnakeMan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 05-March 10

Cee-lo (Dice game)

Posted 23 March 2010 - 12:20 PM

I am making a Cee-lo game and I'd like some guidance. I am stuck where I am right now. Here are the rules to the game:

Cee-lo is a gambling game played with three six-sided dice.

The constants include the number of dice used, which is always three. All rules describe certain winning combinations that can be rolled, and 4-5-6 is always treated as a winning combination for the first player who rolls it. Besides the winning combinations, all Cee-lo rules include certain rolls that establish a "point," and there are situations where two or more players will roll and compare their points to determine a winner.

Banking
In this game, the computer is the banker, and all other players make even money bets against the bank. If a player makes a $10 bet, then they stand to either win or lose $10 depending on the roll of the dice. The Banker has a slight advantage relative to the other players.
When a player is established as the banker, they put up an initial stake known as the bank, or center bet. Once they have placed their stake, and announced the amount, the other players have a chance to cover or "fade" their bet. Starting with the player to the banker's left, and proceeding clockwise around the circle, each player in turn can fade a portion of the bank, as much as they like, until the entire bank is covered or every player has had a chance to make a bet.

The banker rolls the dice
When all the bets have been established, the banker rolls the dice.
If they roll 4-5-6, or "triples" (all three dice show the same number), then they instantly win all bets.
If they roll 1-2-3 they instantly lose all bets and break the bank.
If they roll a pair and a singleton, then the singleton becomes their "point." E.g. a roll of 2-2-4 gives the banker a point of "4." then players roll to try to beat the banker's point.
In a two player game, the player who rolls a "1" on the odd die is considered to have been "aced out", losing automatically.
If the dice don't show any of the above combinations, then the Banker rolls again and keeps rolling until he gets an instant win, instant loss, or makes a point.

The player rolls the dice
In any case where the Banker rolled a point of 2, 3, 4, or 5, each player then rolls the dice to settle his individual bet against the banker. They win with a 4-5-6, triple, or any point higher than the Banker's. They lose with a 1-2-3, or any point lower than the banker's. If they tie the banker's point, then it's a "push", no winner or loser, and the player pockets his stake. If they don't roll a meaningful combination, then they continue to roll the dice until they win, lose or push.


#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<ctime>

using namespace std;

 int DIE_ONE = 1;
 int DIE_TWO = 1;
 int DIE_THREE = 1;


int main(){
    
    srand(time(0));     
    
    int bet = 0, human = 0, num1 = 0, num2 = 0, num3 = 0; //banker = 0, pot = 0;
    bool banker;
    
    
    cout << "Welcome to the game of Cee-lo\nMake an even bet $";
    cin >> bet;
    if(bet % 2 == 1){
         cout << "Your bet is uneven, please try again." << endl;
         system("pause");
         return 0;}
    else
         cout << "The banker calls your bet of $" << bet << endl;
         cout << "The banker's roll:\n";
    
    banker = false;
    
    while(banker)
                     
    DIE_ONE = rand() % 6 + 1;
    DIE_TWO = rand() % 6 + 1;
    DIE_THREE = rand() % 6 + 1;
    
    num1 = DIE_ONE;
    num2 = DIE_TWO;
    num3 = DIE_THREE;
    
    
    
    /*if(num1 == num2 == num3){
       cout << "The computer wins" << endl;
       banker = true;
       }
 
    else if(num1 == 1 && num2 == 2 && num3 == 3){
        cout << "You win!" << endl;
        banker = true;}
 
    else if(num1 == num2 && (num3 < num2 || num3 > num2)){
    cout << "Point = " << num3;*/
    cout << num1 << " " << num2 << " " << num3 << endl;//}


    system("pause");
    return 0;
}


I realize the computer's and player's "rules" will look almost identical in code but I am havign trouble with the logic.

Cheers!

Is This A Good Question/Topic? 0
  • +

Replies To: Cee-lo (Dice game)

#2 eker676   User is offline

  • Software Engineer
  • member icon

Reputation: 379
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

Re: Cee-lo (Dice game)

Posted 23 March 2010 - 06:58 PM

You don't have much there. I would suggest writing a little test game out on a sheet of paper and looking at what conditions need to be checked.
Was This Post Helpful? 0
  • +
  • -

#3 RGLAsnakeMan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 05-March 10

Re: Cee-lo (Dice game)

Posted 24 March 2010 - 07:41 AM

Okay. Thanks for your input, I will try this even though I haven't ever before. How do you suggest writing out different conditions and how should this benefit the program.
Was This Post Helpful? 0
  • +
  • -

#4 eker676   User is offline

  • Software Engineer
  • member icon

Reputation: 379
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

Re: Cee-lo (Dice game)

Posted 24 March 2010 - 12:40 PM

For all the different conditions, I would create a function that analyzes the die using a big block of if-elseif or switch statements (Probably not the best way but I can't think of another at the moment).

Then return 0, 1, 2, 3, 4, etc. depending on what conditions were met. Catch the return value in a switch statement and tell the user if they won, lost, whatever.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1