AI Assists in Developing a Poker Tool: My Experience with ChatGPT

AI Assists in Developing a Poker Tool: My Experience with ChatGPT

ยท

5 min read

๐Ÿƒ The Problem: Issues with Velox HUD on Microgaming's People's Poker

I am a Front-End Developer with a basic understanding of web applications, but no prior experience in node.js. When I'm not coding, I indulge my passion for poker by playing fast-paced, three-player games online, known as Velox. On Microgaming's People's Poker platform in Italy, players have been facing issues with using the HUD (Heads Up Display), a crucial tool that provides opponent statistics on the table to inform strategy adjustments. To resolve this, a paid subscription tool called "PeoplesPokerVeloxHud" is available, but I chose not to pay for it and instead, set out to develop my own solution.

Example of poker HUD

๐Ÿ‘“ Analysis: Reviewing Hand History Data and Developing a Solution

Upon reviewing the Hand History data from the poker platform, I noted that the tournament ID was not present in the game titles and had been replaced with the number 1.

Below is an example of hand history with the highlighted problem:

Game #1919291692: Hold'em (10/20) - 2023-02-01T22:37:07
AAMS - Session ID M59F811CC05B59CJN/A
Tournament ID 30581130 Table 'VeloX da 3 Giocatori da 0,20รขย‚ยฌ 1 - No Limit' 3-max Buyin โ‚ฌ0,20+โ‚ฌ0 Seat #1 is the button
Seat 1: giggetto (500 in chips)
Seat 2: centrotende (500 in chips)
... etc ...

To resolve this issue, I realized the need to create a script that continually scans for new or updated Hand Histories and automatically corrects the tournament ID in real time.

๐Ÿค– Seeking Expert Assistance: Utilizing ChatGPT for Python Scripting

The situation provided the ideal opportunity to assess the usefulness of ChatGPT and also gain new knowledge. I sought its assistance in developing my script, despite having no prior experience in Python. With ChatGPT's guidance, I not only created a script that satisfied my needs, but I also gained valuable insights and learned a lot about the Python programming language.

๐ŸŒต Testing the Functionality: Overcoming Unexpected Roadblocks

Excited about my solution, I was eager to test the script. However, I encountered a problem. The script was functioning correctly, but when I imported the hands into PT4, the HUD was not visible on the table. This unexpected issue was a roadblock in my progress, but I was determined to find a solution.

๐Ÿ› Debugging: Discovering the Root Cause of HUD Invisibility

After launching the PT4 logger, I discovered that the root cause of the issue was that the table name, along with all the other tables, displayed tournament ID 1, making it impossible to link the Hand History to the specific table.

This was a critical issue that needed to be addressed to ensure the proper functioning of the HUD.

๐Ÿ’ก Eureka Moment: Finding a Solution through the Tournament Lobby

While attempting to associate the tournament ID from the Hand History with the table, I faced a difficulty. All the windows had the same name and I couldn't access the information displayed on the table view. Despite searching for libraries that could extract the tournament ID, I didn't find any useful results. However, the answer suddenly came to me while I was in the shower. I realized that I could obtain the tournament ID by opening the tournament lobby of the specific table. I put this idea to the test by clicking the lobby button, and a new window opened with the title "Tournament ID-NUMBER Lobby". This provided me with the information I needed.

๐Ÿ”Ž Exploring Resources: Using Pywinauto for Accessing Program Controls

I utilized pywinauto, a powerful library that gave me access to program controls and enabled me to automate actions such as clicking buttons.

# Connecting to the right window
app = application.Application(backend='uia').connect(handle=hwnd)

# Bringing window to foreground
win32gui.SetForegroundWindow(hwnd)

# print_control_identifiers() prints all the available controls
app[title].print_control_identifiers()

# Button click automotion
app[title]['Custom14'].click_input()

To gain a clear understanding of the controls within the program, I used a developer inspector tool.

Through my research of the official pywinauto documentation and various Stack Overflow threads, I found that using the window handle was the optimal way to avoid ambiguity errors when working with tables.

๐Ÿ”ง Optimization: Preventing Errors and Enhancing the Script

Finally, to ensure the stability of my script, I employed the try and except functionality of Python to handle potential errors. This prevented the script from crashing in the event of an issue. And, with the help of ChatGPT, I was able to optimize and refine my code to its highest potential.

๐Ÿ“ฆ Simplifying Distribution: Converting the Script into an .exe File.

Additionally, I sought to convert the script into an executable (.exe) file for ease of use and distribution to other machines. I discovered auto-py-to-exe, a library that allowed me to achieve this goal with ease. A comprehensive guide for using auto-py-to-exe can be found at this link.

๐Ÿฆพ Unlocking the Potential of AI: How ChatGPT Streamlined My Work

In writing this article, I sought the assistance of ChatGPT for text optimization and paragraph titles. My experience has led me to the conclusion that AI is a powerful tool that not only speeds up my work, but also enhances it in numerous ways. While AI cannot entirely replace the human effort that goes into finding solutions, studying and learning the code, reading documentation, and testing various approaches, it has enabled me to create a complex script from scratch with no prior knowledge of Python - all in just one week.

๐ŸŒž Final Notes

For your information, I will not be sharing my work product or code with the public. This creation was intended for personal use, and I don't want to negatively impact the income of other developers who may rely on it to support their families. I hope you enjoyed the content and found it informative on the various applications of AI. If you did, please consider leaving a like to show your appreciation.

ย