Cribbage vs Robots

I’m experiencing a bit of a creative streak recently, creating several new games so far this year. I returned to app game development after more than a year away from it. My first game in this series, Island Golf, was a success in that I enjoyed making it, remained focused on the app all through development, and really took the time to fine-tune it before release. The result was a good game that had no major problems, even if it wasn’t much of a success in the store.

I followed that up with Nonograms Unlimited. Nonograms are en existing game, so I was simply implementing my version of that game. But this game, which includes ads, was more of a success. I won’t make a ton of money from it, but it looks like it will contribute a small piece to my bottom line from now on.

My third game, just released, is Cribbage vs Robots. Cribbage, of course, is an existing game. So this is just another chance for me to implement it better than existing apps. I think I’ve done a good job at this. I played a lot of other apps and figured out what I like and don’t like about them. I tried to make it quick and easy to play, removing all frustrations in handling the cards on a touch screen.

Since Cribbage is a two-player game, and I wanted to make a one-player app, I had to write a game AI to challenge the player. Writing a Cribbage AI is challenging, as most are. But you really need to balance the intelligence of the AI with its ability to make mistakes. No one likes to play a game and lose. People like to win. And playing against a perfect AI would make this a really bad game. At the same time, a perfect AI would take up a lot of processor time to run all of the numbers. So making a perfect AI and introducing some randomness to it wasn’t the way to go.

So I tried three different approaches. The first plays based off some basic rules that beginner Cribbage players are often told. So it looks for things in its hand and during the play, and applies the rules. The second uses a much more complex set of rules taking into account most situations and also looking at point values of cribs very closely to compare moves. The third is very different, running simulations of what would happen if cards were played or placed in the crib. Instead of considering all possible outcomes, which would take a lot of computations, it runs thousands of simulations based on decisions and picks the card(s) that score the best.

I liked all of these AIs. That’s why I decided to include them all in the game. This led me to the idea of creating “robots” that you could play against, each using a different AI, plus a random element to them to make them more unpredictable. So 6 different robots, two for each AI plus one a little more random than the other.

I actually come up with a fourth AI that I didn’t use, but was very interesting. This was my placeholder AI that I used to test the interface during early development. It was a completely random AI. It picked a random valid card to play each time. The surprising thing was that it played pretty well. After all, to pick 2 out of 6 cards for a crib is only 15 possibilities. So that’s a 1-in-15 chance of getting it perfect, and probably a better than 50% chance of making a reasonable decision that a beginner human would make. Then for the play, there is really only a 1-out-of-4 choice to make, followed by a 1-out-of-3, then a 1-out-of-2, then only one card to choose from. So there aren’t that many options. Often the random choice was reasonable, and sometimes it seemed like the random AI was being very clever.

From reading other developer blogs I know what to expect now. I will get complaints that the AIs are too hard. I will get complaints that they are too easy. I will get complaints that they “cheat” even though they do not. I will get requests from people to include their favorite Cribbage rule variations or suggestions to speed up or slow down gameplay. Cribbage players are very passionate about their game. But the main thing I need to focus on is the game’s success. I can worry about adding options and pleasing players if the game is successful.

Meanwhile, I am already well into the development of my next game. But this is going to be a bit of a weird one. I started making a word game. But the way the game looked moved me to making it a trading game. Right now it is both. I’m not sure anyone will want to play such an odd game. We’ll see how it goes.

Posted on April 24, 2018 at 10:34 am by site admin · Permalink
In: General

Leave a Reply