<snapdata remixID="14940563"><project name="U3L1-Tic-Tac-Toe Setup" app="Snap! 11.0.8, https://snap.berkeley.edu" version="2"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAoKADAAQAAAABAAAAeAAAAAAeaS0RAAACJUlEQVR4Ae3SwQ0AIBDDMGD/nQ/EEvm4C1SKvOdtmQJRgRP9ulXgFwAQhLQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdA8hAWgDANL9zABlICwCY5ncOIANpAQDT/M4BZCAtAGCa3zmADKQFAEzzOweQgbQAgGl+5wAykBYAMM3vHEAG0gIApvmdX3dXBOxAFCWaAAAAAElFTkSuQmCC</thumbnail><scenes select="1"><scene name="U3L1-Tic-Tac-Toe Setup"><notes></notes><hidden></hidden><headers></headers><code></code><blocks><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="map %&apos;function&apos; over %&apos;lists&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%repRing"></input><input type="%mult%l"></input></inputs><script><block s="doWarp"><script><block s="doDeclareVariables"><list><l>mapone</l><l>mapmany</l></list></block><block s="doSetVar"><l>mapone</l><block s="reifyScript"><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><list></list></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="evaluate"><block var="mapone"/><list><block s="reportCDR"><block var="data"/></block></list></block></block></block></script><list><l>data</l></list></block></block><block s="doSetVar"><l>mapmany</l><block s="reifyScript"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportListItem"><l>1</l><block var="data lists"/></block></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="function"/><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><list><block var="data lists"/></list></custom-block></block><block s="evaluate"><block var="mapmany"/><list><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportCDR"><l/></block></autolambda><list></list></block><list><block var="data lists"/></list></custom-block></list></block></block></block></script><list><l>data lists</l></list></block></block><block s="doIfElse"><custom-block s="empty? %l"><block s="reportCDR"><block var="lists"/></block></custom-block><script><block s="doReport"><block s="evaluate"><block var="mapone"/><list><block s="reportListItem"><l>1</l><block var="lists"/></block></list></block></block></script><script><block s="doReport"><block s="evaluate"><block var="mapmany"/><list><block var="lists"/></list></block></block></script></block></script></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="reportVariadicEquals"><list><block var="data"/><block s="reportNewList"><list></list></block></list></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><list></list></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><list></list></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="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="reportVariadicGreaterThan"><list><block var="start"/><block var="end"/></list></block><script><block s="doSetVar"><l>step</l><l>-1</l></block><block s="doSetVar"><l>tester</l><block s="reifyReporter"><autolambda><block s="reportVariadicLessThan"><list><block var="i"/><block var="end"/></list></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="reportVariadicGreaterThan"><list><block var="i"/><block var="end"/></list></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><list></list></block><block s="doIf"><block s="reportVariadicEquals"><list><l></l><block s="reportListItem"><l>1</l><block var="words"/></block></list></block><script><block s="doReport"><custom-block s="join words %mult%txt"><block s="reportCDR"><block var="words"/></block></custom-block></block></script><list></list></block><block s="doIf"><block s="reportVariadicEquals"><list><l></l><block s="reportListItem"><l>2</l><block var="words"/></block></list></block><script><block s="doReport"><custom-block s="join words %mult%txt"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="words"/></block><block s="reportCDR"><block s="reportCDR"><block var="words"/></block></block></block></custom-block></block></script><list></list></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><scripts><script x="229.00000300000002" y="196.77778077777774"><block s="reportJoinWords"><list><l></l><l></l></list></block></script></scripts></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><custom-block s="ignore %s"><l>3</l></custom-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="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="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><list></list></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="make ONE row" type="command" category="motion"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doRepeat"><l>3</l><script><block s="doChangeVar"><l>clone number</l><l>1</l></block><block s="createClone"><l><option>myself</option></l></block><block s="changeXPosition"><l>50</l></block></script><comment w="90" collapsed="true">Repeating three times make three boxes in one row. It creates a clone of one of the boxes, and then changes x to move right to make a full row. </comment></block></script></block-definition><block-definition s="make Tic Tac Toe Board" type="command" category="motion"><header></header><code></code><translations></translations><inputs></inputs><script><custom-block s="for %upvar = %n to %n %cs"><l>i</l><l>1</l><l>3</l><script><custom-block s="make ONE row"></custom-block><block s="changeXPosition"><l>-150</l></block><block s="changeYPosition"><l>-50</l></block></script><comment w="90" collapsed="true">For each row from 1 to 3, one row is created and then it moves down to create the next row, until there is three rows. </comment></custom-block><block s="gotoXY"><l>1000</l><l>1000</l></block></script></block-definition><block-definition s="x wins?" type="predicate" category="operators"><header></header><code></code><translations></translations><inputs></inputs><script><custom-block s="for each %upvar of %l %cs"><l>triple</l><block var="Winning Triples"><comment w="90" collapsed="false">This makes it so for each of the winning triples combination, if there are x&apos;s in any of the triple combinations on the board, then x wins and reports as true. </comment></block><script><block s="doIf"><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>1</l><block var="triple"/></block><block var="board"/></block><l>X</l></list></block><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>2</l><block var="triple"/></block><block var="board"/></block><l>X</l></list></block><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>3</l><block var="triple"/></block><block var="board"/></block><l>X</l></list></block></list></block></list></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><list></list></block></script></custom-block><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block-definition><block-definition s="o wins?" type="predicate" category="operators"><header></header><code></code><translations></translations><inputs></inputs><script><custom-block s="for each %upvar of %l %cs"><l>triple</l><block var="Winning Triples"><comment w="90" collapsed="false">This makes it so for each of the winning triples combination, if there are o&apos;s in any of the triple combinations on the board then o wins and reports as true. </comment></block><script><block s="doIf"><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>1</l><block var="triple"/></block><block var="board"/></block><l>O</l></list></block><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>2</l><block var="triple"/></block><block var="board"/></block><l>O</l></list></block><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>3</l><block var="triple"/></block><block var="board"/></block><l>O</l></list></block></list></block></list></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><list></list></block></script></custom-block><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block><block s="doReport"><l></l></block></script></block-definition><block-definition s="wins?" type="predicate" category="other"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doReport"><l></l></block></script></block-definition><block-definition s="%&apos;Winner&apos; wins?" type="predicate" category="operators"><comment x="0" y="0" w="90" collapsed="true">This makes it so for each of the numbers in any of the winning triples, it will report true if  x wins or o wins. Winner variable is whichever letters in that text box, either x or o.</comment><header></header><code></code><translations></translations><inputs><input type="%s" initial="1"></input></inputs><script><custom-block s="for each %upvar of %l %cs"><l>triple</l><block var="Winning Triples"/><script><block s="doIf"><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>1</l><block var="triple"/></block><block var="board"/></block><block var="Winner"/></list></block><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>2</l><block var="triple"/></block><block var="board"/></block><block var="Winner"/></list></block><block s="reportVariadicEquals"><list><block s="reportListItem"><block s="reportListItem"><l>3</l><block var="triple"/></block><block var="board"/></block><block var="Winner"/></list></block></list></block></list></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><list></list></block></script></custom-block><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block-definition></blocks><primitives></primitives><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" hyperops="true" codify="false" inheritance="false" sublistIDs="false" id="836"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB4KADAAQAAAABAAABaAAAAAAHwbojAAAL30lEQVR4Ae3QMQEAAADCoPVPbQwfiEBhwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBg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ABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGDBgwIABAwYMGPgMDI3+AAEeFvcCAAAAAElFTkSuQmCC</pentrails><costumes><list struct="atomic" id="837"></list></costumes><sounds><list struct="atomic" id="838"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites select="1"><sprite name="Square" idx="1" x="1000" y="1000" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="false" costume="1" color="80,80,80,1" pen="tip" id="843"><costumes><list id="844"><item><ref mediaID="U3L1-Tic-Tac-Toe Setup_Square_cst_Empty"></ref></item><item><ref mediaID="U3L1-Tic-Tac-Toe Setup_Square_cst_X"></ref></item><item><ref mediaID="U3L1-Tic-Tac-Toe Setup_Square_cst_O"></ref></item></list></costumes><sounds><list struct="atomic" id="845"></list></sounds><blocks></blocks><variables><variable name="clone number"><l>9</l></variable></variables><scripts><script x="11" y="10"><block s="receiveGo"><comment w="90" collapsed="true">This makes sure that when the board is created it will always start with empty spaces. </comment></block><block s="doSwitchToCostume"><l>Empty</l></block><block s="doSetVar"><l>clone number</l><l>0</l></block><block s="doSetVar"><l>X&apos;s turn?</l><block s="reportBoolean"><l><bool>true</bool></l><comment w="90" collapsed="true">When the game starts X&apos;s turn starts at true meaning x will always go first. </comment></block></block><block s="doSetVar"><l>board</l><block s="reportNewList"><list><l>empty</l><l>empty</l><l>empty</l><l>empty</l><l>empty</l><l>empty</l><l>empty</l><l>empty</l><l>empty</l></list></block><comment w="90" collapsed="true">The board variable has 9 empty spaces. This will later tell other codes which spaces can and can&apos;t be used for placement. </comment></block><block s="doSetVar"><l>Winning Triples</l><block s="reportNewList"><list><block s="reportNewList"><list><l>1</l><l>2</l><l>3</l></list></block><block s="reportNewList"><list><l>4</l><l>5</l><l>6</l></list></block><block s="reportNewList"><list><l>7</l><l>8</l><l>9</l></list></block><block s="reportNewList"><list><l>1</l><l>4</l><l>7</l></list></block><block s="reportNewList"><list><l>2</l><l>5</l><l>8</l></list></block><block s="reportNewList"><list><l>3</l><l>6</l><l>9</l></list></block><block s="reportNewList"><list><l>3</l><l>5</l><l>7</l></list></block><block s="reportNewList"><list><l>1</l><l>5</l><l>9</l></list></block></list></block><comment w="90" collapsed="true">This makes the winning triples variable all of the possible ways that a player can win. There are 8 possible ways to win. </comment></block><block s="gotoXY"><l>-50</l><l>50</l></block><custom-block s="make Tic Tac Toe Board"><comment w="90" collapsed="true">This creates the Tic Tac Toe board, having 9 spaces to be played. </comment></custom-block></script><script x="337" y="19.033333333333417"><block s="receiveOnClone"><comment w="90" collapsed="true">This updates the clones and not the original. </comment></block><block s="doWaitUntil"><block s="reportVariadicEquals"><list><block s="reportListItem"><block var="clone number"/><block var="board"/></block><l>O</l></list><comment w="90" collapsed="true">When one of the clone numbers of the board variable is O, it will know to place an O in the box that correlates to whichever number it picks. 1-9. It then places o in that box. </comment></block></block><block s="doSwitchToCostume"><l>O</l></block></script><script x="12" y="261.1333333333333"><block s="receiveInteraction"><l><option>clicked</option></l><comment w="90" collapsed="true">If any of the boxes are costume 1, meaning it&apos;s empty, the user can click only the empty boxes. Whichever empty box the user clicks, an x will be placed. Each box has a correlated number. After an x is placed on the board it will then set x&apos;s turn the false, meaning now its o&apos;s turn. If there x&apos;s in any of the winning triples, x wins. </comment></block><block s="doIf"><block s="reportVariadicEquals"><list><block s="getCostumeIdx"></block><l>1</l></list></block><script><block s="doIf"><block s="reportVariadicEquals"><list><block var="X&apos;s turn?"/><block s="reportBoolean"><l><bool>true</bool></l></block></list></block><script><block s="doSwitchToCostume"><l>X</l></block><block s="doReplaceInList"><block var="clone number"/><block var="board"/><l>X</l></block><block s="doSetVar"><l>X&apos;s turn?</l><block s="reportBoolean"><l><bool>false</bool></l></block></block><block s="doIf"><custom-block s="%s wins?"><l>X</l></custom-block><script><block s="doSayFor"><l>X wins!</l><l>4</l></block><block s="doStopThis"><l><option>all</option></l></block></script><list></list></block></script><list></list></block></script><list></list></block><block s="doIf"><block s="reportVariadicAnd"><list><block s="reportVariadicEquals"><list><block var="X&apos;s turn?"/><block s="reportBoolean"><l><bool>false</bool></l></block></list></block><block s="reportListContainsItem"><block var="board"/><l>empty</l></block></list></block><script><block s="doUntil"><block s="reportVariadicEquals"><list><block s="reportListItem"><block var="o turn"/><block var="board"/></block><l>empty</l></list><comment w="90" collapsed="true">This makes the computer repeat until it finds one of the spaces on the board to be empty, which then places an o randomly in the numbered box that correlates. There are 9 boxes. </comment></block><script><block s="doSetVar"><l>o turn</l><block s="reportRandom"><l>1</l><l>9</l></block></block></script></block><block s="doWait"><l>.5</l></block><block s="doReplaceInList"><block var="o turn"/><block var="board"/><l>O</l><comment w="90" collapsed="true">This replaces the empty space with an o on the board. After it&apos;s placed it sets x&apos;s turn to be true, meaning it&apos;s now x&apos;s turn. If there are three o&apos;s in a winning triple, it will say O wins.</comment></block><block s="doSetVar"><l>X&apos;s turn?</l><block s="reportBoolean"><l><bool>true</bool></l></block></block><block s="doIf"><custom-block s="%s wins?"><l>O</l></custom-block><script><block s="doSayFor"><l>O wins!</l><l>4</l></block><block s="doStopThis"><l><option>all</option></l></block></script><list></list></block></script><list></list><comment w="90" collapsed="true">If x&apos;s turn is false and if any space on the board is empty, the computer can place an o on the board. </comment></block><block s="doIf"><block s="reportNot"><block s="reportListContainsItem"><block var="board"/><l>empty</l></block><comment w="90" collapsed="true">If the board has no remaining empty slots if o or x wins isn&apos;t already said, this means there is a draw and no winning triples were met. So, Draw is stated. </comment></block><script><block s="doSayFor"><l>Draw!</l><l>4</l></block><block s="doStopThis"><l><option>all</option></l></block></script><list></list></block></script></scripts></sprite><watcher scope="Square" s="xPosition" style="normal" x="10" y="10" color="74,108,212" hidden="true"/><watcher scope="Square" s="yPosition" style="normal" x="10" y="31.00000200000001" color="74,108,212" hidden="true"/><watcher var="X&apos;s turn?" style="normal" x="8" y="15.00000399999999" color="243,118,29" hidden="true"/><watcher var="board" style="normal" x="10" y="52.00000399999999" color="243,118,29" hidden="true"/><watcher scope="Square" var="clone number" style="normal" x="10" y="145.00000599999998" color="243,118,29" hidden="true"/><watcher var="Winning Triples" style="normal" x="10" y="166.000008" color="243,118,29" hidden="true"/><watcher var="o turn" style="normal" x="10" y="338.999998" color="243,118,29" hidden="true"/></sprites></stage><variables><variable name="X&apos;s turn?"><bool>true</bool></variable><variable name="board"><list struct="atomic" id="1092">empty,empty,empty,empty,empty,empty,empty,empty,empty</list></variable><variable name="Winning Triples"><list id="1093"><item><list struct="atomic" id="1094">1,2,3</list></item><item><list struct="atomic" id="1095">4,5,6</list></item><item><list struct="atomic" id="1096">7,8,9</list></item><item><list struct="atomic" id="1097">1,4,7</list></item><item><list struct="atomic" id="1098">2,5,8</list></item><item><list struct="atomic" id="1099">3,6,9</list></item><item><list struct="atomic" id="1100">3,5,7</list></item><item><list struct="atomic" id="1101">1,5,9</list></item></list></variable><variable name="o turn"><l>8</l></variable></variables></scene></scenes></project><media name="U3L1-Tic-Tac-Toe Setup" app="Snap! 11.0.8, https://snap.berkeley.edu" version="2"><costume name="Empty" center-x="26" center-y="26" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAANKADAAQAAAABAAAANAAAAABdv+0DAAAAx0lEQVRoBe2asQ2DMAAErSglaUlNJmEWImYFRdnJATb4FCewzpLL18l3lJTS4Bm3N9UW7jC8vrc90PSeS6310ndZP6XrHvfjQfujWjk+6OwlLWQh2ICfHCw8xlkoVgYPLAQLj3EWipXBAwvBwmOchWJl8MBCsPAYZ6FYGTywECw8xlkoVgYPLAQLj3EWipXBAwvBwmOchWJl8MBCsPAYZ6FYGTywECw8xlkoVgYPLAQLj3EWipXBAwvBwv/CjduqiT8a+/65/gAgXfnWAcy/sAAAAABJRU5ErkJggg==" mediaID="U3L1-Tic-Tac-Toe Setup_Square_cst_Empty"/><costume name="X" center-x="26" center-y="26" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAANKADAAQAAAABAAAANAAAAABdv+0DAAACJUlEQVRoBe3aT0sCQRQA8Gd0EIT8AFaIn8JO9gE0kI7ln05BdMhblyLtWp0iqOwjRNCn2AjM/nuS/mjZN0i6tCMsSLizOzPvzc6GD4aR1R3fb+ex8HQjAJDM5fKbsVg0ar8OdfT7Pw+TtiDZ632UiuWVUIO+ep9w02i8MhCkUqnv9bXVUIOsq2sGgolQ19iI5MegERfFqEPcHXp77xiVLEvGKycuqFqtwdb2jjGox6dnmM9k4Pzi0jUnLuhgfw9arZYRKIbJZbOwtFyAxfyCHCgen4L66UngqGHMbo1fMdwdYpchaJQIhuXrCQoSJYrxDQoCJYMRAulEyWKEQTpQKhgpECVKFSMNokBhYJRAmCgsjDIIA4WJQQGpoLAxaCAZFAUGFSSCosKgg/ygKDEkIB6KGkMGGoXSgSEFDaOazSbMpdOD5syrn2HnqYSv9kHlCzrdLtzf3UIikVBZxve5pCCnzArFEliWpaXzJQM5GPYbACszXZ0vCegvxqkXHSh0kBtGFwoV5IXRgUID+cVQo1BAohhKlDJIFkOFUgKpYihQ0iAsDDZKCoSNwUQJg6gwWCghEDUGA+UbpAujivIF0o1RQXmCgsLIorigoDEyKC6oslHR0jY7ifPm4daD96fx4NEYt4XqZ3WYnZl2e1v7cQfFZrfg7pBJGAfAw7DPcEHOImGaxyDTd2twU2i329HDo2PTc+Xmxx4AZBGxR9IeZXv8h3j5BRxf4Dto8cI/AAAAAElFTkSuQmCC" mediaID="U3L1-Tic-Tac-Toe Setup_Square_cst_X"/><costume name="O" center-x="26" center-y="26" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAANKADAAQAAAABAAAANAAAAABdv+0DAAAE/UlEQVRoBe2aXUwUVxTHTxof2fXNhtA2EVlY25h2+Yi8WNYt1KRBrVYrlmqMski1jcpa0wctu9pEq4I1tsbCQz8UWIWKfPigKIo+uAouvtSvNTWFtrwK+j7e/9VpkJ07XzvLTKknmczu/Tj3/O49c/bOuUs0DcXPmKTpcM2enT34ChZo/YYgSZL0n76uxW5QRoZrBg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