<?xml version="1.0" encoding="UTF-8"?>
<Worksheet>
<Version major="12" minor="2"/>
<Label-Scheme value="2" prefix=""/>
<View-Properties presentation="false"></View-Properties>
<MapleNet-Properties elisiondigitsbefore="100" labelling="true" indentamount="4" elisiontermsthreshold="10000" ansi="false" errorbreak="1" useclientjvm="true" echo="1" imaginaryunit="I" labelwidth="20" plotdriver="openviz" elisiondigitsafter="100" plotoutput="terminal" rtablesize="10" elisiontermsbefore="100" elisiondigitsthreshold="10000" typesetting="standard" plotdevice="inline" verboseproc="1" showassumed="1" errorcursor="false" longdelim="true" plotoptions="" quiet="false" elisiontermsafter="100" screenwidth="79" preplot="" prettyprint="3" displayprecision="-1" warnlevel="3" screenheight="25" latexwidth="6.0" postplot="" prompt="&gt; " ShowLabels="true"/>
<Styles><Font name="Ordered List 1" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 2" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 3" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 4" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Ordered List 5" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Author" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Annotation Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Warning" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input Placeholder" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[200,0,200]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="true"/>
<Font name="Maple Plot" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Code" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Line Printed Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text Output" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Diagnostic" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[40,120,40]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Inert Output" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[144,144,144]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Normal" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,128,128]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="Maple Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dash Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Math" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Maple Input" background="[255,255,255]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Output" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="2D Input" background="[255,255,255]" bold="false" executable="true" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Header and Footer" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="10" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Error" background="[255,255,255]" bold="false" executable="false" family="Monospaced" foreground="[255,0,255]" italic="false" opaque="false" readonly="true" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Title" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 1" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="18" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Text" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Bullet Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Equation Label" background="[255,255,255]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 4" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 3" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="true" opaque="false" readonly="false" size="14" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Heading 2" background="[255,255,255]" bold="true" executable="false" family="Serif" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="16" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Font name="Dictionary Hyperlink" background="[255,255,255]" bold="false" executable="false" family="Serif" foreground="[147,0,15]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="true" placeholder="false"/>
<Font name="List Item" background="[255,255,255]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" opaque="false" readonly="false" size="12" subscript="false" superscript="false" underline="false" placeholder="false"/>
<Layout name="Maple Output" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.3" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Ordered List 1" alignment="left" bullet="numeric" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Dash Item" alignment="left" bullet="dash" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Ordered List 2" alignment="left" bullet="alphabetic" firstindent="0" leftmargin="36" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 3" alignment="left" bullet="roman" firstindent="0" leftmargin="72" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 4" alignment="left" bullet="ALPHABETIC" firstindent="0" leftmargin="108" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Ordered List 5" alignment="left" bullet="ROMAN" firstindent="0" leftmargin="144" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="-1" bulletsuffix=""/>
<Layout name="Author" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="8" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Warning" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Annotation Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Maple Plot" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Error" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Title" alignment="centred" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="12" spacebelow="12" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Line Printed Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 1" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="4" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Diagnostic" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="any" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Text Output" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="newline" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Bullet Item" alignment="left" bullet="dot" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 4" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Normal" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 3" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="0" spacebelow="0" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="Heading 2" alignment="left" bullet="none" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="8" spacebelow="2" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Layout name="List Item" alignment="left" bullet="indent" firstindent="0" leftmargin="0" rightmargin="0" linespacing="0.0" spaceabove="3" spacebelow="3" linebreak="space" pagebreak-before="false" initial="0" bulletsuffix=""/>
<Pencil-style name="Pencil 5" pen-color="[255,0,0]" pen-height="5.0" pen-width="5.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 4" pen-color="[0,0,255]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 3" pen-color="[0,0,0]" pen-height="3.0" pen-width="3.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 2" pen-color="[0,0,255]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Pencil-style name="Pencil 1" pen-color="[0,0,0]" pen-height="1.0" pen-width="1.0" pen-opacity="1.0"/>
<Highlighter-style name="Highlighter 2" pen-color="[255,204,0]" pen-height="14.0" pen-width="14.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 1" pen-color="[255,153,255]" pen-height="12.0" pen-width="8.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 4" pen-color="[0,255,255]" pen-height="32.0" pen-width="32.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 3" pen-color="[51,255,0]" pen-height="24.0" pen-width="24.0" pen-opacity="0.8"/>
<Highlighter-style name="Highlighter 5" pen-color="[255,255,0]" pen-height="48.0" pen-width="48.0" pen-opacity="0.8"/>
</Styles>
<Task-table>
    <Task-category name="&lt;default&gt;">
    </Task-category>
