Challenges are a part of life. It will always throw challenges at you in the form of guys doubting your ability. I was asked to create a simple game solving AI for the classic game 2048. Those of you who had never tried it, google it. I too hadn’t heard about it when I started on this project of mine. I did take a challenge too big for me but it surely taught me a few stuff.
What is AI?
If we go by definition it is something(majorly a system) that can accommodate its changing environment. In short a smart algorithm that can adapt to a situation. For example a game of chess. The ideology of the game remains the same though the board condition can vary vastly over different games. AI is used to solve such situations.
How do you make one?
Basically, its based on the concept of game tree for my particular case. There are various methods but we will stick to ones relevant to my case. What I required was game theory and game trees. What is a game tree? A game tree is used to evaluate possible case scenarios during a game and has a few characteristic. The first one is that every even level denotes player moves and odd level denotes opponents moves. The second one is that every state/node of tree has an associated value. This value denotes success probability of player. The higher this value, the better chances of winning. This value is calculated using utility function. This utility function is the heart of AI. The better it calculates states uniquely and distinctively, the more powerful is the AI. I tried making one it was pretty good but not up to the mark for it requires certain mathematical techniques and approach. Don’t be disheartened, this doesn’t mean you can’t make one. After all you can always start from tic-tac-toe and work your way up.
What about 2048?
Well since AI wasn’t that good of a deal, I converted it to a console version of game instead. I didn’t delete AI files and kept them as a reference for future or project opportunities. If you are interested, you can check out my 2048 repository.