Well time is almost up, deadline is tomorrow, but since I don’t plan on adding major modifications to my code,I’m going to wrap this up tonight.
Implementation wise this was a nice experience, javascript is definitely a versatile language mostly because it enforces little to no restriction on the code. Unfortunately this also means that this responsibility falls on the programmers’ side. Now in a reasonably sized project that doesn’t have to be split into components this wouldn’t be much of a problem because you’ll most likely have all the information you need in local scope, there’s no need to share information across components. However things get a little interesting when you need to juggle information from one scope to another.
Someone once told me that in this line of work you need to have an iron will to resist the urge of taking the easy way out when implementing a feature. He was talking about hardcoding, but the same principle applies here. Basically when confronted with the problem mentioned above, at first I tend to believe that I took the correct approach in the form of a hierarchical state machine with two layers, the main program that “knows” everything and commands the lower layers based on information received each iteration and then there’s the components.
The peace lasted until I had to implement the AI when my determination to do the right thing was shattered into little pieces when I realized it would need about the same amount of data the first layer had, so I fell into the dark side and took advantage of the fact that javascript assumes a global scope for every variable unless specifically told not to by declaring them inside a function block.
Overall the game runs smoothly on every hardware I tried it on including a HTC Desire (1 Ghz) and a Intel Core 2 Solo (1.4 Ghz) by which I mean that it’s probably safe to assume that it will run smoothly on most hardware (if not any) that can run HTML5, but that is most likely the merit of the great teams that work to make javascript blazing fast rather than my own seeing as the AI uses a plain B* algorithm for pathfinding and the position for a wall is computed by running 98 passes for each available wall position, but overall I’m happy with the result.
Unfortunately there are two other features that I didn’t have time to add, but I felt would have been interesting to have in this prototype mainly a minimax to provide a bigger challenge (the AI isn’t moronic, but it’s not really that hard to beat either) and the possibility of playing over a network.
Now until I find a reliable way for everyone to download the sources, they are available upon request from me, so just drop a comment telling me where you’d want me to send it.
Short Version
Javascript is nice, this project was a good learning experience, if you want the game leave a comment telling me where to send it.




