Tic Tac Toe and Conway’s Game of Life in Javascript

For the Half-Real website (10 years ago!) I made two example programs to support the book’s discussions: an implementation of Conway’s Game of Life and a Tic Tac Toe program that plays perfectly by simply going through all possible game states.


Time passes, and I can no longer count on browsers running the Java applets that I originally wrote the programs in. They never ran on tablets and mobile devices either. And I dislike websites with broken applets.


So I have rewritten them to work in JavaScript. They feel like they always did, except they launch faster – and run on mobile phones and tablet:



Conway’s Game of Life
Tic Tac Toe

PS. Tech notes: I did this using GWT, which compiles Java code to JavaScript. The good news is that GWT really works and consistently converts all Java logic to JavaScript. The more complicated issues concern (as we may expect) that all UI calls are different, and especially that Java is Thread-based, but JavaScript is callback-based, so any program flow that relies on threads (as in my case) has to completely reworked.

 •  0 comments  •  flag
Share on Twitter
Published on July 30, 2015 05:39
No comments have been added yet.