dcsimg
Results 1 to 7 of 7

Thread: VB6 Two days later ...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Location
    Athens
    Posts
    20

    VB6 Two days later ...

    l've decided to make a poker game . l call it Open Poker . There are 4 players , and each one gets 5 cards . The cards appear fine
    in their personal space on the screen , they have the option of changing up to 4 cards which they do and the new cards appear
    fine replacing the old ones . So far it works great and the cards of each player are identified ( ex. 5 of Hearts ,Queen of Spades
    etc but sorry for that , they are in Greek ) . Now each player looks at his/her hand and knows whether he/she is a winner or not BUT
    what l want is for each hand to be code evaluated and in a text box for each the value to appear . Also who is the winner by comparing
    the values .
    Have been trying for the last couple of days to find some code and adapt it , but so far no luck .
    l don't now if l made myself understood , but if l did , l will apreciate it if someone could help .

    Thanks in advance


    PS . The numbers above the cards are shown for reference .

    Name:  OpenPoker.jpg
Views: 139
Size:  68.9 KB

  2. #2
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    279

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,712

    Re: VB6 Two days later ...

    Thread moved from CodeBank, which is for finished snippets rather than asking questions.
    My usual boring signature: Nothing

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,855

    Re: VB6 Two days later ...

    If you can see everyone's cards is it really poker at all?
    Seems that to do 4 player poker you would need 4 copies of the program talking to each other and running on different computers so each player sees only his/her cards.

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,095

    Re: VB6 Two days later ...

    Comparing values to decide the winner? You may want to use some sort of table or multiplier. Just an idea...

    There may be better ideas from others that have created poker games themselves.

    an example with multipliers, assuming cards are ranked from 2 (deuce) to 14 (ace)

    high card only, ex: Q 9 5 4 3
    sort in descending order
    Q+64 + 9+48 + 5+32 + 4+16 + 3
    a pair, ex: 8 8 Q 9 3
    sort pair first, then rest in descending order
    (8+64 + 8+48 + Q+32 + 9+16 + 3) + 500
    two pair, ex: A A 8 8 9
    sort high pair first, low pair next, then last card
    (A+64 + A+48 + 8+32 + 8+16 + 9) + 1000
    3 of a kind, ex: 5 5 5 Q 9
    sort 3 of kind first, then rest in descending order
    (5+64 + 5+48 + 5+32 + Q+16 + 9) + 1500
    straight not same suit, ex Q J 10 9 8
    sort in descending order
    (Q+64 + J+48 + 10+32 + 9+16 + 8) + 2000
    flush same suit, ex: Q 9 5 4 3
    sort in descending order
    (Q+64 + 9+48 + 5+32 + 4+16 + 3) + 2500
    full house, ex: Q Q Q 5 5
    sort 3 of kind first
    (Q+64 + Q+48 + Q+32 + 5+16 + 5) + 3000
    4 of a kind, ex: A A A A 9
    sort 4 of kind first
    (A+64 + A+48 + A+32 + A+16 + 9) + 3500
    straight flush or royal flush, ex: Q J 10 9 8 or A K Q J 10
    sort in descending order
    (Q+64 + J+48 + 10+32 + 9+16 + 8) + 4000

    For something like the above to work, you want to sort the cards so the hand looks like the above examples. After sorting, the 1st card is added to 64, 2nd added to 48, 3rd added to 32, etc. The reason for the multiplier being 16 apart is that the highest card value (ace) has a value less than 16. The offset at the end of the calculation is to ensure the different categories are rated higher than others. Why 500 intervals? If theoretical hand had 5 Aces, then A+64+A+48+A+32+A+16+A = 230 (where A=14) which is less than 500. Could use 250 or any other value > max theoretical hand.
    Last edited by LaVolpe; Yesterday at 01:28 PM. Reason: formatting
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Location
    Athens
    Posts
    20

    Re: VB6 Two days later ...

    @ LaVolpe thank you for your trouble .

    However this is all veeery Greek to me and l don't even know how to apply it to the code of my project .

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,095

    Re: VB6 Two days later ...

    Sorry, can't help you there. It is your project. My suggestion was just one example of ranking cards, by type of hand, to calculate a number that will guarantee the higher calculation is the best hand and being able to rank all hands relative to each other. You have to find a method that works for you.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width