{"id":72,"date":"2021-05-02T11:39:25","date_gmt":"2021-05-02T11:39:25","guid":{"rendered":"https:\/\/msc-ai.knipmeyer.co.uk\/?p=72"},"modified":"2021-05-02T11:39:25","modified_gmt":"2021-05-02T11:39:25","slug":"developing-the-setup-routine","status":"publish","type":"post","link":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/2021\/05\/02\/developing-the-setup-routine\/","title":{"rendered":"Developing the setup routine"},"content":{"rendered":"\n<p>As in python, using a function is a better way to reuse code and keep code &#8216;DRY&#8217;. I moved the array routine into its own function which is called from setup.<\/p>\n\n\n\n<p>..<\/p>\n\n\n\n<p>I saved this and explored the pac-man game, looking at the global variables and how these would map to my own maze dragon game.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>globals &#91;\n  level         ;; current level\n  score         ;; your score\n  lives         ;; remaining lives\n  extra-lives   ;; total number of extra lives you've won\n  scared        ;; time until ghosts aren't scared (0 means not scared)\n  level-over?   ;; true when a level is complete\n  dead?         ;; true when Pac-Man is loses a life\n  next-bonus-in ;; time until next bonus is created\n  tool which-ghost ;; variables needed to properly load levels 4 and above.\n]<\/code><\/pre>\n\n\n\n<p>So examining the list to start with, i would need levels, but i would have rooms, and score, lives would be useful. There are no levels as such, once you have completed the adventure the score and time it took to complete is significant. At the moment I&#8217;m not doing the AI for the opponents, so &#8216;scared&#8217; and &#8216;level-over&#8217; are also not applicable, as well as bonuses and ghost-speicic globals.<\/p>\n\n\n\n<p>My initial list of globals started as<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>globals &#91;\n  lives ;; amount of lives the player has\n  health ;; the health of the player\n  score ;; players score\n  room ;; the room the player is in\n]<\/code><\/pre>\n\n\n\n<p>and I have moved the array-creation to dungeon-map-array<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>to setup\n dungeon-map-array\nend\n\nto dungeon-map-array<\/code><\/pre>\n\n\n\n<p>I now have the global variables to start creating the rendering procedures for my maps<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As in python, using a function is a better way to reuse code and keep code &#8216;DRY&#8217;. I moved the array routine into its own function which is called from setup. .. I saved this and explored the pac-man game, &hellip; <a href=\"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/2021\/05\/02\/developing-the-setup-routine\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-72","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":1,"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":73,"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/72\/revisions\/73"}],"wp:attachment":[{"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/msc-ai.knipmeyer.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}