Poker Hand Comparison Tool

ArmellineArmelline Member, PRO Posts: 5,458
edited January 2014 in Working with GS (Mac)
Okay, so inspired by the epic, daunting task that @Fajlajp has set out for himself, I figured I'd kill some time this weekend in the mental exercise of creating a functioning poker hand comparison tool in GameSalad.

This is something easy to do in just about any programming language that has arrays, but was a real challenge in GameSalad. The fact that it wasn't attached to an actual poker game made it even more challenging!

There are numerous additions GameSalad could make to the creator that would trivialise this task. Sortable arrays, the ability to return an attribute from a max() or min() rather than just the attribute's value, loops (I didn't use any nightly behaviours, so I don't know how robust the new loops are).

I'm pretty pleased with the result, and I've been playing with it all day and haven't managed to trip it up yet. I think the suit sorting is working now too, but not 100% on that.

Take a look! Updated the video to an EVEN MORE BORING ONE!



I don't really know what to do with it now. As far as I know, this is the first time this has been done in GameSalad (identifying poker hands has been done, but I can't find any examples of comparing poker hands).

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This is really impressive!

    What to do with it? Well, I'd say either post the project file here and/or in the Spare Code thread or sell it as a template on GSHelper or DeepBlueApps.
  • ArmellineArmelline Member, PRO Posts: 5,458
    edited January 2014
    Well, I put a bit too much time and thought and effort into it to be willing to stick it in spare code just yet (but I will put the code I used to sort the cards - value only, not suits - in - it's just a bubble sort using max(x,y) though).

    Before trying to sell it as a template I'd want at least one guru to take a look at it, check if I've made any really stupid mistakes - like missing that condition in the video - or completely missed a flaw in my logic.

    Selling it as a template is definitely something I'd consider though.

    The logic to do this in GameSalad - in the end - is actually very simple. It's just a matter of breaking it down into steps until every hand becomes a series of simple comparisons.

    I sent it to Fajlajp and it looks like he'll probably be able to incorporate it into his game without too much trouble! :D
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Again, awesome work. I'd love to see your bubble sort file. I posted a sorting method that randomizes table rows in the Spare Code thread and it would be a nice compliment to have a bubble sort as well. And I'm with you about spending so much thought/time on something and wanting to sell it. It's the whole reason I decided to sell my virtual pet template that handles real-time processing of attribute values. It took me so long and so much mental effort that I didn't feel giving it away was appropriate.

    I'd be happy to look over the template for you but I'm a bit swamped at the moment so I'd probably have to wait a week or so to do it. Let me know via PM.
  • ArmellineArmelline Member, PRO Posts: 5,458
    Sure, I'll send it over to you once all this multiplayer madness has died down :D

    I'll try to stick the sort into the spare code thread tonight. It literally is just a series of max(x,y) repeated x times, though, nothing particularly interesting!
  • SocksSocks London, UK.Member Posts: 12,822
    Impressive stuff, I'd do what tatiang says and sell it as a template.
  • ArmellineArmelline Member, PRO Posts: 5,458
    Thank you both for the kind words! As soon as I'm certain it's rock solid, I'll look into perhaps putting it for sale somewhere. I'd certainly have to improve the efficiency a bit and get that suit sorting working properly though...
  • ArmellineArmelline Member, PRO Posts: 5,458
    I've tightened up the sorting logic a bit and removed the timers I had in place so I could see the sorts. The end result is that the sorts are now considerably faster and for some reason the suit sorting *seems* to work as intended now. It's hard to remember what they were before sorts so I may be mistaken though :P Updated video will be added to the first post as soon as it's processed on Youtube.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @Armelline -- That's really great! That looks like a great solution.
    A solid example always beats any arm waiving (referring to my speculations in the other thread).
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Looks pretty rock solid to me! Great stuff! I've tried using bubble sorting before and it works great.

    I'm sure this would make a fine addition to the templates for sale on ghelper. :D
  • ArmellineArmelline Member, PRO Posts: 5,458
    Thanks for the compliments! I'll definitely consider putting it up for sale!

    @RThurman, I think you had some very interesting ideas, but I tried to avoid maths and root my solution in staggered logic instead. I suspect that properly implemented, your idea could end up more efficient.
  • ArmellineArmelline Member, PRO Posts: 5,458
    Just submitted this to DBM so as long as Darren is happy with it look out for it soon!
  • UtopianGamesUtopianGames Member Posts: 5,692
    Pleased to have it on DBM top job!

    Darren.
Sign In or Register to comment.