{"id":2118,"date":"2015-07-30T14:39:39","date_gmt":"2015-07-30T12:39:39","guid":{"rendered":"http:\/\/www.jesperjuul.net\/ludologist\/?p=2118"},"modified":"2015-07-30T14:39:39","modified_gmt":"2015-07-30T12:39:39","slug":"tic-tac-toe-and-conways-game-of-life-in-javascript","status":"publish","type":"post","link":"https:\/\/www.jesperjuul.net\/ludologist\/2015\/07\/30\/tic-tac-toe-and-conways-game-of-life-in-javascript\/","title":{"rendered":"Tic Tac Toe and Conway&#8217;s Game of Life in Javascript"},"content":{"rendered":"<p>For the Half-Real website (10 years ago!) I made two example programs to support\u00a0the book&#8217;s discussions: an implementation of Conway&#8217;s Game of Life and a Tic Tac Toe program that plays perfectly by simply going through all possible game states.<\/p>\n<p>Time passes, and I can no longer count on browsers\u00a0running\u00a0the Java applets that I originally wrote the programs in. They never\u00a0ran\u00a0on tablets and mobile devices either. And I dislike websites with broken applets.<\/p>\n<p>So I have rewritten them to\u00a0work in JavaScript. They feel like they always did, except they launch faster &#8211; and run on mobile phones and tablet:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.half-real.net\/gameoflife\/\">Conway&#8217;s Game of Life<\/a><\/li>\n<li><a href=\"http:\/\/www.half-real.net\/tictactoe\/\">Tic Tac Toe<\/a><\/li>\n<\/ul>\n<p>PS. Tech notes: I did this using <a href=\"http:\/\/www.gwtproject.org\/\">GWT<\/a>, 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\u00a0JavaScript is callback-based, so any program flow that relies on threads (as in my\u00a0case) has to\u00a0completely reworked.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the Half-Real website (10 years ago!) I made two example programs to support\u00a0the book&#8217;s discussions: an implementation of Conway&#8217;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\u00a0running\u00a0the Java applets that I originally &hellip; <a href=\"https:\/\/www.jesperjuul.net\/ludologist\/2015\/07\/30\/tic-tac-toe-and-conways-game-of-life-in-javascript\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tic Tac Toe and Conway&#8217;s Game of Life in Javascript&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2,9,3],"tags":[],"class_list":["post-2118","post","type-post","status-publish","format-standard","hentry","category-games","category-half-real","category-tech"],"_links":{"self":[{"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/posts\/2118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/comments?post=2118"}],"version-history":[{"count":0,"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/posts\/2118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/media?parent=2118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/categories?post=2118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jesperjuul.net\/ludologist\/wp-json\/wp\/v2\/tags?post=2118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}