{"id":20728,"date":"2019-01-19T18:08:52","date_gmt":"2019-01-19T23:08:52","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=20728"},"modified":"2019-01-19T18:08:52","modified_gmt":"2019-01-19T23:08:52","slug":"when-i-was-twelve-years-old","status":"publish","type":"post","link":"http:\/\/blog.kenperlin.com\/?p=20728","title":{"rendered":"When I was twelve years old"},"content":{"rendered":"<p>When I was twelve years old I implemented my very first computer program. I didn&#8217;t have any knowledge of programming, and they didn&#8217;t teach any courses in our middle school, so I needed to figure it out for myself.<\/p>\n<p>It was an odd little computer, that I just happened to come upon in the school library. It was really more of a programmable calculator with a paper tape that printed numerical results. Its programming language, such as it was, was a kind of weird assembly language &#8212; although I wouldn&#8217;t learn about the term &#8220;assembly language&#8221; until some years later.<\/p>\n<p>I decided to write a program to play a game of tic-tac-toe. To do this, I needed to store which of the nine squares had an X, and which squares had an O. Except this little programmable calculator didn&#8217;t support arrays, so I had to figure out another way.<\/p>\n<p>If I&#8217;d known more, I would have used some kind of binary encoding. But all I knew was that the calculator could store extremely large numbers. So instead I used what now seems like a really crazy scheme.<\/p>\n<p>I figured out that if you multiply any the numbers from 61 through 69 together, you always get a result that isn&#8217;t a multiple of any of the numbers you <i>didn&#8217;t<\/i> use. For example, if 61*62*64*66*67 is not a multiple of 63 or 65 or 68 or 69.<\/p>\n<p>This works for any such combination of the numbers 61 through 69. It doesn&#8217;t work for any consecutive run of numbers smaller than that &#8212; I checked.<\/p>\n<p>I used that scheme to encode which squares had Xs and which squares had Os. After that, it was easy to program a tic-tac-toe game.<\/p>\n<p>Now that I think back on it, this was a very weird approach to the problem of storing combinations of nine numbers in a computer. But hey, it worked! <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I was twelve years old I implemented my very first computer program. I didn&#8217;t have any knowledge of programming, and they didn&#8217;t teach any courses in our middle school, so I needed to figure it out for myself. It was an odd little computer, that I just happened to come upon in the school &hellip; <a href=\"http:\/\/blog.kenperlin.com\/?p=20728\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;When I was twelve years old&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/20728"}],"collection":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20728"}],"version-history":[{"count":1,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/20728\/revisions"}],"predecessor-version":[{"id":20729,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/20728\/revisions\/20729"}],"wp:attachment":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20728"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}