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:

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.

4 thoughts on “Tic Tac Toe and Conway’s Game of Life in Javascript”

  1. Hi Jesper,

    Off topic but i recon this is one of the best ways to get in touch with you. I read your book the art of failure and I absolutely love it. I’m currently doing a masters in innovation management in London at Central Saint Martins and i’m just beginning my dissertation.

    I planning to investigate how organisations handle failure in regards to innovation. Furthermore I want to explore if there are lessons to be learnt from well designed games and how they frame failure. In many ways failure in ‘good’ games is a very progressive form of failure. Progressive in a sense that it necessitates learning from failure and not getting discouraged by it but rather accepting it as part of the journey to the point where it can motivate us.

    In many ways your book inspired me to follow this rather unorthodox approach and I would love to speak to you about it if there is any chance of doing so.

    Best regards, Marc

    1. Hi Marc

      Thanks for your comment. I am glad that the book makes it out to audiences and contexts beyond what I envisioned. It sounds like it makes perfect sense for a management context.

      Thanks! Jesper

      1. Thank you for your response Jesper! While I have your attention, do you have any suggestions on further literature about failure in games?

        Also, I realise that I may be pushing my luck here, but is there anyway that I could get a brief interview with you on failure in games at some point in the next few months? You are an expert on the matter and it would add a lot of authority to that aspect of my paper if I had your voice.

        Either way, thank your for your great work.

Leave a Reply

Your email address will not be published. Required fields are marked *