{"id":489,"date":"2019-06-13T21:12:11","date_gmt":"2019-06-14T04:12:11","guid":{"rendered":"http:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/?p=489"},"modified":"2019-06-19T09:46:52","modified_gmt":"2019-06-19T16:46:52","slug":"day-8-unit-1","status":"publish","type":"post","link":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/class\/day-8-unit-1\/","title":{"rendered":"Day 8 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-youtube wp-block-embed is-type-video is-provider-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\">Click here to explore our DNA mutation game:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/scratch.mit.edu\/projects\/317608453\/\" target=\"_blank\">https:\/\/scratch.mit.edu\/projects\/317608453\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/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 Squash 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\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/scratch.mit.edu\/projects\/317628015\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">https:\/\/scratch.mit.edu\/projects\/317628015\/<\/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_2019\/wp-content\/uploads\/2019\/06\/local.jpg\" alt=\"\" style=\"width: 400px;\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-content\/uploads\/2019\/06\/local.jpg 474w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/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;blue&#8221; and &#8220;red&#8221; to represent the DNA for each sprite. Initially, my DNA=&#8221;blue&#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\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"396\" class=\"wp-image-656\" src=\"http:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-content\/uploads\/2019\/06\/clone.jpg\" alt=\"\" style=\"width: 500px;\" srcset=\"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-content\/uploads\/2019\/06\/clone.jpg 427w, https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-content\/uploads\/2019\/06\/clone-300x237.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\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 red snakes ever. We are going to introduce red snakes 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<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<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 red snakes 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, or color of the snake, 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 red snakes 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<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;Squash the bug&#8221; game and your &#8220;snake game&#8221;.<\/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>summer code camp 2019.<\/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><\/li><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>summer code camp 2019<\/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_2019\/wp-json\/wp\/v2\/posts\/489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/comments?post=489"}],"version-history":[{"count":69,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/posts\/489\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/posts\/489\/revisions\/678"}],"wp:attachment":[{"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/media?parent=489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/categories?post=489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mirahan.faculty.unlv.edu\/summercode_2019\/wp-json\/wp\/v2\/tags?post=489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}