<snapdata remixID="9369444"><project name="U5L3 p2" app="Snap! 5.4, http://snap.berkeley.edu" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAC+0lEQVR4Xu3Su2pUUQCG0T0JWgka7HKrUqnYiIJYpAoh2IkgVrYKFmLhC5hKCIJ2XgrfxhfwIbSRFJbJSNKlykAyfMWsUx/2v/fHmkyn0+nwKRAVmAAYlTd7WgBAENICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xsHkIG0AIBpfuMAMpAWADDNbxxABtICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xsHkIG0AIBpfuMAMpAWADDNbxxABtICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xsHkIG0AIBpfuMAMpAWADDNbxxABtICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xsHkIG0AIBpfuMAMpAWADDNbxxABtICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xsHkIG0AIBpfuMAMpAWADDNbxxABtICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xsHkIG0AIBpfuMAMpAWADDNbxxABtICAKb5jQPIQFoAwDS/cQAZSAsAmOY3DiADaQEA0/zGAWQgLQBgmt84gAykBQBM8xufCeDre7vj8f6bsbe3p5gCl1pgJoAni5/WdsaYTMa/K9Pxe+vGePv9YGxubl7qZRy2eAVmBnh4eDh+3Hp6ptDR0hjHN6+Nv/fXx/7Xz4tXz4svXGBmgCdLHzd2xvLx2c3p8tL4tToZ774cjK27ty98IQcsVoGZAb5f3R7XJ1dP6/w8+jNeffsw7jx6MFZWVharmNdeaoGZAL7Yeji2Xz4fu8+ejLWN9Uu9gMMWu8BMABc7kdfPswCA86zr7HMLAHhuIj/MswCA86zr7HML/AcgSv+on5ONgAAAAABJRU5ErkJggg==</thumbnail><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="true" codify="false" inheritance="false" sublistIDs="false" scheduled="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAOhUlEQVR4Xu3VwQkAAAjEMN1/abewn7jAQRC64wgQIECAAIF3gX1fNEiAAAECBAiMAHsCAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQIHLFxAWmhEwHPAAAAAElFTkSuQmCC</pentrails><costumes><list struct="atomic" id="2"></list></costumes><sounds><list struct="atomic" id="3"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites><sprite name="Sprite" idx="1" x="-183" y="-159.2" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="145,26,68,1" pen="tip" id="8"><costumes><list struct="atomic" id="9"></list></costumes><sounds><list struct="atomic" id="10"></list></sounds><blocks></blocks><variables></variables><scripts><script x="15" y="13.666666666665378"><custom-block s="list from %n through %n"><l></l><l></l></custom-block></script><script x="10" y="44"><custom-block s="time function %repRing"><block s="reifyReporter"><autolambda><custom-block s="alphie way sum from 1 %n"><l>2000</l></custom-block></autolambda><list></list></block></custom-block></script><script x="10" y="89"><custom-block s="time function %repRing"><block s="reifyReporter"><autolambda><custom-block s="betsy way sum from 1 %n"><l>2000</l></custom-block></autolambda><list></list></block></custom-block></script><script x="12" y="150"><custom-block s="time function %repRing"><block s="reifyReporter"><autolambda><custom-block s="are the numbers of %l distinct?"><custom-block s="list from %n through %n"><l>1</l><l>1000</l></custom-block></custom-block></autolambda><list></list></block></custom-block></script></scripts></sprite><watcher scope="Sprite" s="xPosition" style="normal" x="10" y="40.000001999999995" color="74,108,212" hidden="true"/></sprites></stage><hidden></hidden><headers></headers><code></code><blocks><block-definition s="Computer guesses my number from %&apos;low&apos; to %&apos;high&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doForever"><script><block s="doIfElse"><block s="reportGreaterThan"><block var="low"/><block var="high"/><comment w="221.33333333333334" collapsed="false">Step 5: LOW can&apos;t get bigger than HIGH unless the user has given inconsistent feedback.</comment></block><script><block s="doSayFor"><l>Hey!  That&apos;s not possible.</l><l>3</l></block><block s="doStopThis"><l><option>this block</option></l></block></script><script><block s="doDeclareVariables"><list><l>guess</l></list></block><block s="doSetVar"><l>guess</l><block s="reportRound"><block s="reportQuotient"><block s="reportSum"><block var="low"/><block var="high"/></block><l>2</l></block><comment w="269.3333333333333" collapsed="true">Step 1: Guess the average of LOW and HIGH</comment></block></block><block s="doSetVar"><l>clicked</l><l>nobody</l><comment w="208" collapsed="false">CLICKED will be changed to a different value when one of the three buttons (other sprites) is clicked.</comment></block><block s="doSayFor"><custom-block s="join words %mult%txt"><list><l>I guess</l><block var="guess"/></list></custom-block><l>2</l></block><block s="doChangeVar"><l>number of guesses</l><l>1</l></block><block s="doWaitUntil"><block s="reportNot"><block s="reportEquals"><block var="clicked"/><l>nobody</l></block><comment w="194.66666666666666" collapsed="true">Wait for the user to push a button.</comment></block></block><block s="doIfElse"><block s="reportEquals"><block var="clicked"/><l>equal</l><comment w="212.66666666666666" collapsed="true">Step 2: If just right, say so and stop.</comment></block><script><block s="doSayFor"><block s="reportJoinWords"><list><l>I win in </l><block var="number of guesses"/><l> guesses!!!!</l></list></block><l>2</l></block><block s="doStopThis"><l><option>this block</option></l></block></script><script><block s="doIfElse"><block s="reportEquals"><block var="clicked"/><l>big</l></block><script><block s="doSetVar"><l>high</l><block s="reportDifference"><block var="guess"/><l>1</l></block><comment w="294.6666666666667" collapsed="true">Step 3: Guess is too big, so reduce HIGH to GUESS-1.</comment></block></script><script><block s="doSetVar"><l>low</l><block s="reportSum"><block var="guess"/><l>1</l><comment w="294.6666666666667" collapsed="true">Step 4: Guess is too small, so increase LOW to GUESS+1.</comment></block></block></script></block></script></block></script></block></script></block></script><scripts><comment x="8" y="545.4666666666667" w="528" collapsed="false">Like many games, this is coded as a FOREVER loop, with a STOP THIS BLOCK to escape when we win or detect an inconsistency.  It uses two global variables, one to count the number of guesses and the other for the buttons to tell us when they are pressed.  There are more elegant ways to accomplish the latter, but they&apos;d result in multiple WHEN I RECEIVE scripts, and we&apos;d have to make LOW and HIGH global for those scripts to use.  Also, we change the values of our input variables, which some people would consider bad style.  But since those variables are local to this procedure, it really doesn&apos;t hurt anyone outside this script.&#xD;&#xD;Students will organize their code in many different ways.  It might be useful to have them flag with comments where each of the five steps (or however many steps /their/ algorithm has) is carried out.</comment></scripts></block-definition><block-definition s="if %&apos;test&apos; then %&apos;true&apos; else %&apos;false&apos;" type="reporter" category="control"><header></header><code></code><translations></translations><inputs><input type="%b"></input><input type="%anyUE"></input><input type="%anyUE"></input></inputs><script><block s="doIfElse"><block var="test"/><script><block s="doReport"><block s="evaluate"><block var="true"/><list></list></block></block></script><script><block s="doReport"><block s="evaluate"><block var="false"/><list></list></block></block></script></block></script></block-definition><block-definition s="for %&apos;i&apos; = %&apos;start&apos; to %&apos;end&apos; %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%n">1</input><input type="%n">10</input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>step</l><l>tester</l></list></block><block s="doIfElse"><block s="reportGreaterThan"><block var="start"/><block var="end"/></block><script><block s="doSetVar"><l>step</l><l>-1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportLessThan"><block var="i"/><block var="end"/></block></autolambda><list></list></block></block></script><script><block s="doSetVar"><l>step</l><l>1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportGreaterThan"><block var="i"/><block var="end"/></block></autolambda><list></list></block></block></script></block><block s="doSetVar"><l>i</l><block var="start"/></block><block s="doUntil"><block s="evaluate"><block var="tester"/><list></list></block><script><block s="doRun"><block var="action"/><list></list></block><block s="doChangeVar"><l>i</l><block var="step"/></block></script></block></script></block-definition><block-definition s="join words %&apos;words&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%mult%txt"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="words"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="words"/></block></block></script></block><block s="doReport"><block s="reportJoinWords"><list><block s="reportListItem"><l>1</l><block var="words"/></block><l> </l><custom-block s="join words %mult%txt"><block s="reportCDR"><block var="words"/></block></custom-block></list></block></block></script></block></script></block-definition><block-definition s="list $arrowRight sentence %&apos;data&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doReport"><custom-block s="join words %mult%txt"><block var="data"/></custom-block></block></script></block></script></block-definition><block-definition s="sentence $arrowRight list %&apos;text&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%txt"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportTextSplit"><block var="text"/><l><option>whitespace</option></l></block></block></script></block></script></block-definition><block-definition s="catch %&apos;tag&apos; %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%cs"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doRun"><block var="action"/><list></list></block></script><list><l>cont</l></list></block></block></script></block-definition><block-definition s="throw %&apos;cont&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s">catchtag</input></inputs><script><block s="doRun"><block var="cont"/><list></list></block></script></block-definition><block-definition s="catch %&apos;tag&apos; %&apos;value&apos;" type="reporter" category="control"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%anyUE"></input></inputs><script><block s="doCallCC"><block s="reifyScript"><script><block s="doSetVar"><l>tag</l><block var="cont"/></block><block s="doReport"><block s="evaluate"><block var="value"/><list></list></block></block></script><list><l>cont</l></list></block></block></script></block-definition><block-definition s="throw %&apos;tag&apos; %&apos;value&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s">catchtag</input><input type="%s"></input></inputs><script><block s="doRun"><block var="tag"/><list><block var="value"/></list></block></script></block-definition><block-definition s="if %&apos;test&apos; do %&apos;action&apos; and pause all $pause-1-255-220-0" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%boolUE"></input><input type="%cs"></input></inputs><script><block s="doDeclareVariables"><list><l>breakpoint</l></list></block><block s="doIf"><block s="evaluate"><block var="test"/><list></list></block><script><block s="doSetVar"><l>breakpoint</l><block var="test"/></block><block s="doShowVar"><l>breakpoint</l></block><block s="doRun"><block var="action"/><list></list></block><block s="doPauseAll"></block><block s="doHideVar"><l></l></block></script></block></script></block-definition><block-definition s="word $arrowRight list %&apos;word&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%txt"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportTextSplit"><block var="word"/><l><option>letter</option></l></block></block></script></block></script></block-definition><block-definition s="ignore %&apos;x&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs></block-definition><block-definition s="tell %&apos;sprite&apos; to %&apos;action&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s">Sprite</input><input type="%cs"></input></inputs><script><block s="doRun"><block s="reportAttributeOf"><block var="action"/><block var="sprite"/></block><list></list></block></script></block-definition><block-definition s="ask %&apos;sprite&apos; for %&apos;expression&apos;" type="reporter" category="control"><header></header><code></code><translations></translations><inputs><input type="%s">Sprite</input><input type="%repRing"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportAttributeOf"><block var="expression"/><block var="sprite"/></block><list></list></block></block></script></block-definition><block-definition s="list $arrowRight word %&apos;list&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportJoinWords"><block var="list"/></block></block></script></block></script></block-definition><block-definition s="pen trails" type="reporter" category="pen"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list></list><l>var cst = new Costume(&#xD;  this.parentThatIsA(StageMorph).trailsCanvas&#xD;);&#xD;cst.shrinkWrap();&#xD;return cst;</l></block><list></list></block></block></script></block-definition><block-definition s="set pen trails to: %&apos;costume&apos;" type="command" category="pen"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>cst</l></list><l>var stage = this.parentThatIsA(StageMorph);&#xD;stage.trailsCanvas = cst.contents;&#xD;stage.changed();</l></block><list><block var="costume"/></list></block></script></block-definition><block-definition s="Say position of number %&apos;num&apos; in sorted list %&apos;data&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input></inputs><script><block s="doDeclareVariables"><list><l>guess</l><l>low</l><l>high</l></list></block><block s="doSetVar"><l>low</l><l>1</l></block><block s="doSetVar"><l>high</l><block s="reportListLength"><block var="data"/></block></block><block s="doSetVar"><l>guess</l><block s="reportRound"><block s="reportQuotient"><block s="reportSum"><block var="low"/><block var="high"/></block><l>2</l></block></block></block><block s="doUntil"><block s="reportEquals"><block s="reportListItem"><block var="guess"/><block var="data"/></block><block var="num"/></block><script><block s="doIf"><block s="reportGreaterThan"><block var="low"/><block var="high"/></block><script><block s="doSayFor"><l>Not in list (or list isn&apos;t sorted).</l><l>3</l></block><block s="doStopThis"><l><option>this block</option></l></block></script></block><block s="doIfElse"><block s="reportGreaterThan"><block s="reportListItem"><block var="guess"/><block var="data"/></block><block var="num"/></block><script><block s="doSetVar"><l>high</l><block s="reportDifference"><block var="guess"/><l>1</l></block></block></script><script><block s="doSetVar"><l>low</l><block s="reportSum"><block var="guess"/><l>1</l></block></block></script></block><block s="doSetVar"><l>guess</l><block s="reportRound"><block s="reportQuotient"><block s="reportSum"><block var="low"/><block var="high"/></block><l>2</l></block></block></block></script></block><block s="doSayFor"><block var="guess"/><l>2</l></block></script><scripts><comment x="6.666666666666667" y="460.1333333333334" w="462" collapsed="false">This is essentially the game program, but with the user interface parts removed.&#xD;&#xD;I also replaced the FOREVER loop with a REPEAT UNTIL.  I think FOREVER is okay for games, but in a serious program the stopping condition for the loop should be self-documenting.  (There&apos;s still an early stop if the error condition LOW&gt;HIGH occurs.  In this case it means that the supposedly sorted list given as input isn&apos;t sorted, or if the desired item isn&apos;t in the list.)</comment></scripts></block-definition><block-definition s="graph datapoints %&apos;data&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><custom-block s="for each %upvar of %l %cs"><l>item</l><block var="data"/><script><block s="up"></block><custom-block s="plot point x: %n y: %n"><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>2</l><l/></block></custom-block></script></custom-block></script><scripts><comment x="7.333333333333333" y="138.79999999999998" w="348" collapsed="false">Each item of DATA is a list of two numbers, the x and y coordinates of a point. The ITEM blocks extract the two numbers.  An item from DATA is substituted into the empty list slots.  (If you prefer you could drag the ITEM orange block from the FOR EACH into those slots -- the meaning is the same.)</comment></scripts></block-definition><block-definition s="plot point x: %&apos;x&apos; y: %&apos;y&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><custom-block s="go to scaled point x: %n y: %n"><block var="x"/><block var="y"/></custom-block><block s="down"></block><block s="forward"><l>1</l></block><block s="up"></block><block s="forward"><l>-1</l></block></script></block-definition><block-definition s="age %&apos;person&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="person"/></block></block></script></block-definition><block-definition s="height %&apos;person&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListItem"><l>2</l><block var="person"/></block></block></script></block-definition><block-definition s="weight %&apos;person&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListItem"><l>3</l><block var="person"/></block></block></script></block-definition><block-definition s="gender %&apos;person&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportListItem"><l>4</l><block var="person"/></block></block></script></block-definition><block-definition s="average %&apos;data&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportQuotient"><custom-block s="combine with %repRing items of %l"><block s="reifyReporter"><autolambda><block s="reportSum"><l></l><l></l></block></autolambda><list></list></block><block var="data"/></custom-block><block s="reportListLength"><block var="data"/></block></block></block></script></block-definition><block-definition s="graph with average %&apos;xfunc&apos; %&apos;yfunc&apos; for gender = %&apos;gender&apos; in %&apos;data&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%repRing"></input><input type="%s"></input><input type="%l"></input></inputs><script><block s="doDeclareVariables"><list><l>subset</l></list></block><block s="doSetVar"><l>subset</l><custom-block s="keep items such that %predRing from %l"><block s="reifyPredicate"><autolambda><block s="reportEquals"><custom-block s="gender %l"><l/></custom-block><block var="gender"/></block></autolambda><list></list></block><block var="data"/></custom-block></block><block s="setSize"><l>3</l></block><custom-block s="graph datapoints %l"><l/></custom-block><block s="setSize"><l>7</l></block><custom-block s="graph datapoints %l"><block s="reportNewList"><list><block s="reportNewList"><list><custom-block s="average %l"><l/></custom-block><custom-block s="average %l"><l/></custom-block></list></block></list></block></custom-block></script></block-definition><block-definition s="max %&apos;a&apos; %&apos;b&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><custom-block s="if %b then %anyUE else %anyUE"><block s="reportLessThan"><block var="a"/><block var="b"/></block><block var="b"/><block var="a"/></custom-block></block></script></block-definition><block-definition s="min %&apos;a&apos; %&apos;b&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><custom-block s="if %b then %anyUE else %anyUE"><block s="reportLessThan"><block var="a"/><block var="b"/></block><block var="a"/><block var="b"/></custom-block></block></script></block-definition><block-definition s="set window scale xmin %&apos;xmin&apos; xmax %&apos;xmax&apos; ymin %&apos;ymin&apos; ymax %&apos;ymax&apos; zmin %&apos;zmin&apos; zmax %&apos;zmax&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input><input type="%n"></input></inputs><script><block s="clear"></block><block s="doSetVar"><l>x min val</l><block var="xmin"/></block><block s="doSetVar"><l>x max val</l><block var="xmax"/></block><block s="doSetVar"><l>y min val</l><block var="ymin"/></block><block s="doSetVar"><l>y max val</l><block var="ymax"/></block><block s="doSetVar"><l>z min val</l><block var="zmin"/></block><block s="doSetVar"><l>z max val</l><block var="zmax"/></block><block s="doSetVar"><l>x-stepsize</l><block s="reportQuotient"><l>480</l><block s="reportDifference"><block var="xmax"/><block var="xmin"/></block></block></block><block s="doSetVar"><l>y-stepsize</l><block s="reportQuotient"><l>360</l><block s="reportDifference"><block var="ymax"/><block var="ymin"/></block></block></block><block s="doSetVar"><l>z-stepsize</l><block s="reportQuotient"><l>7</l><block s="reportDifference"><block var="zmax"/><block var="zmin"/></block></block></block><custom-block s="announce axes position %n %n"><custom-block s="y-axis"></custom-block><custom-block s="x-axis"></custom-block></custom-block></script></block-definition><block-definition s="plot point x: %&apos;x&apos; y: %&apos;y&apos; z: %&apos;z&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input><input type="%n"></input></inputs><script><block s="setSize"><l>1</l></block><custom-block s="go to scaled point x: %n y: %n"><block var="x"/><block var="y"/></custom-block><block s="down"></block><block s="setSize"><custom-block s="pen size for z= %n"><block var="z"/></custom-block></block><block s="forward"><l>1</l></block><block s="up"></block><block s="forward"><l>-1</l></block></script></block-definition><block-definition s="pen size for z= %&apos;actual z value&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportSum"><l>3</l><block s="reportProduct"><block s="reportDifference"><block var="actual z value"/><block var="z min val"/></block><block var="z-stepsize"/></block></block></block></script></block-definition><block-definition s="graph 3D datapoints %&apos;data&apos; pen down %&apos;pendown&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%b"></input></inputs><script><block s="up"></block><custom-block s="for each %upvar of %l %cs"><l>item</l><block var="data"/><script><custom-block s="plot point x: %n y: %n z: %n"><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>2</l><l/></block><block s="reportListItem"><l>3</l><l/></block></custom-block><block s="doIf"><block var="pendown"/><script><block s="down"></block></script></block></script></custom-block></script></block-definition><block-definition s="graph function %&apos;function&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input></inputs><script><block s="up"></block><block s="doWaitUntil"><block s="reportMouseDown"></block></block><block s="doUntil"><block s="reportNot"><block s="reportMouseDown"></block></block><script><custom-block s="plot point x: %n y: %n"><custom-block s="x-value at stage coord %n"><block s="reportMouseX"></block></custom-block><block s="evaluate"><block var="function"/><list><custom-block s="x-value at stage coord %n"><block s="reportMouseX"></block></custom-block></list></block></custom-block><block s="down"></block></script></block><block s="up"></block></script><scripts><comment x="8" y="226.13333333333333" w="399.3333333333333" collapsed="false">This is straightforward apart from the two points brought out on the lab page:&#xD;1.  How to declare an input of type Reporter.&#xD;2.  How to call that function and give it an input.&#xD;Otherwise it&apos;s just figuring out the WAIT UNTIL / REPEAT UNTIL structure, and remembering from two pages back to put the PEN DOWN /after/ moving to the first point.</comment></scripts></block-definition><block-definition s="list from %&apos;from&apos; through %&apos;to&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doDeclareVariables"><list><l>result</l></list></block><block s="doSetVar"><l>result</l><block s="reportNewList"><list></list></block></block><custom-block s="for %upvar = %n to %n %cs"><l>i</l><block var="from"/><block var="to"/><script><block s="doAddToList"><block var="i"/><block var="result"/></block></script></custom-block><block s="doReport"><block var="result"/></block></script><scripts><script x="10.666666666666686" y="181.79999999999995"><block s="doIfElse"><block s="reportGreaterThan"><block var="from"/><block var="to"/></block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script><script><block s="doReport"><block s="reportCONS"><block var="from"/><custom-block s="list from %n through %n"><block s="reportSum"><block var="from"/><l>1</l></block><block var="to"/></custom-block></block></block></script></block></script></scripts></block-definition><block-definition s="alphie way sum from 1 %&apos;num&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><custom-block s="combine with %repRing items of %l"><block s="reifyReporter"><autolambda><block s="reportSum"><l></l><l></l></block></autolambda><list></list></block><custom-block s="list from %n through %n"><l>1</l><block var="num"/></custom-block></custom-block></block></script></block-definition><block-definition s="betsy way sum from 1 %&apos;num&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportQuotient"><block s="reportProduct"><block var="num"/><block s="reportSum"><block var="num"/><l>1</l></block></block><l>2</l></block></block></script></block-definition><block-definition s="are the numbers of %&apos;data&apos; distinct?" type="predicate" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIfElse"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><script><block s="doIfElse"><block s="reportListContainsItem"><block s="reportCDR"><block var="data"/></block><block s="reportListItem"><l>1</l><block var="data"/></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script><script><block s="doReport"><custom-block s="are the numbers of %l distinct?"><block s="reportCDR"><block var="data"/></block></custom-block></block></script></block></script></block></script><scripts><script x="15" y="366.4666666666667"><block s="doIf"><block s="reportLessThan"><block s="reportListLength"><block var="data"/></block><l>2</l></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block><custom-block s="for %upvar = %n to %n %cs"><l>i</l><l>1</l><block s="reportDifference"><block s="reportListLength"><block var="data"/></block><l>1</l></block><script><custom-block s="for %upvar = %n to %n %cs"><l>j</l><block s="reportSum"><block var="i"/><l>1</l></block><block s="reportListLength"><block var="data"/></block><script><block s="doIf"><block s="reportEquals"><block s="reportListItem"><block var="i"/><block var="data"/></block><block s="reportListItem"><block var="j"/><block var="data"/></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block></script></custom-block></script></custom-block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><script x="14.666666666666666" y="615.3333333333334"><block s="doRepeat"><block s="reportListLength"><block var="data"/></block><script><block s="doIf"><block s="reportListContainsItem"><block s="reportCDR"><block var="data"/></block><block s="reportListItem"><l>1</l><block var="data"/></block></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><comment x="10.333334333333369" y="238.66667266666673" w="454.6666666666667" collapsed="false">This so much calls out for a recursive solution that I couldn&apos;t help putting that first.&#xD;&#xD;CONTAINS is a primitive block.  Students who remember that will have a much easier time writing this procedure than those who don&apos;t remember it.  The other thing that will complicate the solution is if the students have programmed before in one of those other languages and therefore insist on using index variables to find their way through the list instead of ALL BUT FIRST OF.  Here are a few examples of possible correct solutions:</comment><script x="13.333333333333334" y="796.8000000000001"><block s="doRepeat"><block s="reportListLength"><block var="data"/></block><script><custom-block s="for each %upvar of %l %cs"><l>item</l><block s="reportCDR"><block var="data"/></block><script><block s="doIf"><block s="reportEquals"><block s="reportListItem"><l>1</l><block var="data"/></block><block var="item"/></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block></script></custom-block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></block><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></scripts></block-definition><block-definition s="all %&apos;digits&apos; digit numbers" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><custom-block s="list from %n through %n"><block s="reportMonadic"><l><option>10^</option></l><block s="reportDifference"><block var="digits"/><l>1</l></block></block><block s="reportDifference"><block s="reportMonadic"><l><option>10^</option></l><block var="digits"/></block><l>1</l></block></custom-block></block></script></block-definition><block-definition s="round %&apos;input number&apos; to %&apos;n&apos; decimal places" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportQuotient"><block s="reportRound"><block s="reportProduct"><block var="input number"/><block s="reportMonadic"><l><option>10^</option></l><block var="n"/></block></block></block><block s="reportMonadic"><l><option>10^</option></l><block var="n"/></block></block></block></script></block-definition><block-definition s="coordinate pair x %&apos;x&apos; y %&apos;y&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportJoinWords"><list><l>(</l><block var="x"/><l>,</l><l> </l><block var="y"/><l>)</l></list></block></block></script></block-definition><block-definition s="announce axes position %&apos;x&apos; %&apos;y&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="up"></block><block s="gotoXY"><block var="x"/><block s="reportSum"><block var="y"/><l>5</l></block></block><custom-block s="label %txt of size %n"><custom-block s="coordinate pair x %n y %n"><custom-block s="round %n to %n decimal places"><custom-block s="x-value at stage coord %n"><block var="x"/></custom-block><l>2</l></custom-block><custom-block s="round %n to %n decimal places"><custom-block s="y-value at stage coord %n"><block var="y"/></custom-block><l>2</l></custom-block></custom-block><l>16</l></custom-block><block s="gotoXY"><block var="x"/><block var="y"/></block></script></block-definition><block-definition s="y-axis" type="reporter" category="looks"><header></header><code></code><translations></translations><inputs></inputs><script><block s="bubble"><l></l></block><block s="setHeading"><l>0</l></block><block s="doIfElse"><custom-block s="%n ≤ %n ≤ %n"><block var="x min val"/><l>0</l><block var="x max val"/></custom-block><script><block s="up"></block><block s="gotoXY"><custom-block s="stage coord for x= %n"><l>0</l></custom-block><l>-180</l></block><block s="setSize"><l>3</l></block><block s="down"></block><block s="forward"><l>360</l></block><block s="up"></block><block s="setSize"><l>1</l></block><block s="doReport"><block s="xPosition"></block></block></script><script><block s="up"></block><block s="gotoXY"><l>0</l><l>-180</l></block><block s="setSize"><l>1</l></block><custom-block s="dashed line %n"><l>360</l></custom-block><block s="doReport"><block s="xPosition"></block></block></script></block></script></block-definition><block-definition s="x-axis" type="reporter" category="looks"><header></header><code></code><translations></translations><inputs></inputs><script><block s="bubble"><l></l></block><block s="setHeading"><l>90</l></block><block s="doIfElse"><custom-block s="%n ≤ %n ≤ %n"><block var="y min val"/><l>0</l><block var="y max val"/></custom-block><script><block s="up"></block><block s="gotoXY"><l>-240</l><custom-block s="stage coord for y= %n"><l>0</l></custom-block></block><block s="setSize"><l>3</l></block><block s="down"></block><block s="forward"><l>480</l></block><block s="setSize"><l>1</l></block><block s="up"></block><block s="doReport"><block s="yPosition"></block></block></script><script><block s="up"></block><block s="gotoXY"><l>-240</l><l>0</l></block><block s="setSize"><l>1</l></block><custom-block s="dashed line %n"><l>480</l></custom-block><block s="doReport"><block s="yPosition"></block></block></script></block></script></block-definition><block-definition s="dashed line %&apos;length&apos;" type="command" category="pen"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doWarp"><script><block s="doRepeat"><block s="reportMonadic"><l><option>floor</option></l><block s="reportQuotient"><block var="length"/><l>10</l></block></block><script><block s="down"></block><block s="forward"><l>5</l></block><block s="up"></block><block s="forward"><l>5</l></block></script></block><block s="down"></block><block s="forward"><block s="reportModulus"><block var="length"/><l>10</l></block></block><block s="up"></block></script></block></script></block-definition><block-definition s="stage coord for y= %&apos;actual y value&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportSum"><l>-180</l><block s="reportProduct"><block s="reportDifference"><block var="actual y value"/><block var="y min val"/></block><block var="y-stepsize"/></block></block></block></script></block-definition><block-definition s="stage coord for x= %&apos;actual x value&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportSum"><l>-240</l><block s="reportProduct"><block s="reportDifference"><block var="actual x value"/><block var="x min val"/></block><block var="x-stepsize"/></block></block></block></script></block-definition><block-definition s="x-value at stage coord %&apos;stage-x&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportSum"><block var="x min val"/><block s="reportQuotient"><block s="reportSum"><block var="stage-x"/><l>240</l></block><block var="x-stepsize"/></block></block></block></script></block-definition><block-definition s="y-value at stage coord %&apos;stage-y&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input></inputs><script><block s="doReport"><block s="reportSum"><block var="y min val"/><block s="reportQuotient"><block s="reportSum"><block var="stage-y"/><l>180</l></block><block var="y-stepsize"/></block></block></block></script></block-definition><block-definition s="%&apos;x&apos; ≤ %&apos;y&apos; ≤ %&apos;z&apos;" type="predicate" category="operators"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input><input type="%n"></input></inputs><script><block s="doReport"><block s="reportAnd"><block s="reportNot"><block s="reportGreaterThan"><block var="x"/><block var="y"/></block></block><block s="reportNot"><block s="reportGreaterThan"><block var="y"/><block var="z"/></block></block></block></block></script></block-definition><block-definition s="label %&apos;text&apos; of size %&apos;size&apos;" type="command" category="pen"><comment x="0" y="0" w="90" collapsed="false">LABEL will stamp text on the stage at the given font size. The direction of the text is the direction the sprite is facing, and color will match the pen color.</comment><header></header><code></code><translations></translations><inputs><input type="%txt">Hello!</input><input type="%n">12</input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>text</l><l>size</l></list><l>var stage = this.parentThatIsA(StageMorph),&#xD;    context = stage.penTrails().getContext(&apos;2d&apos;),&#xD;    rotation = radians(this.direction() - 90),&#xD;    trans = new Point(&#xD;      this.center().x - stage.left(),&#xD;      this.center().y - stage.top()&#xD;    ),&#xD;    isWarped = this.Warped,&#xD;    len,&#xD;    pos;&#xD;&#xD;if (isWarped) {endWarp(); }&#xD;context.save();&#xD;context.font = size + &apos;px monospace&apos;;&#xD;context.textAlign = &apos;left&apos;;&#xD;context.textBaseline = &apos;alphabetic&apos;;&#xD;context.fillStyle = this.color.toString();&#xD;len = context.measureText(text).width;&#xD;trans = trans.multiplyBy(1 / stage.scale);&#xD;context.translate(trans.x, trans.y);&#xD;context.rotate(rotation);&#xD;context.fillText(text, 0, 0);&#xD;context.translate(-trans.x, -trans.y);&#xD;context.restore();&#xD;pos = new Point(&#xD;  len * Math.sin(radians(this.direction())),&#xD;  len * Math.cos(radians(this.direction())));&#xD;pos = pos.add(new Point(this.xPosition(), this.yPosition()));&#xD;this.gotoXY(pos.x, pos.y, false);&#xD;this.changed();&#xD;if (isWarped) {this.startWarp(); }&#xD;stage.changed();</l></block><list><block var="text"/><block var="size"/></list></block></script></block-definition><block-definition s="empty? %&apos;data&apos;" type="predicate" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportEquals"><block var="data"/><block s="reportNewList"><list></list></block></block></block></script></block-definition><block-definition s="keep items such that %&apos;pred&apos; from %&apos;data&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%predRing"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIfElse"><block s="evaluate"><block var="pred"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></block></script><script><block s="doReport"><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></script></block></script></block></script></block-definition><block-definition s="combine with %&apos;function&apos; items of %&apos;data&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="data"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="data"/></block></block></script></block><block s="doReport"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="combine with %repRing items of %l"><block var="function"/><block s="reportCDR"><block var="data"/></block></custom-block></list></block></block></script></block></script></block-definition><block-definition s="for each %&apos;item&apos; of %&apos;data&apos; %&apos;action&apos;" type="command" category="lists"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%l"></input><input type="%cs"></input></inputs><script><block s="doUntil"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doSetVar"><l>item</l><block s="reportListItem"><l>1</l><block var="data"/></block></block><block s="doRun"><block var="action"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></block></script></block-definition><block-definition s="say position %&apos;x&apos; %&apos;y&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="doSayFor"><custom-block s="coordinate pair x %n y %n"><custom-block s="round %n to %n decimal places"><custom-block s="x-value at stage coord %n"><block var="x"/></custom-block><l>2</l></custom-block><custom-block s="round %n to %n decimal places"><custom-block s="y-value at stage coord %n"><block var="y"/></custom-block><l>2</l></custom-block></custom-block><l>2</l></block></script></block-definition><block-definition s="graph datapoints %&apos;data&apos; pendown: %&apos;pendown?&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%l"></input><input type="%b"></input></inputs><script><block s="up"></block><custom-block s="for each %upvar of %l %cs"><l>item</l><block var="data"/><script><custom-block s="PlotPoint x: %n y: %n"><block s="reportListItem"><l>1</l><l/></block><block s="reportListItem"><l>2</l><l/></block></custom-block><block s="doIf"><block var="pendown?"/><script><block s="down"></block></script></block></script></custom-block></script></block-definition><block-definition s="PlotPoint x: %&apos;x&apos; y: %&apos;y&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><custom-block s="go to scaled point x: %n y: %n"><block var="x"/><block var="y"/></custom-block><block s="down"></block><block s="forward"><l>1</l></block><block s="up"></block><block s="forward"><l>-1</l></block></script></block-definition><block-definition s="go to scaled point x: %&apos;x&apos; y: %&apos;y&apos;" type="command" category="motion"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%n"></input></inputs><script><block s="gotoXY"><custom-block s="stage coord for x= %n"><block var="x"/></custom-block><custom-block s="stage coord for y= %n"><block var="y"/></custom-block></block></script></block-definition><block-definition s="time function %&apos;Function&apos;" type="reporter" category="other"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input></inputs><script><block s="doReport"><block s="reportListItem"><l>2</l><custom-block s="function timer %anyUE"><block var="Function"/></custom-block></block></block></script></block-definition><block-definition s="function timer %&apos;Function&apos;" type="reporter" category="other"><header></header><code></code><translations></translations><inputs><input type="%anyUE"></input></inputs><script><block s="doDeclareVariables"><list><l>time</l></list></block><block s="doSetVar"><l>time</l><block s="reportDate"><l><option>time in milliseconds</option></l></block></block><block s="doReport"><block s="reportNewList"><list><block s="evaluate"><block var="Function"/><list><l></l></list></block><block s="reportDifference"><block s="reportDate"><l><option>time in milliseconds</option></l></block><block var="time"/></block></list></block></block></script></block-definition></blocks><variables></variables></project><media name="U5L3 p2" app="Snap! 5.4, http://snap.berkeley.edu" version="1"></media></snapdata>