{"id":489,"date":"2019-06-13T21:12:11","date_gmt":"2019-06-14T04:12:11","guid":{"rendered":"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/?p=489"},"modified":"2021-06-30T09:17:26","modified_gmt":"2021-06-30T16:17:26","slug":"day-7-unit-1","status":"publish","type":"post","link":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/class\/day-7-unit-1\/","title":{"rendered":"Day 7 Unit 1"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">We will continue with the simulation of Natural Selection game. So far we have introduced &#8220;variation&#8221; into the game without any idea where this variation is coming from.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, in the video we saw on Monday, about the mice in the lava rocks and sands, they talked about where some of the variation in life on earth comes from.  Do you remember what they talked about?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you don&#8217;t remember, you can see part of the video again to get the hint. Let&#8217;s just play one minute of the video from 3:16.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Natural Selection and the Rock Pocket Mouse \u2014 HHMI BioInteractive Video\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/sjeSEngKGrg?start=196&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">How did Cyclops from the X-Men get his superpowers?<br>He was born with the mutation.<br>How did the Hulk and Spiderman get their superpowers?<br>The Hulk was exposed to gamma radiation and Spiderman was bitten by a radioactive spider.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mutations are changes that happens to your DNA. But, mutations are neither good nor bad in and of itself, it all depends on the environment. <br>In fact, we, you and I, and every life on earth are all &#8220;mutants&#8221;. Each one of us carries mutations in our DNA sequence that mark us uniquely. And some mutations are inherited for generations, because they are benign, and do no harm.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Today, we will extend the natural selection game by introducing a variable that represents the DNA that encodes the size of the sprites. Because the structure of this game is a bit different from our Squish the bug! game we were building before, we will start with a new starter game. In this game, instead of having two sprites, we have one sprite that clones into different forms. Click on the link below. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/scratch.mit.edu\/projects\/548833919\/\">https:\/\/scratch.mit.edu\/projects\/548833919\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we need to introduce a new variable called DNA. <strong>The important thing here is to make the DNA variable &#8220;local&#8221;. <\/strong>To do that, you click on the option <strong>For this sprite only<\/strong>, when you make the variable. This will make sure that each clone can have their own DNA. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"313\" class=\"wp-image-655\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2019\/06\/local.jpg\" alt=\"\" style=\"width: 400px;\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2019\/06\/local.jpg 474w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2019\/06\/local-300x235.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure to set the DNA variable to an initial value when you start the game. I am going to use the value &#8220;large&#8221; and &#8220;small&#8221; to represent the DNA for each sprite. Initially, my DNA=&#8221;large&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our current code, the code checks for the costume when it starts as a clone. How would you change the code below, so that it will check the DNA variable when it starts as a clone? Don\u2019t forget to set your costume, so the looks of the clones match the DNA of the clones.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.22.09-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"168\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.22.09-AM.png\" alt=\"\" class=\"wp-image-1093\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.22.09-AM.png 692w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.22.09-AM-300x73.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.19.23-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"236\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.19.23-AM.png\" alt=\"\" class=\"wp-image-1089\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.19.23-AM.png 490w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.19.23-AM-300x144.png 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/a><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Great, now if you play the current version of the game, you will never see any small beetles ever. We are going to introduce small beetles into the population by &#8220;mutating&#8221; the DNA. We will do this by changing the DNA variable in random intervals. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to do this, we will use a special event called &#8220;broadcast&#8221;. Broadcast will tell every sprite in the game that it&#8217;s time to mutate their DNA. See if you can make the program broadcast a message &#8220;mutate!&#8221; every 5 seconds forever. Hint: you will use blocks such as <strong>When flag is clicked<\/strong>, <strong>Forever<\/strong>, <strong>Broadcast<\/strong>, and <strong>Wait<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.28-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"326\" height=\"364\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.28-AM.png\" alt=\"\" class=\"wp-image-1090\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.28-AM.png 326w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.28-AM-269x300.png 269w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When you send a message, you expect there to be sprites that will receive the message. What will the sprites do when they receive the message &#8220;mutate!&#8221;? They will change their DNA variable to a different value. We will need to use the blocks like &#8220;<strong>When I receive <\/strong>message&#8221; and &#8220;<strong>If then else<\/strong>&#8220;, to check for the current state of the DNA variable and set it to an alternative. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.21.06-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"540\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.21.06-AM.png\" alt=\"\" class=\"wp-image-1092\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.21.06-AM.png 472w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.21.06-AM-262x300.png 262w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When the DNA variable is changed, the clones will change their color and size. Run your code, and wait to see if small beetles randomly appear in your screen. In Biology, the DNA that encodes the character of an organism is called the &#8220;genotype&#8221;. The character, for example, size of the beetle, that changes depending on the DNA is called the &#8220;phenotype&#8221;. <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Now, we see that small beetles appear in our environment. But, in real nature, mutations don&#8217;t really happen every 5 seconds to everybody. In real nature, mutations are rare and random events. In order to keep our mutations rare and random, we will add one more control block before you switch your DNA. Each sprite will only switch their DNA one out of five times when they receive a message to mutate. How would you make that happen? Hint: use control block &#8220;<strong>If<\/strong>&#8221; with the operator block &#8220;<strong>pick random 1 to 5<\/strong>&#8221; as the condition, when you receive the message to mutate. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.36-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"656\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.36-AM.png\" alt=\"\" class=\"wp-image-1091\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.36-AM.png 622w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-28-at-10.18.36-AM-284x300.png 284w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/a><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">That wraps up our multi-day project on natural selection. Make sure you share your &#8220;Squish the bug&#8221; game.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/csfirst.withgoogle.com\/c\/cs-first\/en\/music-and-sound\/introduction-and-discovery\/wrap-up-share-your-project.html\" target=\"_blank\" rel=\"noreferrer noopener\">Wrap up: Share your project!<\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Click&nbsp;<strong>Share<\/strong>&nbsp;button on the top of the page.<\/li><li>Click on&nbsp;<strong>+add to studio&nbsp;<\/strong>button at the bottom of the page<\/li><li>Choose&nbsp;<strong>2021 squish the bug!<\/strong><\/li><li>Click okay<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Wrap-up: Show your project<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>click on your account name at the top right of the page.<\/li><li>Select&nbsp;<strong>My Class<\/strong><\/li><li>Click on Class Studios \u2013&nbsp;<strong>2021 squish the bug!<\/strong><\/li><li>Check out your friends projects!<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>We will continue with the simulation of Natural Selection game. So far we have introduced &#8220;variation&#8221; into the game without any idea where this variation is coming from. But, in the video we saw on Monday, about the mice in the lava rocks and sands, they talked about where some of the variation in life [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-489","post","type-post","status-publish","format-standard","hentry","category-class"],"_links":{"self":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/posts\/489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/comments?post=489"}],"version-history":[{"count":84,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/posts\/489\/revisions"}],"predecessor-version":[{"id":1108,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/posts\/489\/revisions\/1108"}],"wp:attachment":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/media?parent=489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/categories?post=489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2021\/wp-json\/wp\/v2\/tags?post=489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}