{"id":2290,"date":"2019-12-12T22:47:48","date_gmt":"2019-12-13T03:47:48","guid":{"rendered":"https:\/\/dems.asc.ohio-state.edu\/?p=2290"},"modified":"2019-12-12T22:47:48","modified_gmt":"2019-12-13T03:47:48","slug":"droidco-final","status":"publish","type":"post","link":"https:\/\/dems.asc.ohio-state.edu\/?p=2290","title":{"rendered":"DroidCo. Final"},"content":{"rendered":"\n<p>For the final stage of my project, I finished the display and game logic of DroidCo. As a final product, DroidCo. allows two players to use OSC to &#8220;write code&#8221; (by pressing a predetermined selection of buttons) that their droids will execute to compete. The goal of the game is to convert every droid on the grid onto your team.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"639\" src=\"https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.28.35-PM-1024x639.png\" alt=\"\" class=\"wp-image-2292\" srcset=\"https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.28.35-PM-1024x639.png 1024w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.28.35-PM-300x187.png 300w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.28.35-PM-768x479.png 768w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.28.35-PM-1536x959.png 1536w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.28.35-PM-2048x1279.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>The code input screen, with the option to use the same code from the previous round or rewrite new code<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"639\" src=\"https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.03-PM-1024x639.png\" alt=\"\" class=\"wp-image-2293\" srcset=\"https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.03-PM-1024x639.png 1024w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.03-PM-300x187.png 300w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.03-PM-768x479.png 768w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.03-PM-1536x959.png 1536w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.03-PM-2048x1279.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>The actual game screen, which shows the droids moving about and displays the current turn<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.15-PM-1024x640.png\" alt=\"\" class=\"wp-image-2294\" srcset=\"https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.15-PM-1024x640.png 1024w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.15-PM-300x188.png 300w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.15-PM-768x480.png 768w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.15-PM-1536x960.png 1536w, https:\/\/dems.asc.ohio-state.edu\/wp-content\/uploads\/2019\/12\/Screen-Shot-2019-12-12-at-10.29.15-PM-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>The victory screen! This scene plays after a team has converted all the droids or turn 350 has been reached.<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>function main()\n{\n\tvar worldState = JSON.parse(arguments&#91;0]);\n\tvar droid = arguments&#91;1];\n\tvar startIndex = (droid * 6) + 2;\n\tvar team = worldState&#91;startIndex + 1];\n\tvar x = worldState&#91;startIndex + 2];\n\tvar y = worldState&#91;startIndex + 3];\n\tvar dir = worldState&#91;startIndex + 4];\n\tvar red;\n\tvar blue;\n\tvar hor;\n\tvar ver;\n\tvar rot;\n\tswitch (team){\n\t\tcase 1:\n\t\t\tblue = 50;\n\t\t\tred = -100;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tblue = -100;\n\t\t\tred = 50;\n\t\t\tbreak;\n\t}\n\tswitch (x){\n\t\tcase 0:\n\t\t\thor = -45;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\thor = -35;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\thor = -25;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\thor = -15;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\thor = -5;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\thor = 5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\thor = 15;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\thor = 25;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\thor = 35;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\thor = 45;\n\t\t\tbreak;\n\t}\n\tswitch (y){\n\t\tcase 0:\n\t\t\tver = 45;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tver = 35;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tver = 25;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tver = 15;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tver = 5;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tver = -5;\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tver = -15;\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tver = -25;\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tver = -35;\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tver = -45;\n\t\t\tbreak;\n\t}\n\tswitch(dir){\n\t\tcase 0:\n\t\t\trot = 180;\n\t\t\tbreak;\n\t\tcase 90:\n\t\t\trot = 270;\n\t\t\tbreak;\n\t\tcase 180:\n\t\t\trot = 0;\n\t\t\tbreak;\n\t\tcase 270:\n\t\t\trot = 90;\n\t\t\tbreak;\n\t}\n\treturn &#91;red, blue, hor, ver, rot];\n}<\/code><\/pre>\n\n\n\n<p>Above is the code for the &#8220;droid parser&#8221; which converts each droid&#8217;s worldState data into values that Isadora can understand to display the droid.<\/p>\n\n\n\n<p>Overall, the game was a major success. It ran with only minor bugs and I accomplished most of what I wanted to do with this project. The code was rather buggy (I underestimated the strain new users could put on my code). I also ran into several problems with players&#8217; code not executing exactly as they wrote it. These bugs are definitely due to the String Constructor (Isadora does not handle strings very well), but I think I can work out the kinks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the final stage of my project, I finished the display and game logic of DroidCo. As a final product, DroidCo. allows two players to use OSC to &#8220;write code&#8221; (by pressing a predetermined selection of buttons) that their droids will execute to compete. The goal of the game is to convert every droid on [&hellip;]<\/p>\n","protected":false},"author":44,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2290","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=\/wp\/v2\/posts\/2290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2290"}],"version-history":[{"count":1,"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=\/wp\/v2\/posts\/2290\/revisions"}],"predecessor-version":[{"id":2299,"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=\/wp\/v2\/posts\/2290\/revisions\/2299"}],"wp:attachment":[{"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dems.asc.ohio-state.edu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}