Building an AI (part 1)

Hi again,

After being in hiatus for quite some time I’ve gotten back to programming a bit. I guess there is an ebb and flow with everything.

Back in November I was looking into how I could be Building an AI with ASyncTask, but I never got to feed the thing some rules with regards to how to play the game. This I aim to remedy now. Since this could get pretty lengthy I’m planning a short series as I go though the process of building an AI for the dice game “10.000”.

 

Choosing a method for problem solving

Building an AI can be done in different ways. I haven’t explored the topic that much, but I could see going about problem solving in different ways; neural networks or some other kinds of fuzzy logic, search algorithms or a basic heuristic. I do however have some programming experience with heuristics and I believe that, since we’re talking about a limited problem space like this a heuristic can do the job just fine.

One of the issues at hand is whether or not we want to get the optimal solution i.e. winning as fast as possible. I can see an argument for building an AI that can do this, but I don’t think it would be very fun to play against. The probability built into the game somewhat remedies this, but the AI should strike a balance between being challenging to play against and still being beatable. Another plus for using a heuristic is that they can be made to give us an answer in short time consistently, thus giving the user a better experience.

 

A basic set of rules

When implementing the heuristic I need to come up with some rules that it will consist of. In principle I want the AI mimics the process of a human player asking himself a set of questions at every decision point during his turn and answering them based on a predefined logic (as humans we have the advantage of being able to adjust our evaluation during a game, whereas my AI will have a fixed set of rules).

Questions you could be asking yourself?

  • What is the probability of being able to make points with X dices?
  • What is the reward for rolling the dices?
  • What is the risk for rolling the dices?
  • Is it the last round and do I have the most points?

Joining these together my heuristic becomes:

Rule A) If my chance of success times the reward for rolling the dices is bigger than the chance of failure times the risk, then roll the dice. Otherwise bank the points (if able)

Rule B) If it is the last round and I haven’t got the most points, then keep rolling.

 

What remains to be done?

For now I’ve established a basic set of rules. To determine whether or not the AI should keep rolling I need to feed some numbers into rule A. These numbers I’ll try and calculate in my next post using statistical analysis.

 

That’s it for now 🙂

 

EDIT: To read part 2 go here.

A few updates for the 10.000 dice game

Hi,

Just a few days after the “10.000” app went on Google Play, I’ve added a new version. Well, I actually added two!

Change notes for the two versions are shown here;

Version 1.2 changes
– Improved layout for 7″ screens
– Fixed a graphics error on buttons

Version 1.1 changes
– Fixed a bug for xhdpi devices where background was not being shown
– Added a replay dialog when you finish a game

What’s next?
I also noted more things I want to change in the app, but I can’t promise you that they’ll be ready anytime soon, but consider the following a letter of intent 😉
Amongst these changes are:
– 10″ screen improved layout
– Dialog popup when you can’t lock any dices for points
– Better rules explanations, including the optional rules
– Translations into other languages
– Computer opponent

Hopefully I’ll be able to deliver all this soon 🙂

10.000 not quite ready yet

Hi again

My work on the “10.000” game is making good progress, but it not quite ready for the public eye yet. I got the model finished, but the GUI has posed a few problems that I haven’t gotten solved yet.
I’m hoping that it won’t take more than a few weeks to get it done, so that I can put it on Google Play.

Happy Easter everyone 🙂