Help finding a sequence in the cards

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hi, first of all sorry if i commit any mistakes, english is not my primary language and if you could correct me i would be very gratefull.

    So, I am programming a card game, like poker, but I'm having difficulties on making the sistem detect if the 5 cards are in a sequence (1-2-3-4-5)
    Example: I have a 5 and a 2, in the table is shown 2-9-6-7-8. How can it detect the sequence with my card "5" and the "9-6-7-8" on the table?

    Thx :3

    Edited once, last by KuroRose: Solved (January 6, 2017 at 6:49 PM).

  • Unfortunately, for anything serious (Poker wise) you are going to need a poker hand evaluation algorithm. Trust me, I have attempted 3 times at a full-scale serious development and it's not as simple as you'd expect.

    You *could* just work your way around a few things by stacking values together and running them through your own parser but in the long run, it's not viable as you need an algorithm to rank the hands. Say for example, you have four players playing Texas Hold 'em, it would be near impossible to scan all the cards and link them in a way where you can deem a winner. Secondly, if a user leaves the game (down to 3 players) or a user joins the game (5 players) you are increasing the parsing routine by a hundred-fold. You literally need an algorithm to determine the hand winner in THP.

    Generated Lookup Tables are probably the easiest way if you are going to proceed with a THP engine.

    Here's another tip: Please login to see this link.

    You could signup to an online algorithm in which you pass the data over in the form of an array and it will parse it all and send back all the info you would need.

    They are some starting points, at least...

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • Hi, thanks for the reply.
    Actually, I already did everything for a poker game, i used 30 counters and a few variables, but I couldn't figure out an way to do a "check sequence", every other possibility (difficult word t.t) is already done (flush, full house, pair, etc) it is amazing how useful counters are :P

    But thank you for the tip, I'll study it too.

  • Yeah there are some neat ways of approaching these gametypes in Fusion but ultimately you will need an algorithm to assist with the hand evaluations.

    Best of luck, keep me posted!

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • Done, solved it. I just created a list ny numerical order of the cards.
    If Val(line 1) = Val(line 2) - 1
    Val(line 2) = Val(line 3) - 1
    Val(line 3) = Val(line 4) - 1
    Val(line 4) = Val(line 5) - 1
    Do thing.

    It was quite easy when i meet the list object

  • And how do you propose to sort the low straights from the high straights? Also, split hands? How would you rank a straight flush, full house or a flush over a straight? I'm interested...

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • As an idea of how I might do it - Those hand types are pre-defined - So as soon as you have detected your combination set a value to that player based on that combination.
    so pair = 1, two pair = 2, three of a kind = 3, straight = 4, flush = 5, full house = 6, Four of a kind = 7, and straight flush = 8 (and royal is the same hand)

    ie: you detect player one has a pair, so his hand is ranked as number 1
    you detect player two has two pair, so his hand is ranked as number 2
    you detect player three has a flush, so his hand is ranked as number 5

    Now once you have the highest ranked hands, any that match ie: two players have a flush, you can throw the other players combinations away and just deal with those two etc - they can then be checked to see who has the higher flush by finding out who has the highest card value? You then have your winner, or split depending on the result.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!