Conway’s Game of Life

So, thanks to xkcd I learnt about something cool today that’s been around for ages (wish I’d studied more maths….).

All the sites I found for playing with the simulation had Java applets on them, so I wanted to make a javascript one, I know it’s not a true implementation, because it goes a bit mental at the edges… but it was interesting anyway…

It’s here anyway if anyone wants to play… The timings might be a bit of a problem if you create a huge grid with small squares… so be prepared for Internet Exploder to give you some memory leak issues…

http://dom.hastin.gs/files/gameOfLife/gameOfLife.html

Edit: Updated links.

submitEvents – Javascript form submission handler

Something that I seem to be doing a lot lately, is writing a handler for processing the submission of a form, and since mootools is the JS framework of choice, I’ve written this little class that handles the onsubmit of a form and adds some useful features.

  • Confirmation – Provides an Ok, Cancel input box before proceeding further
  • Submit Button – Disable and change the text on a submit button
  • Information Div – Display a div that lets the user know something is happening
  • Undo – Undo the changes (re-enable a previously disabled submit button, change the information div) that have been carried out by the class
  • AJAX – Submit the form using AJAX instead of the ‘old fashioned’ way

All these should be easily implemented using the class.

Examples are provided in examples.html.

As previously, this work is released under the creative commons share alike license.

Download submitEvents 0.1 (31.9k) (Includes mootools 1.2)

Edit: I really do dislike internet exploder… The above version failed in IE6 (mootools’ form.toQueryString() function). I’ve updated the code to 0.11 which can be found here:

submitEvents 0.11 (32.8k) (Includes mootools 1.2)

Edit 2: Ok, so my hatred for IE, although deserved, was unnecessary in this situation…

I’ve updated the code to use mootools .bind(this) on the ajax onComplete function, this fixed the main problem with IE6 and makes the code look much cleaner. Also the examples file is now PHP instead of static HTML and returns a var_dump of $_POST when the form is submitted.

PS. This will be the final update to this post!

submitEvents 0.2 (32.3k) (Includes mootools 1.2)