Member-only story
How to write a poker bot in SwiftUI
Find more useful articles at www.davidseek.com
As some of my followers, and most of my friends know, I love poker. As an engineer, efficiency and automation are always at the forefront of my mind. Therefore, when playing online poker, I always ask myself: How could I make this more efficient?
Obviously, as a lover of the game, I know that cheating, and especially defrauding my opponents is highly unethical, and simply wrong. I would never use, nor would I provide a full tutorial on how to build one.
Yet whenever I played, this inner anxiousness coupled with curiosity continued to resurface. I simply had to prove to myself that I could make such a poker bot if I wanted to.
As is so often in engineering, as well as in physics, ability equals causality.
Because we can
Planning
First we need to make a list of our prerequisites. For a simple proof of concept, we’ll need to be able to satisfy the following requirements:
- Be able to capture a poker table within a poker client
- Analyze the image to recognize the hands and the table position
- Calculate the poker math to decide whether to push, fold, or raise–and by how much.