Share to

You can earn money or coins from your share:)

Tips: you can use Sparticle for uploading away3D effects.

Tips: you can download Sparticle for uploading effects.

Tips: The ActionScript editor is supporting Away3D, Starling, Dragonbones and Flex frameworks.

Tips: paste the web page URL then click button:) Your Best Source for Gaming
Login    or

The AI in The Octagon Theory-Testing and Future Work

Q: How did you test your AI?

DH: The old Apple II version of TOT could play AI against AI. But it was the same AI just taking turns so it wasn't used for evaluating AI algorithms. But it was sure fun to watch.

The new AI was just playtested by me, some beta testers, and my 90-year-old Japanese Mother-in-law who I refer to as the Chief Beta Tester. She is really sharp and many of the current UI mechanics came from her suggestions. But most importantly, the AI constantly improved due to her year's worth of play-testing. She'd easily beat the early versions of it, find bugs, and point out stupid or illogical moves that the AI would make in certain situations. (The easier AIs even now make some stupid moves). I'd make improvements, give her the new versions, and she kept play-testing. She'd play for hours every day. After about of year of this we decided that the AI was pretty good because my mother-in-law, nor I, could seldom beat the stronger AIs. The strongest AI that shipped with the game was probably the fifth major iteration.

Q: How did you approach the porting from the older version to Corona and the iPhone/iPad versions?

DH: Getting the old Apple II version of TOT to the iPhone/iPad wasn't so much of a port as it was a complete redo because I don't have a digital version of the source code, just an old dot matrix printer printout which I shallowly reviewed to refresh my memory. I then thought about how I could add more strategic depth to the game. That's when I came up with the 1, 2, and 4 pieces that could be rotated. With that new concept in mind I considered porting TOT to the Nokia N-810 which I had at that time. But the dev tools that were available for that platform were not integrated and were overly complicated, and the iPhone was really starting to hit its full stride. So before I even bought an iPhone I read some iOS dev books and liked what I saw...the tools and development environment was tightly integrated.

I then bought an iPhone, signed up for Apple's iOS Developers program, and tried the standard Apple development approach using Objective-C and Cocoa Touch. Obj-C and OOP programming weren't hard but trying to learn the Cocoa Touch library was a bit much. There is just so much to it and it seemed like it'd take forever to learn it well enough to be able to accomplish anything substantial with it. That's when (I don't remember how) I came across Ansca Corona. And it blew my mind. A week after downloading the free version I had a TOT proof of concept running, something I couldn't achieve with Obj-C/Cocoa Touch even after six months of study. A good example of why developing in Corona was so much faster was that you could get an image on the screen with just one line of Corona code while doing the same in Obj-C/Cocoa Touch would take a whole page of code.

The current skin (images) of the iOS version of TOT, the Octagon Theory website, and the on-line, two-player Flash version of TOT were all done by my partner Ben Walker at

Anyway, the whole concept of TOT was in my mind and I pretty much remembered how I coded the old Apple II version so I just started coding away - with no serious design documents or specifications.

I completed TOT after a year and a half of twenty to thirty-hour weeks. About half of that time went into trying different graphical designs (We settled on the design done by my partner, Ben Walker), polishing the UI mechanics, and getting the AI right.

Future Work

Q: Do you plan further improvements of the AI? What features would you like to add to the AI?

DH: The next AI improvement I want to add is depth search. Currently the AI just uses brute force and makes it's decisions based on the current game state. It doesn't choose the best move based on looking a number of turns ahead at the repercussions caused by each possible move. I'd also like to try dynamic weighting of the board in that each position's weighting adjusts based on the current turn's board pattern. Currently it is static. I also want to try adding an intentional blocking ability - currently it may seem that the AI is blocking your move but that is entirely unintentional and is because of some other calculation the AI has made. And of course I want to try a minmax or negamax-based AI.

“I'd love to have AI vs AI competitions..”

But although I want to improve the AI in my game I believe there are many people who can create much stronger AI than I can. Therefore I really want TOT to catch on, especially among AI aficionados. I'm hoping that a community will form around TOT, a TOT AI Modders community so to speak that will design their own custom AI players that can be hosted on their own local or remote 'AI servers'. Of course once (if) a community forms I'd love to have AI vs AI competitions.

With the above in mind I can provide anyone who is interested with a TOT AI Modders Kit which includes a complete AI server and Lua source code for an example AI player. This can be run on a home computer (Lua and LuaSocket has to be installed) or even on an iPad or iPhone if iLuaBox is installed.

Also included is an TOT AI API document that explains everything and how to design your own custom AI. The included Lua source code for the AI player can be played around with, customized and modified, and then played against to see how your mods perform. Then when you become more advanced you can design your own completely new AI and plug it into the AI server API.

Although every version of TOT has been designed with the ability to access remote AI servers, this feature is disabled for now. But in mid-June I released "TOT AI", a special "AI Modders" version of TOT. This is different from all the other versions of TOT in that the feature that allows the entry of an AI Server IP address is enabled. I have intentionally priced this version very high ($10 USD in iTunes App Store) to keep the average person from buying it (but one guy already bought it, hmmm). TOT AI is available so that TOT AI Modders can easily get their hands on a client that allows testing of a custom AI running on a server. Anyone who is seriously interested in becoming a TOT AI Modder, and is thinking of buying TOT AI, should contact me BEFORE BUYING IT.

If you enjoyed this interview TOT can be bought from its webpagewhere you can also play it online against human opponents. If you want to develop a bot for TOT get in contact with Dan at and post your ideas for AI in the comments or on our forums!


You must Sign up as a member of Effecthub to view the content.

1733 views    0 comments

You must Sign up as a member of Effecthub to join the conversation.


Or Login with Your Email Address:

Or Sign Up with Your Email Address:
This field must contain a valid email
Password should be at least 1 character