{"id":307,"date":"2008-01-11T20:14:23","date_gmt":"2008-01-11T19:14:23","guid":{"rendered":"http:\/\/www.sungate.co.uk\/?p=307"},"modified":"2008-01-11T20:28:10","modified_gmt":"2008-01-11T19:28:10","slug":"here-comes-bod","status":"publish","type":"post","link":"https:\/\/www.sungate.co.uk\/?p=307","title":{"rendered":"Here comes Bod"},"content":{"rendered":"<p>Well, it was a Friday afternoon and I got distracted enough to write a small program which plays Bod Snap.<\/p>\n<pre>\r\n$ bod\r\nBod and PC Copper ...\r\n... that's not snap!\r\n\r\nFarmer Barleymow and PC Copper ...\r\n... that's not snap!\r\n\r\nAunt Flo and Bod ...\r\n... that's not snap!\r\n\r\nFarmer Barleymow and Aunt Flo ...\r\n... that's not snap!\r\n\r\nAunt Flo and Aunt Flo ...\r\n... SNAP!\r\n<\/pre>\n<p>If you&#8217;re the same age as me, then you&#8217;ll remember.  If not, then I&#8217;m banging on about <a href=\"http:\/\/en.wikipedia.org\/wiki\/Bod_%28TV_series%29\">Bod<\/a>, the Children&#8217;s TV series from the 1970s.  And, because it&#8217;s not very long or complicated, here&#8217;s the source code, also downloadable as <a href=\"http:\/\/www.sungate.co.uk\/wp-content\/bod.c\">bod.c<\/a>:<\/p>\n<pre>\/*\r\n########################################################################\r\n#                                                                      #\r\n# bod - plays Bod Snap                                                 #\r\n#                                                                      #\r\n# Copyright (C)2007 Dave Ewart (davee@sungate.co.uk)                   #\r\n#                                                                      #\r\n########################################################################\r\n#                                                                      #\r\n# This program is free software; you can redistribute it and\/or modify #\r\n# it under the terms of the GNU General Public License as published by #\r\n# the Free Software Foundation; either version 2 of the License, or    #\r\n# (at your option) any later version.                                  #\r\n#                                                                      #\r\n# This program is distributed in the hope that it will be useful,      #\r\n# but WITHOUT ANY WARRANTY; without even the implied warranty of       #\r\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #\r\n# GNU General Public License for more details.                         #\r\n#                                                                      #\r\n########################################################################\r\n*\/\r\n\r\n#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\nint main()\r\n{\r\n    int i;\r\n    int j;\r\n    char *people[5];\r\n    int snap = 0;\r\n\r\n    unsigned int iseed = (unsigned int) time(NULL);\r\n\r\n    srand(iseed);\r\n\r\n    people[0] = \"Bod\";\r\n    people[1] = \"PC Copper\";\r\n    people[2] = \"Farmer Barleymow\";\r\n    people[3] = \"Postman Frank\";\r\n    people[4] = \"Aunt Flo\";\r\n\r\n    while (!snap) {\r\n\r\n        i = (int) 5 *(rand() \/ (RAND_MAX + 1.0));\r\n        j = (int) 5 *(rand() \/ (RAND_MAX + 1.0));\r\n\r\n        printf(\"%s and %s ...\\n\", people[i], people[j]);\r\n        sleep(1);\r\n        if (i == j) {\r\n            printf(\"... SNAP!\\n\");\r\n            snap = 1;\r\n        }\r\n        else {\r\n            printf(\"... that's not snap!\\n\\n\");\r\n            sleep(2);\r\n        }\r\n    }\r\n}<\/pre>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, it was a Friday afternoon and I got distracted enough to write a small program which plays Bod Snap. $ bod Bod and PC Copper &#8230; &#8230; that&#8217;s not snap! Farmer Barleymow and PC Copper &#8230; &#8230; that&#8217;s not snap! Aunt Flo and Bod &#8230; &#8230; that&#8217;s not snap! Farmer Barleymow and Aunt Flo&#8230;&nbsp;(<a href=\"https:\/\/www.sungate.co.uk\/?p=307\">read more<\/a>)<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-307","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307"}],"version-history":[{"count":0,"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/307\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sungate.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}