User Tag List

Results 1 to 7 of 7

Thread: Help finding a sequence in the cards

  1. #1
    No Products Registered

    Join Date
    Jan 2017
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help finding a sequence in the cards (solved)

    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

  2. #2
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,008
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    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: http://www.binpress.com/app/poker-ha...ithm-7card/545

    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...
    Want to learn Clickteam Fusion 2.5?




  3. #3
    No Products Registered

    Join Date
    Jan 2017
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,008
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    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!
    Want to learn Clickteam Fusion 2.5?




  5. #5
    No Products Registered

    Join Date
    Jan 2017
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  6. #6
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,008
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    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...
    Want to learn Clickteam Fusion 2.5?




  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2006
    Location
    UK
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

Similar Threads

  1. TCG Help: Cards In Hand
    By Krissukun in forum Fusion 2.5
    Replies: 2
    Last Post: 2nd August 2016, 02:21 AM
  2. Display Cards using Deck of Cards extension
    By george_brad in forum Fusion 2.5
    Replies: 1
    Last Post: 3rd December 2014, 08:24 AM
  3. Scramble Cards example
    By Sparckman in forum Guides, Tutorials, Examples, Widgets
    Replies: 0
    Last Post: 22nd May 2014, 03:45 PM
  4. Match cards?
    By KLiK-iT in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th October 2011, 08:10 PM
  5. Cards of Ten
    By nivram in forum File Archive
    Replies: 0
    Last Post: 4th December 2008, 10:01 PM

Tags for this Thread

Posting Permissions

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