Jump to content

Search the Community

Showing results for tags 'logic'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello all. I recently saw a post where someone was asking to get an old poker logic script working and it inspired me to dust mine off and get it operational. I am happy to report I was able to do so (though please tell me if you spot any bugs). I am sure others could code this more efficiently - some of you regex monsters could probably do it with 1 line . That said, the attached pokerlogic.au3 script will evaluate any five or seven card hand and populate a text variable explaining what you have (i.e. "full house", "pair", etc). It will also create the points and kicker scores. With the results you can score hands and create a full game. If anyone is curious about how it works it mainly relies on two initial tests - one will count how many numeric value cards there are in a given hand (i.e. without regard to suits). There can only be 13 possibilities (2 - Ace). It parses the strings representing the cards i.e. "AH" would be ace of hearts and it knows that should be in the last position of a zero-based array (which would be 12 because there are 13 cards in a suit). That array can evaluate everything except flushes so there is another function that creates a count of the suits in a given hand. Five of any one suit is obviously a flush. If that is true then there are additional tests for a royal or straight flush. Points: The points for each level are hard coded so that a stronger hand wins. The numeric values are a bit random. For example, I have a royal flush 1,000,000 points while a straight flush gets 250,000. The kickers all work pretty consistently. There can be between 0-4 kickers in a hand. They should all be the value of the card in card count array multiplied by a decimal place of .01. Therefore, a 12 becomes a .12. The .01 is *= against itself so the values of additional kickers are all next to each other after the decimal place. For example, A and K kickers would be .1211 because the ace is 12 and the king is 11. On that note, kickers starting at 10 are the value of their card (i.e. 10) less 2 so 10 would be .08. Why? Because Ace=12, King=11, Queen=10, and Jack=9. Therefore, by the time you get to a card with an actual numeric value it is always that value less 2. What about 2 you say? 2 is equal to 0. You will always lose if that is your only kicker against any other hand unless you tie (because they also have a 2). I have also included pokerlogictester.au3. That file has a full battery of tests with arrays containing pre-made hands of every type. It can also generate and test any number of random hands. The results of the tests will show up in the console and be written to a local text file with section headers so you can QA the output. The first two tests examine one of each type of hand with five and seven cards respectively are not commented out - they will run if you run the script. Just un-comment the others to run them as well. simple_poker_example.au3 shows how to manually test a single hand with just one line "_evaluatehand($hand)" Please let me know your thoughts and enjoy. JFish pokerlogic.au3 pokerlogictester.au3 simple_poker_example.au3
×
×
  • Create New...