</Task-table>
<Task>
</Task>
<Group labelreference="L46" drawlabel="true">
<Input>
<Text-field style="Text" layout="Normal">TicTacToe</Text-field>
<Text-field style="Text" layout="Normal">Adam Forness &amp; Frederick Doe</Text-field>
<Text-field style="Text" layout="Normal">Math-253 Honors Spring 2009</Text-field>
</Input>
</Group>
<Group labelreference="L7" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">restart:</Text-field>
</Input>
</Group>
<Group labelreference="L8" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">with(Maplets[Tools]): with(Maplets[Elements]): with(plots):
StartEngine();</Text-field>
</Input>
</Group>
<Group labelreference="L48" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">randomize():
rand9:=rand(0..9):</Text-field>
</Input>
</Group>
<Group labelreference="L17" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">redo:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn, Xwin, Owin, IsAVictory;
A1:=0;
A2:=0;
A3:=0;
B1:=0;
B2:=0;
B3:=0;
C1:=0;
C2:=0;
C3:=0;
Turn:=1;
Xwin:=false;
Owin:=true;
IsAVictory:=false;
Set(replymain=&quot;The game has been reset&quot;);
Set(UpperLeftButton(caption)=&quot;   &quot;,UpperLeftButton(background)=blue):
Set(UpperButton(caption)=&quot;   &quot;,UpperButton(background)=blue):
Set(UpperRightButton(caption)=&quot;   &quot;,UpperRightButton(background)=blue):
Set(LeftButton(caption)=&quot;   &quot;,LeftButton(background)=blue):
Set(CenterButton(caption)=&quot;   &quot;,CenterButton(background)=blue):
Set(RightButton(caption)=&quot;   &quot;,RightButton(background)=blue):
Set(LowerLeftButton(caption)=&quot;   &quot;,LowerLeftButton(background)=blue):
Set(LowerButton(caption)=&quot;   &quot;,LowerButton(background)=blue):
Set(LowerRightButton(caption)=&quot;   &quot;,LowerRightButton(background)=blue):
end proc:</Text-field>
</Input>
<Input>
<Text-field prompt="&gt; " style="Maple Input" alignment="left" firstindent="0" spacebelow="0" leftmargin="0" linespacing="0.0" initial="0" linebreak="space" rightmargin="0" bulletsuffix="" spaceabove="0" bullet="none" pagebreak-before="false"></Text-field>
</Input>
</Group>
<Group labelreference="L25" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[128,0,0]" layout="Normal"><Font foreground="[128,0,0]">placeupperleft:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn, </Font><Font foreground="[255,0,0]">IsAVictory</Font><Font foreground="[128,0,0]">;
local temporary;
if </Font><Font foreground="[255,0,0]">IsAVictory then return end if;</Font><Font foreground="[128,0,0]">
if A1=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif A1=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif A1=0 then
 if Turn=1 then
  Set(UpperLeftButton(caption)=&quot;X&quot;,UpperLeftButton(background)=red,UpperLeftButton(foreground)=white);
  A1:=1;
  if Get(Two) then
   Turn:=2;
   Set(replymain=&quot;It is now player two's turn&quot;);
  end if;
 elif Turn=2 then
  Set(UpperLeftButton(caption)=&quot;O&quot;,UpperLeftButton(background)=yellow,UpperLeftButton(foreground)=black);
  A1:=2;
  Turn:=1;
  Set(replymain=&quot;It is now player one's turn&quot;);
 end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L24" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[255,0,255]" layout="Normal"><Font foreground="[255,0,255]">placeupper:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[255,0,255]">
if A2=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif A2=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif A2=0 then
 if Turn=1 then
  Set(UpperButton(caption)=&quot;X&quot;,UpperButton(background)=red,UpperButton(foreground)=white);
  A2:=1;
 </Font><Font foreground="[255,0,0]"> </Font><Font foreground="[255,0,255]">if Get(Two) then
   Turn:=2;
   Set(replymain=&quot;It is now player two's turn&quot;);
  end if;
 elif Turn=2 then
  Set(UpperButton(caption)=&quot;O&quot;,UpperButton(background)=yellow,UpperButton(foreground)=black);
  A2:=2;
  Turn:=1;
  Set(replymain=&quot;It is now player one's turn&quot;);
 end if;
 temporary:=checkO();
 temporary:=checkX();
 ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L23" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[128,0,0]" layout="Normal"><Font foreground="[128,0,0]">placeupperright:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[128,0,0]">
if A3=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif A3=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif A3=0 then
if Turn=1 then
 Set(UpperRightButton(caption)=&quot;X&quot;,UpperRightButton(background)=red,UpperRightButton(foreground)=white);
 A3:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;It is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(UpperRightButton(caption)=&quot;O&quot;,UpperRightButton(background)=yellow,UpperRightButton(foreground)=black);
 A3:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L11" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[255,0,255]" layout="Normal"><Font foreground="[255,0,255]">placeleft:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[255,0,255]">
if B1=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif B1=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif B1=0 then
if Turn=1 then
 Set(LeftButton(caption)=&quot;X&quot;,LeftButton(background)=red,LeftButton(foreground)=white);
 B1:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;It is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(LeftButton(caption)=&quot;O&quot;,LeftButton(background)=yellow,LeftButton(foreground)=black);
 B1:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L19" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[128,0,0]" layout="Normal"><Font foreground="[128,0,0]">placeright:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[128,0,0]">
if B3=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif B3=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif B3=0 then
if Turn=1 then
 Set(RightButton(caption)=&quot;X&quot;,RightButton(background)=red,RightButton(foreground)=white);
 B3:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;It is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(RightButton(caption)=&quot;O&quot;,RightButton(background)=yellow,RightButton(foreground)=black);
 B3:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L20" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[255,0,255]" layout="Normal"><Font foreground="[255,0,255]">placecenter:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[255,0,255]">
if B2=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif B2=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif B2=0 then
if Turn=1 then
 Set(CenterButton(caption)=&quot;X&quot;,CenterButton(background)=red,CenterButton(foreground)=white);
 B2:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;It is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(CenterButton(caption)=&quot;O&quot;,CenterButton(background)=yellow,CenterButton(foreground)=black);
 B2:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L21" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[128,0,0]" layout="Normal"><Font foreground="[128,0,0]">placelowerleft:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[128,0,0]">
if C1=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif C1=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif C1=0 then
if Turn=1 then
 Set(LowerLeftButton(caption)=&quot;X&quot;,LowerLeftButton(background)=red,LowerLeftButton(foreground)=white);
 C1:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;It is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(LowerLeftButton(caption)=&quot;O&quot;,LowerLeftButton(background)=yellow,LowerLeftButton(foreground)=black);
 C1:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L26" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[255,0,255]" layout="Normal"><Font foreground="[255,0,255]">placelower:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[255,0,255]">
if C2=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif C2=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif C2=0 then
if Turn=1 then
 Set(LowerButton(caption)=&quot;X&quot;,LowerButton(background)=red,LowerButton(foreground)=white);
 C2:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;If is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(LowerButton(caption)=&quot;O&quot;,LowerButton(background)=yellow,LowerButton(foreground)=black);
 C2:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L27" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" foreground="[128,0,0]" layout="Normal"><Font foreground="[128,0,0]">placelowerright:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn</Font><Font foreground="[255,0,0]">, IsAVictory;
local temporary;
if IsAVictory then return end if;</Font><Font foreground="[128,0,0]">
if C3=1 then
 Set(replymain=&quot;Sorry, that square has already been taken&quot;);
elif C3=2 then
 Set(replymain=&quot;Sorry, that square as already been taken&quot;);
elif C3=0 then
if Turn=1 then
 Set(LowerRightButton(caption)=&quot;X&quot;,LowerRightButton(background)=red,LowerRightButton(foreground)=white);
 C3:=1;
 if Get(Two) then
  Turn:=2;
  Set(replymain=&quot;If is now player two's turn&quot;);
 end if;
elif Turn=2 then
 Set(LowerRightButton(caption)=&quot;O&quot;,LowerRightButton(background)=yellow,LowerRightButton(foreground)=black);
 C3:=2;
 Turn:=1;
 Set(replymain=&quot;It is now player one's turn&quot;);
end if;
temporary:=checkO();
temporary:=checkX();
ComputerGo();
end if;
temporary:=checkO();
temporary:=checkX();
end proc:</Font></Text-field>
</Input>
</Group>
<Group labelreference="L18" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">playertwogo:=proc()
global Turn;
Turn:=2;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L12" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"></Text-field>
</Input>
</Group>
<Group labelreference="L13" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">test:=proc()
Set(replymain=&quot;The test worked&quot;);
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L14" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">checkX:=proc()
global IsAVictory;
local IsACatsGame;
IsACatsGame:=0;
if A1=0 or A2=0 or A3=0 or B1=0 or B2=0 or B3=0 or C1=0 or C2=0 or C3=0 then
 IsACatsGame:=0;
else
 IsACatsGame:=1;
end if;
if A1=1 and A2=1 and A3=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if B1=1 and B2=1 and B3=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if C1=1 and C2=1 and C3=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if A1=1 and B1=1 and C=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if A2=1 and B2=1 and C2=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if A3=1 and B3=1 and C3=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if A1=1 and B2=1 and C3=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if A3=1 and B2=1 and C1=1 then
Set(replymain=&quot;X team wins!&quot;);
IsAVictory:=true;
end if;
if not IsAVictory and IsACatsGame=1 then
Set(replymain=&quot;It's a cats game!&quot;);
end if;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L15" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">checkO:=proc()
global IsAVictory;
IsAVictory:=false;
if A1=2 and A2=2 and A3=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if B1=2 and B2=2 and B3=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if C1=2 and C2=2 and C3=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if A1=2 and B1=2 and C1=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if A2=2 and B2=2 and C2=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if A3=2 and B3=2 and C3=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if A1=2 and B2=2 and C3=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
if A3=2 and B2=2 and C1=2 then
Set(replymain=&quot;O team wins!&quot;);
IsAVictory:=true;
end if;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L39" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">A1:=0:
A2:=0:
A3:=0:
B1:=0:
B2:=0:
B3:=0:
C1:=0:
C2:=0:
C3:=0:
Turn:=1:
IsAVictory:=false:</Text-field>
</Input>
</Group>
<Group labelreference="L40" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">ComputerGo:=proc()
global A1, A2, A3, B1, B2, B3, C1, C2, C3, Turn;
local looping, TempNumber;
if not IsAVictory then
if Get(One) then
looping:=1;
if A1=0 or A2=0 or A3=0 or B1=0 or B2=0 or B3=0 or C1=0 or C2=0 or C3=0 then
while (looping=1) do
 TempNumber:=rand9();
 if TempNumber=1 then
  if A1=0 then
  Set(UpperLeftButton(caption)=&quot;O&quot;,UpperLeftButton(background)=yellow,UpperLeftButton(foreground)=black);
  A1:=2;
  looping:=0;
  end if; 
 elif TempNumber=2 then
  if A2=0 then
  Set(UpperButton(caption)=&quot;O&quot;,UpperButton(background)=yellow,UpperButton(foreground)=black);
  A2:=2;
  looping:=0;
  end if; 
 elif TempNumber=3 then
  if A3=0 then
  Set(UpperRightButton(caption)=&quot;O&quot;,UpperRightButton(background)=yellow,UpperRightButton(foreground)=black);
  A3:=2;
  looping:=0;
  end if;
 elif TempNumber=4 then
  if B1=0 then
  Set(LeftButton(caption)=&quot;O&quot;,LeftButton(background)=yellow,LeftButton(foreground)=black);
  B1:=2;
  looping:=0;
  end if;  
 elif TempNumber=5 then
  if B2=0 then
  Set(CenterButton(caption)=&quot;O&quot;,CenterButton(background)=yellow,CenterButton(foreground)=black);
  B2:=2;
  looping:=0;
  end if; 
 elif TempNumber=6 then
  if B3=0 then
  Set(RightButton(caption)=&quot;O&quot;,RightButton(background)=yellow,RightButton(foreground)=black);
  B3:=2;
  looping:=0;
  end if; 
 elif TempNumber=7 then
  if C1=0 then
  Set(LowerLeftButton(caption)=&quot;O&quot;,LowerLeftButton(background)=yellow,LowerLeftButton(foreground)=black);
  C1:=2;
  looping:=0;
  end if;
 elif TempNumber=8 then
  if C2=0 then
  Set(LowerButton(caption)=&quot;O&quot;,LowerButton(background)=yellow,LowerButton(foreground)=black);
  C2:=2;
  looping:=0;
  end if;
 elif TempNumber=9 then
  if C3=0 then
  Set(LowerRightButton(caption)=&quot;O&quot;,LowerRightButton(background)=yellow,LowerRightButton(foreground)=black);
  C3:=2;
  looping:=0;
  end if;  
 end if;
end;
end if;
end if;
end if;
end proc:</Text-field>
</Input>
</Group>
<Group labelreference="L50" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">TicTacToe:= Maplet(onstartup = RunWindow(MAIN),
Font[helv10](&quot;helvetica&quot;,10),
  Window[MAIN](title=&quot;Tic Tac Toe&quot;,
    [ 
      [
       RadioButton[One](&quot;One player&quot;,group=OorT,true),
       RadioButton[Two](&quot;Two players&quot;,group=OorT)
      ],
      [
        Button(&quot;Reset game&quot;,Evaluate(function = &quot;redo&quot;))
      ],

      [ &quot;Please select where you would like to go:&quot;
      ],
      [
        Button[UpperLeftButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placeupperleft&quot;)) ,
        Button[UpperButton](&quot;   &quot;,background=blue,Evaluate(function = &quot;placeupper&quot;)),
        Button[UpperRightButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placeupperright&quot;))
      ],
      [
        Button[LeftButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placeleft&quot;)), 
        Button[CenterButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placecenter&quot;)),
        Button[RightButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placeright&quot;))
      ],
      [
        Button[LowerLeftButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placelowerleft&quot;)) ,
        Button[LowerButton](&quot;   &quot;,background=blue,Evaluate(function = &quot;placelower&quot;)),
        Button[LowerRightButton](&quot;   &quot;,background=blue, Evaluate(function = &quot;placelowerright&quot;))
      ],
      [
        HorizontalGlue(),
        TextField[replymain](width=40, editable=false),
        HorizontalGlue()
      ],
      [ Button(&quot;Good Bye&quot;, Shutdown())
      ],
  [ background=&quot;#DDFFFF&quot;, inset=0, spacing=0, 
    Label(&quot;Programmers: Adam Forness &amp; Frederick Doe    &quot;, font=helv10),
    HorizontalGlue(),
    Label(&quot;Copyright P. Yasskin 2009&quot;, font=helv10)
  ]
    ]
  ),
  ButtonGroup[OorT](onchange=Evaluate(function = &quot;redo&quot;))
):</Text-field>
</Input>
</Group>
<Group labelreference="L6" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal">Maplets[Display](TicTacToe);</Text-field>
</Input>
</Group>
<Group labelreference="L47" drawlabel="true">
<Input>
<Text-field prompt="&gt; " style="Maple Input" layout="Normal"></Text-field>
</Input>
</Group>
</Worksheet>
