Need help designing my craps program.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Need help designing my craps program.

Threaded View

  1. #1
    Join Date
    May 2012
    Posts
    57

    Need help designing my craps program.

    This will be my first program in C++ and it will be a crap game with every possible bet, just like on a Vegas crap table. I'm using SFML to display half of a crap table and to display the bets (chips) for up to 4 players on the crap table.

    Every bet will be positioned in the proper place in each bet box just like on a Vegas crap table. This means there will be 4 positions on the passline (for 4 players), 4 positions for passline backup bets, 4 positions for each "place bet", etc.

    To give you an idea of what I need, here's some sample bets in a struct:
    Code:
    struct BetInfo
    {
        int betAmount
        const float coordX    // Chip coord X
        const float coordY    // Chip coord Y
    }
    
    // P1=Player1, P2=Player2, etc.
    BetInfo passP1 = {0, 300.0, 700.0};
    BetInfo passP2 = {0, 400.0, 700.0};
    BetInfo passP3 = {0, 500.0, 700.0};
    BetInfo passP4 = {0, 600.0, 700.0};
    
    BetInfo place4P1 = {0, 350.0, 220.0};
    BetInfo place4P2 = {0, 360.0, 220.0};
    BetInfo place4P3 = {0, 350.0, 200.0};
    BetInfo place4P4 = {0, 360.0, 200.0};
    REQUIREMENTS:

    1. When displaying the chips on the table using SFML, I need to scan all of the "betAmount" values. If zero, don't display. If greater than zero, display the proper amount of chips at the coordinates given.

    2. When a player makes a bet, I need to update "betAmount" easily.

    3. When a player loses a bet, I need to zero "betAmount" easily.


    QUESTION:

    1. To display the bets (chips) on the table, I need a for loop to scan every bet position to see if the "betAmount" is greater than zero. But the way I showed the code above does not seem to be a good way to do that.

    2. When a player clicks in a bet box to make a bet, I need to translate the mouse coordinates to know which bet box was clicked in, and then update the "betAmount" for that player.

    Any suggestions on how to store all of the bet info that will allow easy updating of the "betAmount" when bets are made or lost, and yet allow scanning with a for loop to display the bets made.

    Thanks,
    Raptor
    Last edited by raptor88; September 26th, 2012 at 04:18 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center