Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Tic+Tac+Toe?V=5
QUERY_STRINGV=5
CONTENT_TYPE
DOCUMENT_URI/revision/Tic+Tac+Toe
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.71.254.36
REMOTE_PORT20826
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.216.32.116
HTTP_CF_RAY87d6c8872fa82330-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP18.216.32.116
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Tic Tac Toe} \[Keith\ Vetter\]\ 2004-09-10\ :\ Here's\ another\ version\ of\ the\ children's\ngame\ Tic-Tac-Toe.\ My\ 5-year\ old\ daughter\ has\ just\ discovered\ this\ game\ \nand\ so\ I\ threw\ this\ together\ this\ morning.\ There's\ another\ tic-tac-toe\ \npage--\[A\ little\ Tic\ Tac\ Toe\ game\]--but\ I\ wanted\ a\ sexier\ interface.\n\n\[MG\]\ -\ A\ nice\ little\ game\ :)\n\n\[KPV\]\ -\ Added\ two\ levels\ of\ computer\ opponent:\ random\ and\ smart--which\nwill\ win\ if\ possible,\ block\ if\ necessary\ or\ else\ do\ a\ random\ move.\ Playing\nperfect\ tic-tac-toe\ is\ non-trivial\ problem,\ and\ so\ is\ left\ as\ an\ exersize\nfor\ the\ reader\ (plus\ my\ 5\ year\ old\ likes\ to\ win\ when\ playing).\n\n----\n\ ##+##########################################################################\n\ #\n\ #\ tictactoe.tcl\ -\ plays\ tic\ tac\ toe\n\ #\ by\ Keith\ Vetter\ \ Sept\ 10,\ 2004\n\ #\n\ #\ Sept\ 11\ :\ added\ 2\ levels\ of\ computer\ opponent:\ random\ and\ smart--which\n\ #\ \ \ \ \ \ \ \ \ \ \ \ will\ win\ if\ possible,\ block\ if\ necessary\ or\ do\ a\ random\ move\n\ \n\ package\ require\ Tk\n\ \n\ array\ set\ S\ \{title\ \"Tic\ Tac\ Toe\"\ who,1\ \"X\"\ who,0\ \"\"\ who,-1\ \"O\"\ robot\ \"0\"\}\n\ array\ set\ C\ \{bars\ red\ X\ blue\ O\ green\ win\ yellow\}\n\ namespace\ eval\ ::Robot\ \{\n\ \ \ \ variable\ skill\ Smart\n\ \}\n\ \n\ proc\ DoDisplay\ \{\}\ \{\n\ \ \ \ wm\ title\ .\ \$::S(title)\n\ \ \ \ frame\ .ctrl\ -relief\ ridge\ -bd\ 2\ -padx\ 5\ -pady\ 5\n\ \ \ \ canvas\ .c\ -relief\ raised\ -bd\ 2\ -height\ 500\ -width\ 500\ -highlightthickness\ 0\n\ \ \ \ pack\ .c\ -side\ top\ -fill\ both\ -expand\ 1\n\ \ \ \ pack\ .ctrl\ -side\ top\ -fill\ both\n\ \n\ \ \ \ bind\ all\ <Key-F2>\ \{console\ show\}\n\ \ \ \ bind\ .c\ <Configure>\ \{ReCenter\ %W\ %h\ %w\}\n\ \ \ \ DoCtrlFrame\n\ \}\n\ proc\ DrawBoard\ \{\{redraw\ 0\}\}\ \{\n\ \ \ \ global\ S\ B\ GAME\ C\n\ \n\ \ \ \ if\ \{\$redraw\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Must\ redraw\ everything\n\ \ \ \ \ \ \ \ .c\ delete\ all\n\ \ \ \ \ \ \ \ set\ w2\ \[expr\ \{\$B(w2)\ -\ 15\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Make\ a\ little\ margins\n\ \ \ \ \ \ \ \ set\ h2\ \[expr\ \{\$B(h2)\ -\ 15\}\]\n\ \ \ \ \ \ \ \ set\ hbar\ \[expr\ \{\$h2\ /\ 3.0\}\]\n\ \ \ \ \ \ \ \ set\ vbar\ \[expr\ \{\$w2\ /\ 3.0\}\]\n\ \n\ \ \ \ \ \ \ \ set\ B(0)\ \[list\ -\$w2\ \ \ -\$h2\ \ \ -\$vbar\ -\$hbar\]\ \;#\ All\ 9\ cells\n\ \ \ \ \ \ \ \ set\ B(1)\ \[list\ -\$vbar\ -\$h2\ \ \ \ \$vbar\ -\$hbar\]\n\ \ \ \ \ \ \ \ set\ B(2)\ \[list\ \ \$vbar\ -\$h2\ \ \ \ \$w2\ \ \ -\$hbar\]\n\ \ \ \ \ \ \ \ set\ B(3)\ \[list\ -\$w2\ \ \ -\$hbar\ -\$vbar\ \ \$hbar\]\n\ \ \ \ \ \ \ \ set\ B(4)\ \[list\ -\$vbar\ -\$hbar\ \ \$vbar\ \ \$hbar\]\n\ \ \ \ \ \ \ \ set\ B(5)\ \[list\ \ \$vbar\ -\$hbar\ \ \$w2\ \ \ \ \$hbar\]\n\ \ \ \ \ \ \ \ set\ B(6)\ \[list\ -\$w2\ \ \ \ \$hbar\ -\$vbar\ \ \$h2\]\n\ \ \ \ \ \ \ \ set\ B(7)\ \[list\ -\$vbar\ \ \$hbar\ \ \$vbar\ \ \$h2\]\n\ \ \ \ \ \ \ \ set\ B(8)\ \[list\ \ \$vbar\ \ \$hbar\ \ \$w2\ \ \ \ \$h2\]\n\ \n\ \ \ \ \ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\ \ \ \ \ \ \ \;#\ Rectangle\ for\ each\ cell\n\ \ \ \ \ \ \ \ \ \ \ \ .c\ create\ rect\ \$B(\$i)\ -tag\ b\$i\ -fill\ \{\}\ -outline\ \{\}\n\ \ \ \ \ \ \ \ \ \ \ \ .c\ bind\ b\$i\ <Button-1>\ \[list\ DoClick\ \$i\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ B(\$i)\ \[ShrinkBox\ \$B(\$i)\ 25\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ .c\ create\ line\ -\$w2\ \$hbar\ \$w2\ \$hbar\ -tag\ bar\ \;#\ Draw\ the\ cross\ bars\n\ \ \ \ \ \ \ \ .c\ create\ line\ -\$w2\ -\$hbar\ \$w2\ -\$hbar\ -tag\ bar\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$vbar\ -\$h2\ \$vbar\ \$h2\ -tag\ bar\n\ \ \ \ \ \ \ \ .c\ create\ line\ -\$vbar\ -\$h2\ -\$vbar\ \$h2\ -tag\ bar\n\ \ \ \ \ \ \ \ .c\ itemconfig\ bar\ -width\ 20\ -fill\ \$::C(bars)\ -capstyle\ round\n\ \ \ \ \}\n\ \ \ \ .new\ config\ -state\ \[expr\ \{\$GAME(tcnt)\ ==\ 0\ ?\ \"disabled\"\ :\ \"normal\"\}\]\n\ \n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ .c\ itemconfig\ b\$i\ -fill\ \{\}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Erase\ any\ win\ lines\n\ \ \ \ \ \ \ \ DrawXO\ \$GAME(board,\$i)\ \$i\n\ \ \ \ \}\n\ \ \ \ foreach\ i\ \$GAME(win)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Do\ we\ have\ a\ winner???\n\ \ \ \ \ \ \ \ .c\ itemconfig\ b\$i\ -fill\ \$C(win)\n\ \ \ \ \}\n\ \}\n\ proc\ DoCtrlFrame\ \{\}\ \{\n\ \ \ \ button\ .new\ -text\ \"New\ Game\"\ -command\ NewGame\ -bd\ 4\n\ \ \ \ .new\ configure\ -font\ \"\[font\ actual\ \[.new\ cget\ -font\]\]\ -weight\ bold\"\n\ \ \ \ option\ add\ *Button.font\ \[.new\ cget\ -font\]\n\ \ \ \ label\ .status\ -textvariable\ S(msg)\ -font\ \{Times\ 36\ bold\}\ -bg\ white\ \\\n\ \ \ \ \ \ \ \ -bd\ 5\ -relief\ ridge\n\ \ \ \ button\ .about\ -text\ About\ -command\ \\\n\ \ \ \ \ \ \ \ \[list\ tk_messageBox\ -message\ \"\$::S(title)\\nby\ Keith\ Vetter,\ Sept\ 2004\"\]\n\ \n\ \ \ \ frame\ .r\ -bd\ 2\ -relief\ ridge\n\ \ \ \ pack\ .r\ -side\ bottom\ \n\ \ \ \ label\ .r.lc\ -text\ \"Computer\"\ -font\ \[.new\ cget\ -font\]\n\ \ \ \ label\ .r.lrobot\ -text\ \"Plays:\ \"\n\ \ \ \ spinbox\ .r.robot\ -values\ \{O\ None\ X\}\ -textvariable\ S(robot)\ -wrap\ 1\ \\\n\ \ \ \ \ \ \ \ -width\ 6\ -justify\ center\ -command\ ::Robot::IsTurn\n\ \ \ \ label\ .r.llevel\ -text\ \"Level:\ \"\n\ \ \ \ spinbox\ .r.level\ -values\ \{Smart\ Random\}\ -textvariable\ ::Robot::skill\ \\\n\ \ \ \ \ \ \ \ -wrap\ 1\ -width\ 8\ -justify\ center\n\ \ \ \ grid\ .r.lc\ -\ -row\ 0\n\ \ \ \ grid\ .r.lrobot\ .r.robot\ -sticky\ we\n\ \ \ \ grid\ .r.llevel\ .r.level\ -sticky\ we\n\ \n\ \n\ \ \ \ pack\ .status\ -in\ .ctrl\ -side\ right\ -fill\ both\ -expand\ 1\n\ \ \ \ pack\ .r\ -in\ .ctrl\ -side\ right\ -fill\ both\ -padx\ 5\n\ \ \ \ pack\ .new\ .about\ -in\ .ctrl\ -side\ top\ -fill\ x\ -pady\ 2\ \n\ \}\n\ proc\ ShrinkBox\ \{xy\ d\}\ \{\n\ \ \ \ foreach\ \{x\ y\ x1\ y1\}\ \$xy\ break\n\ \ \ \ return\ \[list\ \[expr\ \{\$x+\$d\}\]\ \[expr\ \{\$y+\$d\}\]\ \[expr\ \{\$x1-\$d\}\]\ \[expr\ \{\$y1-\$d\}\]\]\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ Recenter\ --\ keeps\ 0,0\ at\ the\ center\ of\ the\ canvas\ during\ resizing\n\ #\ \n\ proc\ ReCenter\ \{W\ h\ w\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Called\ by\ configure\ event\n\ \ \ \ set\ ::B(h2)\ \[expr\ \{\$h\ /\ 2\}\]\n\ \ \ \ set\ ::B(w2)\ \[expr\ \{\$w\ /\ 2\}\]\n\ \ \ \ \$W\ config\ -scrollregion\ \[list\ -\$::B(w2)\ -\$::B(h2)\ \$::B(w2)\ \$::B(h2)\]\n\ \ \ \ DrawBoard\ 1\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ DrawXO\ --\ draws\ appropriate\ mark\ in\ a\ given\ cell\n\ #\ \n\ proc\ DrawXO\ \{who\ where\}\ \{\n\ \ \ \ global\ S\ B\ C\n\ \n\ \ \ \ if\ \{\$S(who,\$who)\ eq\ \"X\"\}\ \{\ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ foreach\ \{x0\ y0\ x1\ y1\}\ \$B(\$where)\ break\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$x0\ \$y0\ \$x1\ \$y1\ -width\ 20\ -fill\ \$C(X)\ -capstyle\ round\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -tag\ xo\$where\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$x0\ \$y1\ \$x1\ \$y0\ -width\ 20\ -fill\ \$C(X)\ -capstyle\ round\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -tag\ xo\$where\n\ \ \ \ \}\ elseif\ \{\$S(who,\$who)\ eq\ \"O\"\}\ \{\n\ \ \ \ \ \ \ \ .c\ create\ oval\ \$B(\$where)\ -width\ 20\ -outline\ \$C(O)\ -tag\ xo\$where\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ .c\ delete\ xo\$where\n\ \ \ \ \}\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ InitGame\ --\ resets\ all\ variables\ to\ start\ a\ new\ game\n\ #\ \n\ proc\ InitGame\ \{\}\ \{\n\ \ \ \ global\ GAME\ S\n\ \n\ \ \ \ set\ GAME(state)\ play\n\ \ \ \ set\ GAME(turn)\ 1\n\ \ \ \ set\ GAME(tcnt)\ 0\n\ \ \ \ set\ GAME(win)\ \{\}\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ set\ GAME(board,\$i)\ 0\n\ \ \ \ \}\n\ \ \ \ set\ S(msg)\ \"X\ starts\"\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ NewGame\ --\ starts\ a\ new\ game\n\ #\ \n\ proc\ NewGame\ \{\}\ \{\n\ \ \ \ InitGame\n\ \ \ \ DrawBoard\n\ \ \ \ if\ \{\$::S(who,\$::GAME(turn))\ ==\ \$::S(robot)\}\ \{\n\ \ \ \ \ \ \ \ after\ idle\ ::Robot::Go\n\ \ \ \ \}\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ DoClick\ --\ handles\ button\ click\ in\ a\ cell\n\ #\ \n\ proc\ DoClick\ \{where\}\ \{\n\ \ \ \ global\ GAME\ S\n\ \n\ \ \ \ if\ \{\$GAME(state)\ ne\ \"play\"\}\ return\ \ \ \ \ \ \ \ \ \ \;#\ Game\ over\n\ \ \ \ if\ \{\$GAME(board,\$where)\ !=\ 0\}\ return\ \ \ \ \ \ \ \ \;#\ Not\ empty\n\ \ \ \ set\ GAME(board,\$where)\ \$GAME(turn)\n\ \ \ \ set\ GAME(turn)\ \[expr\ \{-\ \$GAME(turn)\}\]\n\ \ \ \ incr\ GAME(tcnt)\n\ \ \ \ set\ S(msg)\ \"\$S(who,\$GAME(turn))'s\ turn\"\n\ \n\ \ \ \ set\ n\ \[WhoWon\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Do\ we\ have\ a\ winner???\n\ \ \ \ if\ \{\$n\ !=\ 0\}\ \{\n\ \ \ \ \ \ \ \ set\ GAME(state)\ finished\n\ \ \ \ \ \ \ \ set\ GAME(win)\ \[lrange\ \$n\ 1\ end\]\n\ \ \ \ \ \ \ \ set\ S(msg)\ \"\$S(who,\[lindex\ \$n\ 0\])\ Wins!\"\n\ \ \ \ \}\ elseif\ \{\$GAME(tcnt)\ ==\ 9\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Is\ the\ game\ a\ draw???\n\ \ \ \ \ \ \ \ set\ GAME(state)\ finished\n\ \ \ \ \ \ \ \ set\ S(msg)\ \"Draw\"\n\ \ \ \ \}\n\ \ \ \ DrawBoard\n\ \ \ \ if\ \{\$S(who,\$GAME(turn))\ ==\ \$S(robot)\}\ \{\n\ \ \ \ \ \ \ \ after\ idle\ ::Robot::Go\n\ \ \ \ \}\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ WhoWon\ --\ determines\ if\ anyone\ has\ won\ the\ game\n\ #\ \n\ proc\ WhoWon\ \{\}\ \{\n\ \ \ \ foreach\ \{a\ b\ c\}\ \{0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 0\ 3\ 6\ 1\ 4\ 7\ 2\ 5\ 8\ 0\ 4\ 8\ 2\ 4\ 6\}\ \{\n\ \ \ \ \ \ \ \ set\ who\ \$::GAME(board,\$a)\n\ \ \ \ \ \ \ \ if\ \{\$who\ ==\ 0\}\ continue\n\ \ \ \ \ \ \ \ if\ \{\$who\ !=\ \$::GAME(board,\$b)\ ||\ \$who\ !=\ \$::GAME(board,\$c)\}\ continue\n\ \ \ \ \ \ \ \ return\ \[list\ \$who\ \$a\ \$b\ \$c\]\n\ \ \ \ \}\n\ \ \ \ return\ 0\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ ::Robot::Go\ --\ gets\ and\ does\ robot's\ move\n\ #\ \n\ proc\ ::Robot::Go\ \{\}\ \{\n\ \ \ \ variable\ skill\n\ \ \ \ if\ \{\$::GAME(state)\ ne\ \"play\"\}\ return\ \ \ \ \ \ \ \ \;#\ Game\ over\n\ \ \ \ set\ move\ \[::Robot::\$skill\]\n\ \ \ \ if\ \{\$move\ ==\ \{\}\}\ return\n\ \ \ \ ::DoClick\ \$move\n\ \}\n\ proc\ ::Robot::Random\ \{\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Picks\ a\ random\ move\n\ \ \ \ set\ empty\ \{\}\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$::GAME(board,\$i)\ ==\ 0\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ empty\ \$i\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ return\ \[lindex\ \$empty\ \[expr\ \{int(rand()\ *\ \[llength\ \$empty\])\}\]\]\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ ::Robot::Smart\ --\ does\ winning\ move\ if\ possible,\ blocks\ if\ necessary\n\ #\ or\ does\ a\ random\ move\n\ #\ \n\ proc\ ::Robot::Smart\ \{\}\ \{\n\ \ \ \ global\ GAME\n\ \n\ \ \ \ set\ blockers\ \{\}\n\ \ \ \ foreach\ \{aa\ bb\ cc\}\ \{0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 0\ 3\ 6\ 1\ 4\ 7\ 2\ 5\ 8\ 0\ 4\ 8\ 2\ 4\ 6\}\ \{\n\ \ \ \ \ \ \ \ set\ a\ \$GAME(board,\$aa)\n\ \ \ \ \ \ \ \ set\ b\ \$GAME(board,\$bb)\n\ \ \ \ \ \ \ \ set\ c\ \$GAME(board,\$cc)\n\ \ \ \ \ \ \ \ if\ \{\$a\ *\ \$b\ *\ \$c\ !=\ 0\}\ continue\ \ \ \ \ \ \ \ \ \;#\ No\ empty\ slots\n\ \ \ \ \ \ \ \ if\ \{\$a\ +\ \$b\ +\ \$c\ ==\ 2*\$GAME(turn)\}\ \{\ \ \ \ \;#\ Winning\ move\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$a\ ==\ 0\}\ \{\ return\ \$aa\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$b\ ==\ 0\}\ \{\ return\ \$bb\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$c\ ==\ 0\}\ \{\ return\ \$cc\}\n\ \ \ \ \ \ \ \ \ \ \ \ error\ \"no\ empty\ spot\"\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Can't\ happen\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ if\ \{\$a\ +\ \$b\ +\ \$c\ ==\ -2*\$GAME(turn)\}\ \{\ \ \ \;#\ Blocking\ move\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$a\ ==\ 0\}\ \{\ lappend\ blockers\ \$aa\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$b\ ==\ 0\}\ \{\ lappend\ blockers\ \$bb\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$c\ ==\ 0\}\ \{\ lappend\ blockers\ \$cc\}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ if\ \{\$blockers\ !=\ \{\}\}\ \{\n\ \ \ \ \ \ \ \ return\ \[lindex\ \$blockers\ \[expr\ \{int(rand()\ *\ \[llength\ \$blockers\])\}\]\]\n\ \ \ \ \}\n\ \ \ \ return\ \[::Robot::Random\]\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ ::Robot::IsTurn\ --\ called\ when\ who\ robot\ is\ changes\ and\ we\ may\ need\ to\ move\n\ #\ \n\ proc\ ::Robot::IsTurn\ \{\}\ \{\n\ \ \ \ if\ \{\$::S(who,\$::GAME(turn))\ ==\ \$::S(robot)\}\ \{\n\ \ \ \ \ \ \ \ after\ idle\ ::Robot::Go\n\ \ \ \ \}\n\ \}\ \ \ \ \n\ \n\ InitGame\n\ DoDisplay\n\ NewGame\n\n----\n\n\n\n\n======\n----\n***Screenshots***\n\n\n----\n\n\n\n\[http://farm5.static.flickr.com/4040/4685540456_94b3ddc3d1_m.jpg\]\ \ \ \n<alt=\"TCL_WIKI_ticktacktoeboardgametestpix.png>\n\ \n\n\[gold\]\ added\ pix.\n\n\n----\n!!!!!!\n%|\ \[Category\ Games\]\ |\ \[Category\ Application\]\ |%\ \n\[Tcl/Tk\ Games\]\n!!!!!! regexp2} CALL {my render {Tic Tac Toe} \[Keith\ Vetter\]\ 2004-09-10\ :\ Here's\ another\ version\ of\ the\ children's\ngame\ Tic-Tac-Toe.\ My\ 5-year\ old\ daughter\ has\ just\ discovered\ this\ game\ \nand\ so\ I\ threw\ this\ together\ this\ morning.\ There's\ another\ tic-tac-toe\ \npage--\[A\ little\ Tic\ Tac\ Toe\ game\]--but\ I\ wanted\ a\ sexier\ interface.\n\n\[MG\]\ -\ A\ nice\ little\ game\ :)\n\n\[KPV\]\ -\ Added\ two\ levels\ of\ computer\ opponent:\ random\ and\ smart--which\nwill\ win\ if\ possible,\ block\ if\ necessary\ or\ else\ do\ a\ random\ move.\ Playing\nperfect\ tic-tac-toe\ is\ non-trivial\ problem,\ and\ so\ is\ left\ as\ an\ exersize\nfor\ the\ reader\ (plus\ my\ 5\ year\ old\ likes\ to\ win\ when\ playing).\n\n----\n\ ##+##########################################################################\n\ #\n\ #\ tictactoe.tcl\ -\ plays\ tic\ tac\ toe\n\ #\ by\ Keith\ Vetter\ \ Sept\ 10,\ 2004\n\ #\n\ #\ Sept\ 11\ :\ added\ 2\ levels\ of\ computer\ opponent:\ random\ and\ smart--which\n\ #\ \ \ \ \ \ \ \ \ \ \ \ will\ win\ if\ possible,\ block\ if\ necessary\ or\ do\ a\ random\ move\n\ \n\ package\ require\ Tk\n\ \n\ array\ set\ S\ \{title\ \"Tic\ Tac\ Toe\"\ who,1\ \"X\"\ who,0\ \"\"\ who,-1\ \"O\"\ robot\ \"0\"\}\n\ array\ set\ C\ \{bars\ red\ X\ blue\ O\ green\ win\ yellow\}\n\ namespace\ eval\ ::Robot\ \{\n\ \ \ \ variable\ skill\ Smart\n\ \}\n\ \n\ proc\ DoDisplay\ \{\}\ \{\n\ \ \ \ wm\ title\ .\ \$::S(title)\n\ \ \ \ frame\ .ctrl\ -relief\ ridge\ -bd\ 2\ -padx\ 5\ -pady\ 5\n\ \ \ \ canvas\ .c\ -relief\ raised\ -bd\ 2\ -height\ 500\ -width\ 500\ -highlightthickness\ 0\n\ \ \ \ pack\ .c\ -side\ top\ -fill\ both\ -expand\ 1\n\ \ \ \ pack\ .ctrl\ -side\ top\ -fill\ both\n\ \n\ \ \ \ bind\ all\ <Key-F2>\ \{console\ show\}\n\ \ \ \ bind\ .c\ <Configure>\ \{ReCenter\ %W\ %h\ %w\}\n\ \ \ \ DoCtrlFrame\n\ \}\n\ proc\ DrawBoard\ \{\{redraw\ 0\}\}\ \{\n\ \ \ \ global\ S\ B\ GAME\ C\n\ \n\ \ \ \ if\ \{\$redraw\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Must\ redraw\ everything\n\ \ \ \ \ \ \ \ .c\ delete\ all\n\ \ \ \ \ \ \ \ set\ w2\ \[expr\ \{\$B(w2)\ -\ 15\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Make\ a\ little\ margins\n\ \ \ \ \ \ \ \ set\ h2\ \[expr\ \{\$B(h2)\ -\ 15\}\]\n\ \ \ \ \ \ \ \ set\ hbar\ \[expr\ \{\$h2\ /\ 3.0\}\]\n\ \ \ \ \ \ \ \ set\ vbar\ \[expr\ \{\$w2\ /\ 3.0\}\]\n\ \n\ \ \ \ \ \ \ \ set\ B(0)\ \[list\ -\$w2\ \ \ -\$h2\ \ \ -\$vbar\ -\$hbar\]\ \;#\ All\ 9\ cells\n\ \ \ \ \ \ \ \ set\ B(1)\ \[list\ -\$vbar\ -\$h2\ \ \ \ \$vbar\ -\$hbar\]\n\ \ \ \ \ \ \ \ set\ B(2)\ \[list\ \ \$vbar\ -\$h2\ \ \ \ \$w2\ \ \ -\$hbar\]\n\ \ \ \ \ \ \ \ set\ B(3)\ \[list\ -\$w2\ \ \ -\$hbar\ -\$vbar\ \ \$hbar\]\n\ \ \ \ \ \ \ \ set\ B(4)\ \[list\ -\$vbar\ -\$hbar\ \ \$vbar\ \ \$hbar\]\n\ \ \ \ \ \ \ \ set\ B(5)\ \[list\ \ \$vbar\ -\$hbar\ \ \$w2\ \ \ \ \$hbar\]\n\ \ \ \ \ \ \ \ set\ B(6)\ \[list\ -\$w2\ \ \ \ \$hbar\ -\$vbar\ \ \$h2\]\n\ \ \ \ \ \ \ \ set\ B(7)\ \[list\ -\$vbar\ \ \$hbar\ \ \$vbar\ \ \$h2\]\n\ \ \ \ \ \ \ \ set\ B(8)\ \[list\ \ \$vbar\ \ \$hbar\ \ \$w2\ \ \ \ \$h2\]\n\ \n\ \ \ \ \ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\ \ \ \ \ \ \ \;#\ Rectangle\ for\ each\ cell\n\ \ \ \ \ \ \ \ \ \ \ \ .c\ create\ rect\ \$B(\$i)\ -tag\ b\$i\ -fill\ \{\}\ -outline\ \{\}\n\ \ \ \ \ \ \ \ \ \ \ \ .c\ bind\ b\$i\ <Button-1>\ \[list\ DoClick\ \$i\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ B(\$i)\ \[ShrinkBox\ \$B(\$i)\ 25\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ .c\ create\ line\ -\$w2\ \$hbar\ \$w2\ \$hbar\ -tag\ bar\ \;#\ Draw\ the\ cross\ bars\n\ \ \ \ \ \ \ \ .c\ create\ line\ -\$w2\ -\$hbar\ \$w2\ -\$hbar\ -tag\ bar\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$vbar\ -\$h2\ \$vbar\ \$h2\ -tag\ bar\n\ \ \ \ \ \ \ \ .c\ create\ line\ -\$vbar\ -\$h2\ -\$vbar\ \$h2\ -tag\ bar\n\ \ \ \ \ \ \ \ .c\ itemconfig\ bar\ -width\ 20\ -fill\ \$::C(bars)\ -capstyle\ round\n\ \ \ \ \}\n\ \ \ \ .new\ config\ -state\ \[expr\ \{\$GAME(tcnt)\ ==\ 0\ ?\ \"disabled\"\ :\ \"normal\"\}\]\n\ \n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ .c\ itemconfig\ b\$i\ -fill\ \{\}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Erase\ any\ win\ lines\n\ \ \ \ \ \ \ \ DrawXO\ \$GAME(board,\$i)\ \$i\n\ \ \ \ \}\n\ \ \ \ foreach\ i\ \$GAME(win)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Do\ we\ have\ a\ winner???\n\ \ \ \ \ \ \ \ .c\ itemconfig\ b\$i\ -fill\ \$C(win)\n\ \ \ \ \}\n\ \}\n\ proc\ DoCtrlFrame\ \{\}\ \{\n\ \ \ \ button\ .new\ -text\ \"New\ Game\"\ -command\ NewGame\ -bd\ 4\n\ \ \ \ .new\ configure\ -font\ \"\[font\ actual\ \[.new\ cget\ -font\]\]\ -weight\ bold\"\n\ \ \ \ option\ add\ *Button.font\ \[.new\ cget\ -font\]\n\ \ \ \ label\ .status\ -textvariable\ S(msg)\ -font\ \{Times\ 36\ bold\}\ -bg\ white\ \\\n\ \ \ \ \ \ \ \ -bd\ 5\ -relief\ ridge\n\ \ \ \ button\ .about\ -text\ About\ -command\ \\\n\ \ \ \ \ \ \ \ \[list\ tk_messageBox\ -message\ \"\$::S(title)\\nby\ Keith\ Vetter,\ Sept\ 2004\"\]\n\ \n\ \ \ \ frame\ .r\ -bd\ 2\ -relief\ ridge\n\ \ \ \ pack\ .r\ -side\ bottom\ \n\ \ \ \ label\ .r.lc\ -text\ \"Computer\"\ -font\ \[.new\ cget\ -font\]\n\ \ \ \ label\ .r.lrobot\ -text\ \"Plays:\ \"\n\ \ \ \ spinbox\ .r.robot\ -values\ \{O\ None\ X\}\ -textvariable\ S(robot)\ -wrap\ 1\ \\\n\ \ \ \ \ \ \ \ -width\ 6\ -justify\ center\ -command\ ::Robot::IsTurn\n\ \ \ \ label\ .r.llevel\ -text\ \"Level:\ \"\n\ \ \ \ spinbox\ .r.level\ -values\ \{Smart\ Random\}\ -textvariable\ ::Robot::skill\ \\\n\ \ \ \ \ \ \ \ -wrap\ 1\ -width\ 8\ -justify\ center\n\ \ \ \ grid\ .r.lc\ -\ -row\ 0\n\ \ \ \ grid\ .r.lrobot\ .r.robot\ -sticky\ we\n\ \ \ \ grid\ .r.llevel\ .r.level\ -sticky\ we\n\ \n\ \n\ \ \ \ pack\ .status\ -in\ .ctrl\ -side\ right\ -fill\ both\ -expand\ 1\n\ \ \ \ pack\ .r\ -in\ .ctrl\ -side\ right\ -fill\ both\ -padx\ 5\n\ \ \ \ pack\ .new\ .about\ -in\ .ctrl\ -side\ top\ -fill\ x\ -pady\ 2\ \n\ \}\n\ proc\ ShrinkBox\ \{xy\ d\}\ \{\n\ \ \ \ foreach\ \{x\ y\ x1\ y1\}\ \$xy\ break\n\ \ \ \ return\ \[list\ \[expr\ \{\$x+\$d\}\]\ \[expr\ \{\$y+\$d\}\]\ \[expr\ \{\$x1-\$d\}\]\ \[expr\ \{\$y1-\$d\}\]\]\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ Recenter\ --\ keeps\ 0,0\ at\ the\ center\ of\ the\ canvas\ during\ resizing\n\ #\ \n\ proc\ ReCenter\ \{W\ h\ w\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Called\ by\ configure\ event\n\ \ \ \ set\ ::B(h2)\ \[expr\ \{\$h\ /\ 2\}\]\n\ \ \ \ set\ ::B(w2)\ \[expr\ \{\$w\ /\ 2\}\]\n\ \ \ \ \$W\ config\ -scrollregion\ \[list\ -\$::B(w2)\ -\$::B(h2)\ \$::B(w2)\ \$::B(h2)\]\n\ \ \ \ DrawBoard\ 1\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ DrawXO\ --\ draws\ appropriate\ mark\ in\ a\ given\ cell\n\ #\ \n\ proc\ DrawXO\ \{who\ where\}\ \{\n\ \ \ \ global\ S\ B\ C\n\ \n\ \ \ \ if\ \{\$S(who,\$who)\ eq\ \"X\"\}\ \{\ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ foreach\ \{x0\ y0\ x1\ y1\}\ \$B(\$where)\ break\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$x0\ \$y0\ \$x1\ \$y1\ -width\ 20\ -fill\ \$C(X)\ -capstyle\ round\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -tag\ xo\$where\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$x0\ \$y1\ \$x1\ \$y0\ -width\ 20\ -fill\ \$C(X)\ -capstyle\ round\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -tag\ xo\$where\n\ \ \ \ \}\ elseif\ \{\$S(who,\$who)\ eq\ \"O\"\}\ \{\n\ \ \ \ \ \ \ \ .c\ create\ oval\ \$B(\$where)\ -width\ 20\ -outline\ \$C(O)\ -tag\ xo\$where\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ .c\ delete\ xo\$where\n\ \ \ \ \}\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ InitGame\ --\ resets\ all\ variables\ to\ start\ a\ new\ game\n\ #\ \n\ proc\ InitGame\ \{\}\ \{\n\ \ \ \ global\ GAME\ S\n\ \n\ \ \ \ set\ GAME(state)\ play\n\ \ \ \ set\ GAME(turn)\ 1\n\ \ \ \ set\ GAME(tcnt)\ 0\n\ \ \ \ set\ GAME(win)\ \{\}\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ set\ GAME(board,\$i)\ 0\n\ \ \ \ \}\n\ \ \ \ set\ S(msg)\ \"X\ starts\"\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ NewGame\ --\ starts\ a\ new\ game\n\ #\ \n\ proc\ NewGame\ \{\}\ \{\n\ \ \ \ InitGame\n\ \ \ \ DrawBoard\n\ \ \ \ if\ \{\$::S(who,\$::GAME(turn))\ ==\ \$::S(robot)\}\ \{\n\ \ \ \ \ \ \ \ after\ idle\ ::Robot::Go\n\ \ \ \ \}\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ DoClick\ --\ handles\ button\ click\ in\ a\ cell\n\ #\ \n\ proc\ DoClick\ \{where\}\ \{\n\ \ \ \ global\ GAME\ S\n\ \n\ \ \ \ if\ \{\$GAME(state)\ ne\ \"play\"\}\ return\ \ \ \ \ \ \ \ \ \ \;#\ Game\ over\n\ \ \ \ if\ \{\$GAME(board,\$where)\ !=\ 0\}\ return\ \ \ \ \ \ \ \ \;#\ Not\ empty\n\ \ \ \ set\ GAME(board,\$where)\ \$GAME(turn)\n\ \ \ \ set\ GAME(turn)\ \[expr\ \{-\ \$GAME(turn)\}\]\n\ \ \ \ incr\ GAME(tcnt)\n\ \ \ \ set\ S(msg)\ \"\$S(who,\$GAME(turn))'s\ turn\"\n\ \n\ \ \ \ set\ n\ \[WhoWon\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Do\ we\ have\ a\ winner???\n\ \ \ \ if\ \{\$n\ !=\ 0\}\ \{\n\ \ \ \ \ \ \ \ set\ GAME(state)\ finished\n\ \ \ \ \ \ \ \ set\ GAME(win)\ \[lrange\ \$n\ 1\ end\]\n\ \ \ \ \ \ \ \ set\ S(msg)\ \"\$S(who,\[lindex\ \$n\ 0\])\ Wins!\"\n\ \ \ \ \}\ elseif\ \{\$GAME(tcnt)\ ==\ 9\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Is\ the\ game\ a\ draw???\n\ \ \ \ \ \ \ \ set\ GAME(state)\ finished\n\ \ \ \ \ \ \ \ set\ S(msg)\ \"Draw\"\n\ \ \ \ \}\n\ \ \ \ DrawBoard\n\ \ \ \ if\ \{\$S(who,\$GAME(turn))\ ==\ \$S(robot)\}\ \{\n\ \ \ \ \ \ \ \ after\ idle\ ::Robot::Go\n\ \ \ \ \}\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ WhoWon\ --\ determines\ if\ anyone\ has\ won\ the\ game\n\ #\ \n\ proc\ WhoWon\ \{\}\ \{\n\ \ \ \ foreach\ \{a\ b\ c\}\ \{0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 0\ 3\ 6\ 1\ 4\ 7\ 2\ 5\ 8\ 0\ 4\ 8\ 2\ 4\ 6\}\ \{\n\ \ \ \ \ \ \ \ set\ who\ \$::GAME(board,\$a)\n\ \ \ \ \ \ \ \ if\ \{\$who\ ==\ 0\}\ continue\n\ \ \ \ \ \ \ \ if\ \{\$who\ !=\ \$::GAME(board,\$b)\ ||\ \$who\ !=\ \$::GAME(board,\$c)\}\ continue\n\ \ \ \ \ \ \ \ return\ \[list\ \$who\ \$a\ \$b\ \$c\]\n\ \ \ \ \}\n\ \ \ \ return\ 0\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ ::Robot::Go\ --\ gets\ and\ does\ robot's\ move\n\ #\ \n\ proc\ ::Robot::Go\ \{\}\ \{\n\ \ \ \ variable\ skill\n\ \ \ \ if\ \{\$::GAME(state)\ ne\ \"play\"\}\ return\ \ \ \ \ \ \ \ \;#\ Game\ over\n\ \ \ \ set\ move\ \[::Robot::\$skill\]\n\ \ \ \ if\ \{\$move\ ==\ \{\}\}\ return\n\ \ \ \ ::DoClick\ \$move\n\ \}\n\ proc\ ::Robot::Random\ \{\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Picks\ a\ random\ move\n\ \ \ \ set\ empty\ \{\}\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 9\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$::GAME(board,\$i)\ ==\ 0\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ empty\ \$i\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ return\ \[lindex\ \$empty\ \[expr\ \{int(rand()\ *\ \[llength\ \$empty\])\}\]\]\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ ::Robot::Smart\ --\ does\ winning\ move\ if\ possible,\ blocks\ if\ necessary\n\ #\ or\ does\ a\ random\ move\n\ #\ \n\ proc\ ::Robot::Smart\ \{\}\ \{\n\ \ \ \ global\ GAME\n\ \n\ \ \ \ set\ blockers\ \{\}\n\ \ \ \ foreach\ \{aa\ bb\ cc\}\ \{0\ 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 0\ 3\ 6\ 1\ 4\ 7\ 2\ 5\ 8\ 0\ 4\ 8\ 2\ 4\ 6\}\ \{\n\ \ \ \ \ \ \ \ set\ a\ \$GAME(board,\$aa)\n\ \ \ \ \ \ \ \ set\ b\ \$GAME(board,\$bb)\n\ \ \ \ \ \ \ \ set\ c\ \$GAME(board,\$cc)\n\ \ \ \ \ \ \ \ if\ \{\$a\ *\ \$b\ *\ \$c\ !=\ 0\}\ continue\ \ \ \ \ \ \ \ \ \;#\ No\ empty\ slots\n\ \ \ \ \ \ \ \ if\ \{\$a\ +\ \$b\ +\ \$c\ ==\ 2*\$GAME(turn)\}\ \{\ \ \ \ \;#\ Winning\ move\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$a\ ==\ 0\}\ \{\ return\ \$aa\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$b\ ==\ 0\}\ \{\ return\ \$bb\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$c\ ==\ 0\}\ \{\ return\ \$cc\}\n\ \ \ \ \ \ \ \ \ \ \ \ error\ \"no\ empty\ spot\"\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Can't\ happen\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ if\ \{\$a\ +\ \$b\ +\ \$c\ ==\ -2*\$GAME(turn)\}\ \{\ \ \ \;#\ Blocking\ move\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$a\ ==\ 0\}\ \{\ lappend\ blockers\ \$aa\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$b\ ==\ 0\}\ \{\ lappend\ blockers\ \$bb\}\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$c\ ==\ 0\}\ \{\ lappend\ blockers\ \$cc\}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ if\ \{\$blockers\ !=\ \{\}\}\ \{\n\ \ \ \ \ \ \ \ return\ \[lindex\ \$blockers\ \[expr\ \{int(rand()\ *\ \[llength\ \$blockers\])\}\]\]\n\ \ \ \ \}\n\ \ \ \ return\ \[::Robot::Random\]\n\ \}\n\ ##+##########################################################################\n\ #\ \n\ #\ ::Robot::IsTurn\ --\ called\ when\ who\ robot\ is\ changes\ and\ we\ may\ need\ to\ move\n\ #\ \n\ proc\ ::Robot::IsTurn\ \{\}\ \{\n\ \ \ \ if\ \{\$::S(who,\$::GAME(turn))\ ==\ \$::S(robot)\}\ \{\n\ \ \ \ \ \ \ \ after\ idle\ ::Robot::Go\n\ \ \ \ \}\n\ \}\ \ \ \ \n\ \n\ InitGame\n\ DoDisplay\n\ NewGame\n\n----\n\n\n\n\n======\n----\n***Screenshots***\n\n\n----\n\n\n\n\[http://farm5.static.flickr.com/4040/4685540456_94b3ddc3d1_m.jpg\]\ \ \ \n<alt=\"TCL_WIKI_ticktacktoeboardgametestpix.png>\n\ \n\n\[gold\]\ added\ pix.\n\n\n----\n!!!!!!\n%|\ \[Category\ Games\]\ |\ \[Category\ Application\]\ |%\ \n\[Tcl/Tk\ Games\]\n!!!!!!} CALL {my revision {Tic Tac Toe}} CALL {::oo::Obj4128896 process revision/Tic+Tac+Toe} CALL {::oo::Obj4128894 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4