Video Poker Takes Your Money In 10 Lines Of BASIC

It wasn’t easy, but [D. Scott Williamson] succeeded in implementing Jacks or Better Video Poker in 10 lines of BASIC, complete with flashing light and sound! Each round, one places a bet then plays a hand of 5-card draw, hoping to end up with Jacks or better.

This program is [Scott]’s entry into the 2024 BASIC 10 Liner Contest, which at this writing has concluded submissions and expects to announce results on April 6th 2024. Contestants may choose any 8-bit computer system BASIC, and must implement their program within ten lines of code (classically limited to 80 characters per line, but there are different categories with different constraints on line width.)

10 lines of BASIC is truly an exercise in information density.

We’ve seen impressive 10-line BASIC programs before, like this re-implementation of the E.T. video game. (Fun fact: while considered one of the worst video games of all time, there’s a compelling case to be made that while it was a flop, it was ahead of its time and mostly just misunderstood.)

These programs don’t look much like the typical BASIC programs many of us remember. They are exercises in information density, where every character counts. So we’re delighted to see [Scott] also provides a version of his code formatted and commented for better readability, and a logical overview that steps through each line.

He spends a little time talking about the various challenges, as well. For example, hand ranking required a clever solution. IF…THEN conditionals would rapidly consume the limited lines of code, so hands are ranked programmatically. The 52-card deck is also simulated, rather than simply generating random cards on the fly.

The result looks great, and you can watch it in action in the video, just under the page break. If this sort of challenge tweaks your interest, there’s plenty of time to get started on next year’s BASIC 10 Liner Contest. Fire up those emulators!

Continue reading “Video Poker Takes Your Money In 10 Lines Of BASIC”

Programming A Poker Game With GPT Help

Although ChatGPT generated a huge amount of hype around replacing white collar workers completely when it was first released to the public, the general consensus now is that it won’t outright replace anyone yet, but rather people who know how to use it as a tool will replace those who don’t. Getting started with it is not too hard, either, but you’ll of course need a project to work on to familiarize yourself with the tool. [Volos Projects] gave himself the challenge of writing a poker game using ChatGPT not as the opposing player, but as a co-designer in order to learn more about it as an assistant.

The poker game is being built on an ESP32 board with a built-in AMOLED screen. Five buttons are wired to the microcontroller to allow the player to select which cards to discard and which to keep. The bet for each hand can be raised or lowered much like the tabletop poker games often seen in bars and restaurants. To program it, though, ChatGPT was used to help design the code at each step of the way, first describing the overall goal and then building each function one-by-one like shuffling the deck, dealing the hand, and then replacing and dealing new cards.

For anyone who hasn’t yet explored using ChatGPT to help design their programming projects, this effort goes a long way to showing just how useful a tool it can be. For more complex tasks, though, it does take a little bit of knowledge on the part of the user because ChatGPT can often turn out nonsense or factually inaccurate information, but at least in a programming environment you’ll generally find out quickly when that happens. It’s not just a useful tool for writing programs, either. It can accomplish a lot of ancillary tasks related to programming as well, even if it’s not writing the code directly.

Thanks to [Peter] for the tip!

Continue reading “Programming A Poker Game With GPT Help”

PokerBot Uses FPGA For Card Calculating Horsepower

Played against humans, Poker is a game as much about reading your opponent as it is about the cards you’re dealt. That doesn’t mean there aren’t certain mathematical ways to aid your decision making based on probabilities. In this vein, a group of students from Cornell’s ECE 5760 class built a pokerbot on an FPGA.

The bot uses the principle of Monte Carlo simulation to calculate the probabilities of an individual winning a hand of Limit Texas Hold’em. Calculating the entire set of possible hands is impractical, so in a Monte Carlo simulation a sample is calculated instead. By accelerating these calculations on an FPGA, the pokerbot is able to calculate 300,000 possible hands in just 150 ms, and present a probability of winning to the human player. This same calculation method is then used to make decisions for the computer players in the game, too.

The team report that the FPGA’s processing power brought a 10x speed up compared to their C++ program running on an Intel i7-6700HQ. The strong statistical calculations help to make the computer players engaging and realistic to play against.

It’s another great example of a project from Bruce Land’s classes, which are somewhat of a hotbed of development each year. Video after the break.

Continue reading “PokerBot Uses FPGA For Card Calculating Horsepower”

AI Beats Poker Pros: Skynet Looms

There have been a few “firsts” in AI-versus-human gaming lately, and the computers are now beating us at trivia, chess and Go. But in some sense, none of these are really interesting; they’re all games of fact. Poker is different. Aside from computing the odds of holding the winning hand, where a computer would obviously have an advantage, the key to winning in poker is bluffing, and figuring out when your opponent is bluffing. Until recently, this has helped man beat the machine. Those days are over.

Chess and Go are what a game theorist would call games of perfect information: everyone knows everything about the state of the game just from looking at the board, and this means that there is, in principle, a best strategy (series of moves) for every possible position. Granted, it’s hard to figure these out because it’s a big brute-force problem, but it’s still a brute-force problem where computers have an innate advantage. Chess and Go are games where the machines should be winning.  Continue reading “AI Beats Poker Pros: Skynet Looms”

Board Lets You Know When To Hold ’em; Know When To Fold ’em

Don’t mind me, I’m just listening to some tunes during our poker game. Well, that and getting some electronic coaching about poker odds. This board lets you wiggle your toes to input the upcards, and those in your hand. After each entry the gadget will tell you your odds of winning the hand. Take it easy with this kind of stuff, if Rounders was at all realistic, getting caught cheating is a painful mistake.

The thing we find interesting about the system is that it doesn’t use a stored odds database. Instead, the Propeller chip runs a simulation of 1000 hands of poker based on the cards you have entered and uses the results to calculate the odds. [Nick] says that this runs quickly because he’s using multiple cores for the calculations, and it cuts down on the data that the device needs to have on board. Right now the feedback uses a text-to-speech generated voice, but you can customize the audio clips if you’d like. Check out a demo of the device in the clip after the break.

Not looking to get the beat down for cheating? Here’s a poker tournament timer that we assure you is on the up-and-up. Continue reading “Board Lets You Know When To Hold ’em; Know When To Fold ’em”

Talking Poker Timer

[youtube=http://www.youtube.com/watch?v=k8iIuPnXzm8]

This interesting box of buttons is a talking poker tournament timer. Full of useful tools like a binary time display, words of wisdom, countdowns to the end of the game, and even good old “bicycle built for two” mode (around 1:20).  While we find it fairly difficult to understand, we applaud the feature list, especially the song.  He used an Arduino with a voice shield, so there’s not much to the electronics side, but you can download his source code from his site.

[via Makezine]