Software Woes

Rants, tips and tricks

Monday, April 10, 2006

AJAX based chess game... sucks

To quote the Morfik team:

If you take your browsers to this chess game, you might start to understand what I mean. This game has a great interface and is played against you by your own computer. Your moves do not get sent off to a server which comes up with a response and sends a move order back to your browser. The analisys of the play and the decision of the move is entierly done in Javascript, in your own machine, by the browser.

This is a really bad choice for web app. and their example only proves it.

After "check mate"-ing it in only 17 moves, the game started to consume 100% CPU. Luckily Mozilla figured out that it is better to shut it down (see screenshot).

My machine is AMD Turion(tm) 64 Mobile Technology MT-30 running at 1.6GHz. It has 512MB RAM, but only 1/2 of it is really used.

Let's face it. AJAX is cool, but uses are limited. Being web-apps developer myself, I conclude that there are cases for AJAX, and there are cases when it shouldn't be used. The smart developer isn't one who knows how to implement it, but one who knows where and when to implement it.


At 8:51 AM, Anonymous fuad said...

Hi Milan,

It is great that you have had a chance to look at the Chess program and to hear your comments and observations. The purpose of Morfik Labs, where the Chess program is located, is to test the edges of what can be achieved with the WebOS AppsBuilder, from websites, business apps, games etc etc. It is not just about AJAX, but it is about browser based applications. All of the applications located in Labs are alpha and are in constant change as we learn from Morfik Pioneers, bloggers like you and from our own experiences. We therefore welcome any input you can share with us as we are definitely in learning mode.

You may well ask what is so special about the WebOS AppsBuilder that you want to test the browser’s boundaries with it. One of the unique features of the AppsBuilder is that its applications are all written using its ‘visual designer’ or ‘visual designer + high level language’ such as Java, C#, Pascal, Basic. There is NO hand coding of JavaScript, or use of code snippets etc. It is all compiled into JavaScript for applications running in the browser and native code for the server. We are very keen to see if there is any limit to what can be achieved in the browser using this methodology. As you have quite rightly pointed out “The smart developer isn't one who knows how to implement it, but one who knows where and when to implement it”. Of course, the smart developer needs to know what the limits are empirically and not just subjectively, hence Morfik Labs.

Today we released version 0.4 of the Morfik Chess application. This version uses a chess engine developed with WebOS AppsBuilder using Object Pascal and compiled into pure JavaScript and HTML so that it can run in the browser. It is able to compute at least 2 moves deep. We believe this is the world’s first implementation of a chess engine in JavaScript.

I need to point out that we are system developers, not chess engine experts. We have never written a chess engine before. The code in v0.4 is not optimized nor is it the most efficient way of writing a chess engine. Our source code is open and we hope interested individuals will take on the challenge to work with us to take this application or its descendants to the next level. They are also welcome to take the code and independently develop a browser based chess engine/application. We hope given your experience as a web-apps developer you may be inclined to give us a helping hand.

Either way, have a happy and good Easter.

PS. The latest release includes a fix for the bug you found, hopefully we have not introduced too many more bugs…. of course our excuse is that it is an alpha release :-)

At 6:59 PM, Blogger Milan Babuskov said...

Well, ok. I understand it is only a proof of concept.

I propose you to change it to work better. Move the computation system to server. It would:

- work faster
- not hog the browser
- you can use GNUchess or similar program that is good challenge

This way you would even more show how AJAX is good. You move the CPU-intensive task to the server and just get the result (AI's move) and display it.

Good luck with AppsBuilder, it really seems to have bright future.

At 10:28 AM, Anonymous fuad said...

Hi Milan,

Have a play with the new version of the Chess apps (v0.5). It now looks 4-ply ahead and resolves browser errors caused by entensive JavaScript computing.

At 2:12 PM, Blogger Milan Babuskov said...

This comment has been removed by a blog administrator.

At 2:13 PM, Blogger Milan Babuskov said...

This comment has been removed by a blog administrator.

At 2:13 PM, Blogger Milan Babuskov said...

Current version is even more fun. It didn't detect where the king can move, so it moved it into check position. I was able to "eat" the king and keep playing!!!

Ok, you proved the concept, but the chess AI sucks ;)

At 11:58 PM, Anonymous L505 said...

It let's me do two moves in the latest version at times (a free move) and the 120 second level game doesn't take 120 seconds it takes more like 500-1000 seconds at times.

At 11:54 PM, Blogger mishoo said...

Try this one as well:

AJAX based (but it doesn't contain a chess engine though; this is simply too much for JavaScript; you can play against strong engines such as Crafty or Fruit, or against other human opponents online).

At 9:48 AM, Blogger Milan Babuskov said...


The link you gave is not really AJAX, it's Flash based.

At 6:03 PM, Blogger Bruce Fredman said... is currently in the progress of choosing chess blogs/clubs to receive recognition from as Top Resources. This award is not meant to be anything other than a recognition that your blog/Clubs gives information about tactics that directly or in directly raise Chess awareness. Simply place the award banner code on your site and your resource will be listed as a Top CHESS Resources on once you place it. is a Private Global Chess Server which offer FREE Chess Games and Guidelines for learning chess and whose goal is to promote Chess (which game has lost his fan base) through the spread of information globally. Thank you for your dedication to your Club/blogs. Please reply me back with the subject line as your URL to avoid spam and to make sure that you only get the award banner.


Post a Comment

Links to this post:

Create a Link

<< Home