{"id":720,"date":"2019-12-05T19:01:00","date_gmt":"2019-12-05T11:01:00","guid":{"rendered":"http:\/\/bversion.com\/WordPress\/?p=720"},"modified":"2021-04-01T22:12:12","modified_gmt":"2021-04-01T14:12:12","slug":"solving-a-maze","status":"publish","type":"post","link":"https:\/\/bversion.com\/WordPress\/2019\/12\/05\/solving-a-maze\/","title":{"rendered":"Mice Maze"},"content":{"rendered":"<p><iframe loading=\"lazy\" src=\"https:\/\/scratch.mit.edu\/projects\/351329294\/embed\" allowtransparency=\"true\" width=\"485\" height=\"402\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"\"><\/iframe><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>My Second dream was &#8216;mice maze&#8217;, it was very popular when I was childhood, program a &#8216;mice&#8217; to solve the maze automatically. Actually, my 25 years old final year project was &#8216;smart vacuum cleaner&#8217;, it is now very popular. But, it was very new concept at that time and I defined some &#8216;mice&#8217; behavior. And now, I proof that it work based on Scratch. <\/p>\n\n\n\n<p>Scratch, thanks a again!!<\/p>\n\n\n\n<p>P.S. I like to stare the screen to see the mice to run the path. If you want to run it faster, hold shift when press the green flag.. \ud83d\ude42<\/p>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading_7b5412-c2, .wp-block-kadence-advancedheading.kt-adv-heading_7b5412-c2[data-kb-block=\"kb-adv-heading_7b5412-c2\"]{font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading_7b5412-c2 mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading_7b5412-c2[data-kb-block=\"kb-adv-heading_7b5412-c2\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading_7b5412-c2 img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading_7b5412-c2[data-kb-block=\"kb-adv-heading_7b5412-c2\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<h2 class=\"kt-adv-heading_7b5412-c2 wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading_7b5412-c2\">Basic idea for the mice&#8217;s logic <\/h2>\n\n\n\n<p>That&#8217;s a very basic and simple logic for the mice&#8230;. XD<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>We make the mice in a square with dimension same as the maze path, we are using 48pt x 48pt.<\/li><li>The mice is moving in a unit of it&#8217;s size, i.e. 48pt<\/li><li>We define the priority of the movement for the mice to follow, <ul><li>Always go forward<\/li><li>Go right if cannot go forward<\/li><li>Go left if both forward and right are blocked<\/li><li>Move backward if no more movement.<\/li><\/ul><\/li><li>Then, we need to record each movement and possible (not explore) directions.<\/li><li>When the mice move backward, it will read the record and go to un-explore directions.<\/li><\/ol>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading_4d52fc-2f, .wp-block-kadence-advancedheading.kt-adv-heading_4d52fc-2f[data-kb-block=\"kb-adv-heading_4d52fc-2f\"]{font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading_4d52fc-2f mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading_4d52fc-2f[data-kb-block=\"kb-adv-heading_4d52fc-2f\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading_4d52fc-2f img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading_4d52fc-2f[data-kb-block=\"kb-adv-heading_4d52fc-2f\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<h2 class=\"kt-adv-heading_4d52fc-2f wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading_4d52fc-2f\">How does the program work<\/h2>\n\n\n\n<p>Prior I created the mice maze, I actually made a program by using WASD key to move the mice, solve the maze manually.  So, keep in mind, W &#8211; up, D &#8211; right, S &#8211; down, A &#8211; left, it is too hard for you if you are FPS game player.. LOL<\/p>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading_ac1101-ee, .wp-block-kadence-advancedheading.kt-adv-heading_ac1101-ee[data-kb-block=\"kb-adv-heading_ac1101-ee\"]{font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading_ac1101-ee mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading_ac1101-ee[data-kb-block=\"kb-adv-heading_ac1101-ee\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading_ac1101-ee img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading_ac1101-ee[data-kb-block=\"kb-adv-heading_ac1101-ee\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<h3 class=\"kt-adv-heading_ac1101-ee wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading_ac1101-ee\">Sensor &#8211; detecting wall<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"http:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Sensor.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Sensor.jpg\" alt=\"\" class=\"wp-image-917\" width=\"343\" height=\"1127\" srcset=\"https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Sensor.jpg 343w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Sensor-91x300.jpg 91w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Sensor-312x1024.jpg 312w\" sizes=\"auto, (max-width: 343px) 100vw, 343px\" \/><\/a><\/figure>\n\n\n\n<p>Before the &#8216;mice&#8217; do any movement, it will detect any wall in it&#8217;s four directions. In this program, I move the &#8216;mice&#8217; to four directions in a certain distance. See if it will hit a wall (black in color) or not. If not hit, W A S &amp; D will be put into the corresponding variable Wall U, D, R &amp; L, tell the &#8216;mice&#8217; that the direction is OK to move. Otherwise, keep the variable as X, means there is a wall.<\/p>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading_9961cc-49, .wp-block-kadence-advancedheading.kt-adv-heading_9961cc-49[data-kb-block=\"kb-adv-heading_9961cc-49\"]{font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading_9961cc-49 mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading_9961cc-49[data-kb-block=\"kb-adv-heading_9961cc-49\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading_9961cc-49 img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading_9961cc-49[data-kb-block=\"kb-adv-heading_9961cc-49\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<h3 class=\"kt-adv-heading_9961cc-49 wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading_9961cc-49\">Movement<\/h3>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading_e66396-04, .wp-block-kadence-advancedheading.kt-adv-heading_e66396-04[data-kb-block=\"kb-adv-heading_e66396-04\"]{font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading_e66396-04 mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading_e66396-04[data-kb-block=\"kb-adv-heading_e66396-04\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading_e66396-04 img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading_e66396-04[data-kb-block=\"kb-adv-heading_e66396-04\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<h3 class=\"kt-adv-heading_e66396-04 wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading_e66396-04\">Path Tracking<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"2058\" src=\"http:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2.jpg\" alt=\"\" class=\"wp-image-919\" srcset=\"https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2.jpg 932w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2-136x300.jpg 136w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2-464x1024.jpg 464w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2-768x1696.jpg 768w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2-696x1536.jpg 696w, https:\/\/bversion.com\/WordPress\/wp-content\/uploads\/2021\/03\/Mice-Maze-Path-Recorder-2-927x2048.jpg 927w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/a><\/figure>\n\n\n\n<p>I am using a LIST called &#8216;Path&#8217; to record each movement of the &#8216;mice&#8217;,<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My Second dream was &#8216;mice maze&#8217;, it was very popular when I was childhood, program a &#8216;mice&#8217; to solve the maze automatically. Actually, my 25 years old final year project was &#8216;smart vacuum cleaner&#8217;, it is now very popular. But, it was very new concept at that time and I defined some &#8216;mice&#8217; behavior. And &hellip; <a href=\"https:\/\/bversion.com\/WordPress\/2019\/12\/05\/solving-a-maze\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Mice Maze<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":722,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cybocfi_hide_featured_image":"yes","footnotes":""},"categories":[12,7],"tags":[],"class_list":["post-720","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-features","category-makecode_scratch"],"_links":{"self":[{"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/posts\/720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/comments?post=720"}],"version-history":[{"count":11,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/posts\/720\/revisions"}],"predecessor-version":[{"id":925,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/posts\/720\/revisions\/925"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/media\/722"}],"wp:attachment":[{"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/media?parent=720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/categories?post=720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bversion.com\/WordPress\/wp-json\/wp\/v2\/tags?post=720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}