Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Juggler?V=9
QUERY_STRINGV=9
CONTENT_TYPE
DOCUMENT_URI/revision/Juggler
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.179.88
REMOTE_PORT54036
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.118.136.46
HTTP_CF_RAY8846ee172df762e2-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_REFERERhttps://wiki.tcl.tk/revision/Juggler?V=9
HTTP_CF_CONNECTING_IP18.118.136.46
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 Juggler \[Keith\ Vetter\]\ 2002-11-25\ -\ This\ is\ from\ an\ old\ graphics\ class\ I\ took\ back\ in\ 1994.\ It\ shows\ a\ person\ juggling\ from\ 3\ to\ 20\ balls\ in\ either\ the\ cascade\ or\ even\ ball\ juggling\ pattern.\n\nI\ added\ the\ juggling\ man\ just\ last\ night--with\ the\ design\ borrowed\ from\ \[Flag\ signalling\].\n\nThe\ goal\ of\ this\ program\ was\ not\ just\ to\ show\ a\ perfect\ juggler--although\ if\ you\ turn\ on\ the\ ''perfect''\ button\ it\ will\ do\ that.\ Rather,\ the\ goal\ was\ to\ add\ errors\ into\ each\ throw\ and\ see\ how\ the\ juggler\ responds.\ I've\ remove\ much\ of\ that\ code,\ but\ still\ each\ throw\ is\ unique,\ based\ on\ how\ fast\ the\ ball\ must\ be\ released\ before\ the\ next\ ball\ lands.\n\nOne\ undocumented\ feature\ is\ that\ you\ can\ use\ the\ up\ and\ down\ arrows\ to\ zoom\ in\ and\ out.\n\n\[http://mini.net/pub/juggler.png\]\n----\n\[KBK\]\ Lovely!\ \ Now\ if\ we\ can\ get\ \[Vince\ Darley\]\ to\ add\ site\ swap\ notation\n(http://www.juggling.org/help/siteswap/),\ we'll\ be\ all\ set.\n\n\[Vince\]\ Ok,\ you've\ tempted\ me\ \;-)\n\n\[http://www.juggling.org/pics/Pics/muddle-970219.gif\]\n----\n\[AM\]\ If\ I\ remember\ correctly,\ the\ physics\ behind\ juggling\ is\ not\ at\ all\ trivial\ -\ you\ need\ a\ certain\nrhythmic\ motion\ which\ is\ difficult\ to\ learn.\ I\ do\ not\ remember\ the\ details,\ unfortunately.\n\n======\n\ ##+################################################################\n\ #\n\ #\ tkjuggler.tcl\ --\ an\ interactive\ juggling\ program.\n\ #\ by\ Keith\ P.\ Vetter\n\ #\n\ #\ Revisions:\n\ #\ KPV\ Nov,\ 1994\ -\ initial\ revision\ for\ UCB\ CS285,\ Fall\ 1994\n\ #\ KPV\ Nov\ 25,\ 2002\ -\ removed\ 3d\ YART\ support\;\ added\ juggler\ \n\ #\n\n\ package\ require\ Tk\n\ \n\ ##+################################################################\n\ #\ \n\ #\ Juggle\ --\ controls\ the\ animation.\ Probable\ should\ rewrite\ using\ after\ to\n\ #\ avoid\ the\ update\ call,\ perhaps\ later.\n\ #\ \n\ proc\ juggle\ \{\{delta\ 1\}\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ while\ \{1\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Go\ until\ button\ press\n\ \ \ \ \ \ \ \ incr\ ss(t)\ \$delta\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Another\ clock\ tick\n\ \ \ \ \ \ \ \ for\ \{set\ j\ 0\}\ \{\$j\ <\ \$ss(num)\}\ \{incr\ j\}\ \{\;#\ For\ each\ ball\n\ \ \ \ \ \ \ \ \ \ \ \ move_ball\ \$ss(t)\ \$j\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Move\ it\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ move_hands\n\ \n\ \ \ \ \ \ \ \ update\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Show\ it\ on\ the\ screen\n\ \ \ \ \ \ \ \ if\ \{\$ss(stop)\ ||\ \$delta\ ==\ 0\}\ return\ \ \ \ \;#\ Should\ we\ stop\n\ \ \ \ \}\n\ \}\n\ ##+###############################################################\n\ #\n\ #\ Init\ -\ Initializes\ all\ non-varying\ state\ variables\n\ #\n\ proc\ init\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ set\ ss(pattern)\ \ \ \ \ cascade\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Juggling\ pattern\n\ \ \ \ set\ ss(perfect)\ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Add\ randomness\n\ \n\ \ \ \ set\ ss(stop)\ \ \ \ \ \ \ \ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Animation\ on/off\n\ \ \ \ set\ ss(h)\ \ \ \ \ \ \ \ \ \ \ 300\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Height\n\ \ \ \ set\ ss(flight)\ \ \ \ \ \ 64\n\ \ \ \ set\ ss(num)\ \ \ \ \ \ \ \ \ 5\n\ \ \ \ set\ ss(v,h)\ \ \ \ \ \ \ \ \ \$ss(h)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Display\ variants\ of\ above\n\ \ \ \ set\ ss(v,flight)\ \ \ \ \$ss(flight)\n\ \ \ \ set\ ss(v,num)\ \ \ \ \ \ \ \$ss(num)\n\ \ \ \ set\ ss(w)\ \ \ \ \ \ \ \ \ \ \ 140\n\ \ \ \ set\ ss(s)\ \ \ \ \ \ \ \ \ \ \ 40\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Size\ of\ the\ ball\n\ \ \ \ set\ ss(s2)\ \ \ \ \ \ \ \ \ \ \[expr\ \{\$ss(s)/2\}\]\ \ \ \ \ \ \ \;#\ Half\ the\ size\ of\ the\ ball\n\ \ \ \ set\ ss(startstop)\ \ \ Start\n\ \ \ \ set\ ss(scale)\ \ \ \ \ \ \ 1\n\ \n\ \ \ \ set\ ss(colors)\ \ \ \ \ \ \{magenta2\ orange2\ MediumPurple2\ orchid2\ SpringGreen2\}\n\ \ \ \ lappend\ ss(colors)\ \ lightslateblue\ PaleVioletRed2\ chartreuse\ DarkOrchid2\n\ \ \ \ lappend\ ss(colors)\ \ lightslateblue\ PaleVioletRed2\ chartreuse\ DarkOrchid2\n\ \ \ \ lappend\ ss(colors)\ \ purple2\ cyan2\ goldenrod2\ plum2\ HotPink2\ deepskyblue\n\ \ \ \ lappend\ ss(colors)\ \ firebrick2\ slateblue1\ maroon2\ DarkGoldenrod2\n\ \ \ \ lappend\ ss(colors)\ \ coral2\ thistle2\ skyblue2\n\ \}\n\ ##+###############################################################\n\ #\n\ #\ Display\ -\ Sets\ up\ the\ display\ with\ its\ canvas\ and\ sliders\n\ #\n\ proc\ display\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ foreach\ w\ \[winfo\ child\ .\]\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Delete\ any\ existing\ widgets\n\ \ \ \ \ \ \ \ destroy\ \$w\n\ \ \ \ \}\n\ \ \ \ set\ ss(ch)\ \[expr\ \[winfo\ screenheight\ .\]\ -\ 300\]\;#\ Canvas\ height\n\ \ \ \ set\ ss(cw)\ 664\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Canvas\ width\n\ \ \ \ frame\ .ftop\n\ \ \ \ frame\ .fbot\n\ \ \ \ pack\ .fbot\ -side\ bottom\ -fill\ x\n\ \ \ \ pack\ .ftop\ -side\ top\ -expand\ 1\ -fill\ both\n\ \ \ \ catch\ \{image\ create\ photo\ ::img::blank\ -width\ 1\ -height\ 1\}\n\ \ \ \ make_canvas\n\ \n\ \ \ \ frame\ .fstop\ -relief\ sunken\ -bd\ 1\n\ \ \ \ button\ .stop\ -textvariable\ ss(startstop)\ -command\ startstop\ -width\ 5\n\ \ \ \ frame\ .fqbtn\ -relief\ sunken\ -bd\ 1\n\ \ \ \ button\ .qbtn\ -text\ \{\ Quit\ \}\ -command\ exit\n\ \ \ \ button\ .about\ -image\ ::img::blank\ -command\ About\ -highlightthickness\ 0\n\ \ \ \ pack\ .fqbtn\ .fstop\ -side\ right\ -expand\ yes\ -in\ .fbot\n\ \ \ \ pack\ .stop\ -in\ .fstop\ -side\ left\ -expand\ yes\ -padx\ 3m\ -pady\ 2m\n\ \ \ \ pack\ .qbtn\ -in\ .fqbtn\ -side\ left\ -expand\ yes\ -padx\ 3m\ -pady\ 2m\n\ \ \ \ bind\ .stop\ <2>\ juggle\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Single\ step\n\ \ \ \ \n\ \ \ \ scale\ .s1\ -label\ Height\ -orient\ horizontal\ -from\ 1\ -to\ 1000\n\ \ \ \ .s1\ config\ -relief\ ridge\ -showvalue\ 1\ -variable\ ss(v,h)\n\ \ \ \ scale\ .s2\ -label\ \"Flight\ Time\"\ -orient\ horizontal\ -from\ 1\ -to\ 500\n\ \ \ \ .s2\ config\ -relief\ ridge\ -showvalue\ 1\ -variable\ ss(v,flight)\n\ \ \ \ scale\ .s4\ -label\ Balls\ -orient\ horizontal\ -from\ 3\ -to\ 20\n\ \ \ \ .s4\ config\ -relief\ ridge\ -showvalue\ 1\ -variable\ ss(v,num)\n\ \n\ \ \ \ pack\ .s1\ .s2\ .s4\ -side\ left\ -in\ .fbot\n\ \ \ \ bind\ .s1\ \ <ButtonRelease-1>\ \"set_value\ height\"\n\ \ \ \ bind\ .s2\ \ <ButtonRelease-1>\ \"set_value\ flight\"\n\ \ \ \ bind\ .s4\ \ <ButtonRelease-1>\ \"set_value\ balls\"\n\ \n\ \ \ \ frame\ .frb\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Radiobuttons\ for\ patterns\n\ \ \ \ radiobutton\ .cascade\ -text\ \"Cascade\"\ -var\ ss(pattern)\ \\\n\ \ \ \ \ \ \ \ -value\ cascade\ -command\ reinit\ -anchor\ w\n\ \ \ \ radiobutton\ .shower\ -text\ \"Shower\"\ -var\ ss(pattern)\ \\\n\ \ \ \ \ \ \ \ -value\ shower\ -command\ reinit\ -anchor\ w\n\ \ \ \ radiobutton\ .even\ -text\ \"Even\"\ -var\ ss(pattern)\ \\\n\ \ \ \ \ \ \ \ -value\ even\ -command\ reinit\ -anchor\ w\n\ \ \ \ pack\ .frb\ -side\ left\ -in\ .fbot\ -padx\ 1\n\ \ \ \ pack\ .cascade\ .even\ -in\ .frb\ -side\ top\ -expand\ yes\ -anchor\ w\ -fill\ x\n\ \n\ \ \ \ frame\ .fcb\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Checkbuttons\ for\ options\n\ \ \ \ checkbutton\ .crandom\ -text\ \"Perfect\"\ -var\ ss(perfect)\ -anc\ w\n\ \ \ \ checkbutton\ .cback\ -text\ \"Outside\"\ -var\ ss(back)\ -command\ reinit\ -anc\ w\n\ \ \ \ pack\ .fcb\ -side\ left\ -in\ .fbot\ -padx\ 1\n\ \ \ \ pack\ .crandom\ .cback\ -in\ .fcb\ -side\ top\ -expand\ no\ -anchor\ w\ -fill\ x\n\ \ \ \ place\ .about\ -in\ .fbot\ -relx\ 1\ -rely\ 0\ -anchor\ ne\n\ \n\ \ \ \ wm\ withdraw\ .\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Update\ to\ get\ sizes\n\ \ \ \ wm\ geom\ .\ +0+0\n\ \ \ \ wm\ deiconify\ .\n\ \ \ \ wm\ title\ .\ \"Tk\ Juggler\"\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Make_canvas\ -\ Creates\ the\ canvas\ on\ which\ all\ output\ will\ be\ done\n\ #\n\ proc\ make_canvas\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ scrollbar\ .vscroll\ -relief\ sunken\ -command\ \".c\ yview\"\n\ \ \ \ set\ c2\ \[expr\ \{\$ss(cw)\ /\ 2\}\]\n\ \ \ \ canvas\ .c\ -relief\ raised\ -borderwidth\ 2\ -height\ \$ss(ch)\ -width\ \$ss(cw)\ \\\n\ \ \ \ \ \ \ \ -bg\ steelblue3\ -highlightthickness\ 0\n\ \ \ \ .c\ config\ -scrollregion\ \[list\ -\$c2\ -1200\ \$c2\ 500\]\n\ \ \ \ .c\ config\ -yscrollcommand\ \".vscroll\ set\"\ -yscrollincrement\ 1\n\ \ \ \ .c\ config\ -highlightcolor\ \[.c\ cget\ -bg\]\n\ \ \ \ .c\ yview\ moveto\ .4\n\ \ \ \ flagman\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Draws\ are\ flagman\n\ \ \ \ wink\ 0\n\ \n\ \ \ \ pack\ .vscroll\ -in\ .ftop\ -side\ right\ -fill\ y\n\ \ \ \ pack\ .c\ -in\ .ftop\ -fill\ both\ -expand\ 1\n\ \n\ \ \ \ bind\ .c\ <2>\ \".c\ scan\ mark\ %x\ %y\"\n\ \ \ \ bind\ .c\ <B2-Motion>\ \".c\ scan\ drag\ %x\ %y\"\n\ \ \ \ bind\ .c\ <MouseWheel>\ \{%W\ yview\ scroll\ \[expr\ \{-\ (%D\ /\ 120)\ *\ 20\}\]\ units\}\n\ \ \ \ bind\ .c\ <Configure>\ \{Recenter\ %W\ %h\ %w\}\n\ \ \ \ bind\ .\ <Up>\ \ \ \{scaler\ 1\}\n\ \ \ \ bind\ .\ <Down>\ \{scaler\ 0\}\n\ \ \ \ focus\ .c\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ So\ mouse\ wheel\ works\n\ \}\n\ ##+######################################################\n\ #\ \n\ #\ Recenter\ -\ Called\ when\ window\ gets\ resized.\n\ #\ \n\ proc\ Recenter\ \{W\ h\ w\}\ \{\n\ \ \ \ set\ h\ \[expr\ \{\$h\ /\ 2.0\}\]\ \;\ set\ w\ \[expr\ \{\$w\ /\ 2.0\}\]\n\ \ \ \ \$W\ config\ -scrollregion\ \[list\ -\$w\ -1200\ \$w\ 500\]\n\ \}\n\ \n\ ##+#####################################################\n\ #\n\ #\ Move_ball\ -\ Moves\ ball\ WHO\ to\ parameter\ value\ T.\ It\ flies\ in\ a\n\ #\ parabola\ going\ through\ points\ (-w,0),\ (0,height),\ (w,0).\n\ #\n\ proc\ move_ball\ \{t\ w\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ switch\ \$ball(\$w,ss)\ \{\n\ \ \ \ \ \ \ \ \"LR\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Left\ to\ right\ toss\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ >=\ \$ball(\$w,catch)\}\ \{\ \ \ \ \ \ \ \ \;#\ ...just\ got\ caught\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ catch_ball\ \$w\ 1\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ HR\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"HR\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ in\ right\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ >=\ \$ball(\$w,toss)\}\ \{\ \ \ \ \ \ \ \ \ \;#\ ...just\ got\ tossed\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \$ss(HR)\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ toss_ball\ \$w\ 1\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"RL\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Right\ to\ left\ toss\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ ==\ \$ball(\$w,catch)\}\ \{\ \ \ \ \ \ \ \ \;#\ ...just\ got\ caught\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ catch_ball\ \$w\ 0\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ HL\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"HL\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ in\ left\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ >=\ \$ball(\$w,toss)\}\ \{\ \ \ \ \ \ \ \ \ \;#\ ...just\ got\ tossed\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \$ss(HL)\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ toss_ball\ \$w\ 0\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"SL\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ in\ left\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$ball(\$w,toss)\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \"HL\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"SR\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ in\ right\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$ball(\$w,toss)\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \"HR\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Tossing\ -\ Figures\ out\ the\ path\ for\ a\ ball:\ x,y\ \n\ #\n\ #\ u\ =\ (2t/sqrt(k)*f\ -\ 1)\n\ #\ x\ =\ w*u\n\ #\ y\ =\ kh\ *\ (1\ -\ u^2)\n\ #\n\ proc\ tossing\ \{time\ who\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ set\ t\ \[expr\ \{\$time\ -\ \$ball(\$who,toss)\}\]\ \ \ \ \ \;#\ Time\ since\ the\ toss\n\ \ \ \ set\ f\ \$ball(\$who,flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Flight\ time\n\ \n\ \ \ \ set\ u\ \[expr\ \{-1\ +\ 2.0\ *\ \$t\ /\ \$f\}\]\ \ \ \ \ \ \ \ \ \ \ \;#\ range\ -1\ to\ 1\n\ \ \ \ set\ x\ \[expr\ \{\$ball(\$who,x)\ +\ ((1\ +\ \$u)/2)\ *\ \$ball(\$who,w)\}\]\n\ \ \ \ set\ y\ \[expr\ \{-(\$ball(\$who,kh)\ *\ (1\ -\ \$u\ *\ \$u))\}\]\;#\ Y\ is\ a\ parabola\n\ \n\ \ \ \ return\ \[list\ \$x\ \$y\]\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Create_hand\ -\ Creates\ a\ new\ hand,\ and\ put\ them\ anywhere\ on\ the\ canvas\n\ #\n\ proc\ create_hand\ \{name\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ .c\ delete\ hand\$name\n\ \ \ \ .c\ create\ arc\ 0\ -\$ss(s)\ \$ss(s)\ \$ss(s)\ -fill\ orange\ -outline\ orange\ \\\n\ \ \ \ \ \ \ \ -tag\ \"hands\ hand\$name\ hand_x\$name\"\ -start\ 0\ -extent\ -180\n\ \ \ \ foreach\ \{x1\ y1\ x2\ y2\}\ \[.c\ bbox\ hand_x\$name\]\ break\n\ \ \ \ set\ color\ \[lindex\ \[.c\ config\ -bg\]\ 4\]\ \ \ \ \ \ \ \ \;#\ Erasure\ color\n\ \ \ \ .c\ create\ arc\ \$x1\ 0\ \$x2\ \$ss(s)\ -fill\ \$color\ -outline\ \"\"\ \\\n\ \ \ \ \ \ \ \ -tag\ \"hands\ hand\$name\ hand_y\$name\"\ -start\ 0\ -extent\ -180\n\ \ \ \ .c\ lower\ hand\$name\n\ \ \ \ .c\ lower\ flagman\n\ \ \ \ place_obj\ hand_x\$name\ \{0\ 0\}\ -1\n\ \ \ \ place_obj\ hand_y\$name\ \{0\ 0\}\ -1\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Create_ball\ -\ Creates\ a\ new\ ball\n\ #\n\ proc\ create_ball\ \{n\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ .c\ delete\ ball\$n\n\ \ \ \ set\ color\ \[lindex\ \$ss(colors)\ 0\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Take\ head\ of\ the\ list\n\ \ \ \ set\ ss(colors)\ \"\[lrange\ \$ss(colors)\ 1\ end\]\ \$color\"\ \;#\ Put\ head\ at\ end\n\ \ \ \ .c\ create\ oval\ -\$ss(s2)\ -\$ss(s2)\ \$ss(s2)\ \$ss(s2)\ -fill\ \$color\ \\\n\ \ \ \ \ \ \ \ -tag\ \"balls\ ball\$n\"\n\ \ \ \ #.c\ create\ text\ 0\ 0\ -text\ \$n\ -tag\ \"balls\ ball\$n\"\ -anchor\ c\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ New_balls\ -\ Deletes\ then\ recreates\ the\ balls\n\ #\n\ proc\ new_balls\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \}\n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Update\ the\ display\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Startstop\ -\ Manipulates\ the\ start\ /\ stop\ button\n\ #\n\ proc\ startstop\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ if\ \{\$ss(startstop)\ ==\ \"Start\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(startstop)\ \"Stop\"\n\ \ \ \ \ \ \ \ set\ ss(stop)\ 0\n\ \ \ \ \ \ \ \ after\ 1\ juggle\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ ss(startstop)\ \"Start\"\n\ \ \ \ \ \ \ \ set\ ss(stop)\ 1\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Set_value\n\ #\n\ #\ Handles\ changing\ the\ values\ of\ any\ juggling\ parameter.\ We\ late-bind\n\ #\ so\ we\ only\ change\ on\ button\ release.\n\ #\n\ proc\ set_value\ who\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ if\ \{\$who\ ==\ \"height\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(h)\ \$ss(v,h)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Just\ get\ the\ height\n\ \ \ \ \ \ \ \ return\n\ \ \ \ \}\ elseif\ \{\$who\ ==\ \"flight\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(flight)\ \$ss(v,flight)\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Get\ new\ flight\ time\n\ \ \ \ \}\ elseif\ \{\$who\ ==\ \"balls\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(num)\ \$ss(v,num)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ New\ number\ of\ balls\n\ \ \ \ \}\n\ \ \ \ adjust\n\ \ \ \ reinit\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Update\ global\ values\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Reinit\ --\ Initializes\ the\ ss\ variables\ for\ the\ balls\n\ #\n\ proc\ reinit\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ set\ ss(t)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ at\ time\ 0\n\ \ \ \ set\ ss(h)\ \$ss(v,h)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Height\n\ \ \ \ set\ ss(flight)\ \$ss(v,flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Flight\ time\n\ \ \ \ set\ ss(num)\ \$ss(v,num)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ How\ many\ balls\n\ \ \ \ set\ ss(w)\ \[expr\ \{round(\$ss(scale)\ *\ 140)\}\]\ \ \;#\ Width\ of\ hands\n\ \ \ \ .cback\ config\ -state\ normal\n\ \n\ \ \ \ set\ ss(LR)\ HR\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ State\ transitions\n\ \ \ \ set\ ss(RL)\ HL\n\ \ \ \ set\ ss(HR)\ RL\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Even\ does\ weirdness\n\ \ \ \ set\ ss(HL)\ LR\n\ \n\ \ \ \ \$ss(pattern)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ up\ for\ given\ pattern\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Best\ -\ Sets\ up\ the\ hold\ time\ for\ N\ balls\n\ #\n\ #\ empty\ (e)\ =\ \ \ P3\ \ \ -\ \ \ \ BALL(n-1)\n\ #\ \ \ \ \ \ \ \ \ \ \ =\ (2f+h)\ -\ (n-1)(2f+2h)/n\n\ #\ \ \ \ \ \ \ \ \ \ \ =\ (2f\ -\ h(n-2))\ /\ n\n\ #\ hold\ (h)\ \ =\ (2f\ -\ en)\ \ /\ (n-2)\n\ #\n\ #\ Also\ h\ +\ e\ =\ time\ between\ balls\ =\ (2f+2h)/n\n\ #\n\ #\ Constraints:\ at\ the\ start\ the\ last\ ball\ must\ be\ in\ the\ air\n\ #\ \ \ \ \ BALL(n-1)\ \ <\ P3\n\ #\ \ ==>\ \ \ \ \ hold\ \ <\ 2f\ /\ (n-2)\n\ #\ \ ==>\ \ \ \ \ empty\ <\ 2f\ /\ n\n\ #\ \ alt.\ hold\ time\ less\ than\ time\ between\ balls\n\ #\ \ \ \ \ hold\ \ \ \ \ \ \ <\ (2f+2h)/n\n\ #\ \ \ \ \ hold\ \ \ \ \ \ \ <\ 2f\ /\ (n-2)\n\ #\n\ #\ Best:\ e\ ==\ h\ ==>\ h\ =\ f\ /\ (n-1)\n\ #\n\ #\ To\ compute:\ the\ last\ ball\ starts\ at\ the\ exact\ moment\ when\ the\ first\ ball\n\ #\ is\ launched.\ The\ hand\ is\ empty\ until\ the\ ball\ lands.\n\ #\n\ proc\ best\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ set\ ss(hold)\ \$ss(flight)\n\ \ \ \ if\ \{\$ss(num)\ >\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(hold)\ \[expr\ \{round(1.0\ *\ \$ss(flight)\ /\ (\$ss(num)\ -\ 1))\}\]\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Move_hands\ -\ Positions\ the\ hands\ correctly.\n\ #\n\ proc\ move_hands\ \{\}\ \{\n\ \ \ \ global\ hand\ ss\n\ \n\ \ \ \ if\ \{\[.c\ find\ withtag\ hands\]\ ==\ \"\"\}\ return\ \ \;#\ No\ hands,\ do\ nothing\n\ \ \ \ .c\ delete\ arms\n\ \ \ \ foreach\ h\ \{0\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ where\ \[where_hands\ \$ss(t)\ \$h\]\ \ \ \ \ \ \ \;#\ Where\ it\ belongs\n\ \ \ \ \ \ \ \ foreach\ \{x\ y\}\ \$where\ break\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x\ -\ 1\ -\ \$h\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Fudge\ factor\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ 1\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Fudge\ factor\n\ \ \ \ \ \ \ \ place_obj\ hand\$h\ \[list\ \$x\ \$y\]\ -1\ \ \ \ \ \ \ \ \;#\ Put\ into\ place\n\ \n\ \ \ \ \ \ \ \ set\ w\ \[expr\ \{3\ *\ \$ss(s)\ /\ 4\}\]\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ +\ \$w\}\]\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$ss(elbowx,\$h)\ \$ss(elbowy,\$h)\ \$x\ \$y\ -tag\ arms\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -fill\ gray95\ -width\ \$w\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ if\ \{\$hand(\$h,ss)\ ==\ \"full\"\}\ \{\ \ \ \ \ \ \ \ \ \ \ \;#\ Does\ it\ have\ a\ ball\ in\ it?\n\ \ \ \ \ \ \ \ \ \ \ \ set\ b\ ball\$hand(\$h,ball)\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Yep,\ then\ move\ the\ ball\ also\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ \$b\ \$where\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ .c\ lower\ arms\ hands\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Where_hands\ -\ Determines\ where\ H\ hand\ should\ be\ at\ time\ T\n\ #\n\ proc\ where_hands\ \{t\ h\}\ \{\n\ \ \ \ global\ hand\ ss\n\ \n\ \ \ \ set\ d\ \[expr\ \{\$hand(\$h,duration)\ -\ 1\}\]\n\ \ \ \ if\ \{\$d\ <=\ 0\}\ \{set\ d\ 1\}\n\ \n\ \ \ \ if\ \{\$hand(\$h,ss)\ ==\ \"full\"\}\ \{\n\ \ \ \ \ \ \ \ set\ p\ \[expr\ \{1.0\ -\ (1.0*\$hand(\$h,toss)\ -\ \$t\ -1)\ /\ \$d\}\]\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$hand(\$h,y)\ -\ \$ss(s)\ *\ (4\ *\ (\$p\ *\ (\$p\ -\ 1)))\}\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ p\ \[expr\ \{(1.0\ *\ \$hand(\$h,catch)\ -\ \$t)\ /\ \$hand(\$h,duration)\}\]\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$ss(s2)\ *\ (4\ *\ (\$p\ *\ (\$p\ -\ 1)))\}\]\n\ \ \ \ \}\n\ \ \ \ set\ w\ \[expr\ \{\$ss(w)\ +\ \$ss(shift)\}\]\ \ \ \ \ \ \ \ \ \ \;#\ Biggest\ width\n\ \n\ \ \ \ if\ \$h\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ X\ depends\ on\ which\ hand\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \ \{\$w\ -\ 2\ *\ \$p\ *\ \$ss(shift)\}\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{-\$w\ +\ 2\ *\ \$p\ *\ \$ss(shift)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ set\ x\ \[expr\ \{round(\$x)\}\]\n\ \ \ \ set\ y\ \[expr\ \{round(\$y)\}\]\n\ \ \ \ return\ \[list\ \$x\ \$y\]\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Adjust\ -\ Adjust\ the\ flight\ &\ hold\ time\ so\ that\ their\ sum\ is\ a\n\ #\ multiple\ of\ the\ number\ of\ balls.\ This\ way,\ we\ get\ no\ round\ off\n\ #\ errors\ in\ computing\ where\ the\ balls\ should\ start.\n\ #\n\ proc\ adjust\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ if\ \{\$ss(pattern)\ !=\ \"cascade\"\}\ return\n\ \ \ \ set\ n\ \$ss(num)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Number\ of\ balls\n\ \ \ \ set\ f\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Flight\ time\n\ \ \ \ set\ h\ \$ss(hold)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ time\n\ \n\ \ \ \ set\ r\ \[expr\ \{(\$f\ +\ \$h)\ %\ \$n\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ How\ much\ we're\ off\ by\n\ \n\ \ \ \ if\ \{\$r\ !=\ 0\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$r\ >\ \$n\ /\ 2\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ r\ \[expr\ \{\$r\ -\ \$n\}\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ ss(flight)\ \[expr\ \{\$ss(flight)\ -\ \$r\}\]\ \;#\ Adjust\ flight\ down\n\ \ \ \ \ \ \ \ set\ ss(v,flight)\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ the\ scale\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Toss_ball\ -\ Called\ when\ a\ ball\ has\ just\ been\ tossed.\ We\ need\ to\n\ #\ update\ the\ hand\ info.\n\ #\n\ proc\ toss_ball\ \{who\ which\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ set\ next\ \[next_ball\ \$who\ \$which\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Next\ ball\ to\ land\ here\n\ \ \ \ set\ hand(\$which,ss)\ \ \ \ \ \ \ \ \ empty\ \ \ \ \ \ \ \ \ \ \ \;#\ No\ longer\ holding\ a\ ball\n\ \ \ \ set\ hand(\$which,ball)\ \ \ \ \ \ \ -1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ hand\n\ \ \ \ set\ hand(\$which,catch)\ \ \ \ \ \ \$ball(\$next,catch)\ \;#\ Next\ ball\ to\ land\ here\n\ \ \ \ set\ hand(\$which,duration)\ \ \ \[expr\ \{\$ball(\$next,catch)\ -\ \$ss(t)\}\]\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Catch_ball\ -\ Called\ when\ ball\ WHO\ lands\ in\ hand\ WHICH.\ Generates\ a\n\ #\ new\ toss\ and\ updates\ the\ hand\ information.\n\ #\n\ proc\ catch_ball\ \{who\ which\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ set\ dirs(RL)\ to_right\n\ \ \ \ set\ dirs(LR)\ to_left\n\ \n\ \ \ \ set\ next\ \[next_ball\ \$who\ \$which\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Next\ ball\ to\ land\ here\n\ \n\ \ \ \ set\ when\ \[expr\ \{(\$ss(t)\ +\ \$ball(\$next,catch))\ /2.0\}\]\;#\ Time\ for\ us\ to\ leave\n\ \ \ \ set\ when\ \[expr\ \{round(\$when)\}\]\n\ \ \ \ if\ \{\$when\ ==\ \$ss(t)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Problem\ when\ WHO\ ==\ NEXT\n\ \ \ \ \ \ \ \ set\ when\ \[expr\ \{\$ss(t)\ +\ \$ss(hold)\}\]\n\ \ \ \ \}\n\ \ \ \ if\ \{0\ &&\ \$which\ ==\ 0\}\ \{\n\ \ \ \ \ \ \ \ puts\ -nonewline\ \"catch\ \$who:\ time\ \$ss(t)\ catch(\$next)\ \"\n\ \ \ \ \ \ \ \ puts\ -nonewline\ \"\$ball(\$next,catch)\ when\ \$when\ \"\n\ \ \ \ \ \ \ \ puts\ \"when:\ +\[expr\ \{\$when\ -\ \$ss(t)\}\]\"\n\ \ \ \ \}\n\ \n\ \ \ \ new_toss\ \$who\ \$when\ \$dirs(\$ball(\$who,ss))\ \$which\n\ \n\ \ \ \ set\ hand(\$which,ss)\ \ \ \ \ \ \ \ \ full\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Holding\ a\ ball\n\ \ \ \ set\ hand(\$which,ball)\ \ \ \ \ \ \ \$who\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ hand\n\ \ \ \ set\ hand(\$which,toss)\ \ \ \ \ \ \ \$ball(\$who,toss)\;#\ When\ we\ throw\ it\n\ \ \ \ set\ hand(\$which,duration)\ \ \ \[expr\ \{\$ball(\$who,toss)\ -\ \$ss(t)\}\]\n\ \n\ \ \ \ set\ u\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[expr\ \{-1\ +\ 2.0/\$ball(\$who,flight)\}\]\n\ \ \ \ set\ y\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[expr\ \{\$ball(\$who,kh)\ *\ (1\ -\ \$u*\$u)\}\]\n\ \ \ \ set\ hand(\$which,y)\ \ \ \ \ \ \ \ \ \ \$y\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Next_ball\ -\ Returns\ the\ next\ ball\ after\ WHO\ to\ land\ in\ hand\ WHICH\n\ #\n\ proc\ next_ball\ \{w\ h\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ incr\ w\ -1\n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"even\"\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$w\ ==\ -1\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ w\ \[expr\ \{\$ss(n2)\ -\ 1\}\]\n\ \ \ \ \ \ \ \ \}\ elseif\ \{\$w\ ==\ \$ss(n2)\ -\ 1\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ w\ \[expr\ \{\$ss(num)\ -\ 1\}\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\ elseif\ \{\$w\ ==\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ w\ \[expr\ \{\$ss(num)\ -\ 1\}\]\n\ \ \ \ \}\n\ \ \ \ return\ \$w\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ New_toss\ -\ Sets\ up\ ball\ WHO\ for\ being\ tossed\ again\ at\ time\ WHEN\n\ #\ in\ direction\ DIR.\n\ #\ new\ height\ =\ k\ *\ height\n\ #\ new\ flight\ =\ sqrt(k)\ *\ flight\n\ #\n\ proc\ new_toss\ \{who\ when\ dir\ xhand\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ set\ k\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Scaling\ factor\n\ \ \ \ set\ f\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Total\ flight\ time\n\ \ \ \ set\ x\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Overlap\ into\ holding\ time\n\ \n\ \ \ \ if\ \{!\ \$ss(perfect)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Should\ we\ add\ randomness?\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{int(rand()\ *\ \$ss(hold))\}\]\ \ \;#\ Use\ this\ much\ of\ hold\ time\n\ \ \ \ \ \ \ \ set\ f\ \[expr\ \{\$ss(flight)\ +\ \$x\}\]\ \ \ \ \ \ \ \ \ \;#\ New\ flight\ time\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{1.0\ *\ \$f\ /\ \$ss(flight)\}\]\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{\$k\ *\ \$k\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ if\ \{\$dir\ ==\ \"to_right\"\ &&\ \$ss(pattern)\ ==\ \"shower\"\}\ \{\n\ \ \ \ \ \ \ \ set\ f\ \$ss(flight2)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Special\ low\ path\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{1.0\ *\ \$f\ /\ \$ss(flight)\}\]\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{\$k\ *\ \$k\}\]\n\ \ \ \ \}\n\ \ \ \ set\ ball(\$who,k)\ \ \ \ \ \ \$k\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Random\ height\ scale\ factor\n\ \ \ \ set\ ball(\$who,toss)\ \ \ \$when\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Time\ of\ the\ toss\n\ \ \ \ set\ ball(\$who,flight)\ \$f\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ New\ flight\ time\n\ \ \ \ set\ ball(\$who,catch)\ \ \[expr\ \{\$when\ +\ \$f\}\]\ \ \ \;#\ Time\ of\ catch\n\ \ \ \ set\ ball(\$who,kh)\ \ \ \ \ \[expr\ \{\$k\ *\ \$ss(h)\}\]\ \ \;#\ How\ high\ this\ toss\ goes\n\ \n\ \ \ \ set\ ball(\$who,w)\ \ \ \ \ \ \[expr\ \{2\ *\ \$ss(w)\}\]\n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"even\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ball(\$who,w)\ \ \[expr\ \{-2*\$ss(shift)\}\]\n\ \ \ \ \}\n\ \ \ \ set\ ball(\$who,x)\ \ \ \ \ \ \[expr\ \{-(\$ss(w)\ -\ \$ss(shift))\}\]\n\ \ \ \ if\ \{\$xhand\ ==\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ ball(\$who,w)\ \ \[expr\ \{-\$ball(\$who,w)\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$who,x)\ \ \[expr\ \{-\$ball(\$who,x)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"shower\"\ &&\ \$ss(back)\ ==\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ ball(\$who,w)\ \ \[expr\ \{-\$ball(\$who,w)\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$who,x)\ \ \[expr\ \{-\$ball(\$who,x)\}\]\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Dump\ -\ Dumps\ out\ the\ ss\ of\ a\ ball\ or\ all\ the\ balls\n\ #\n\ proc\ dump\ \{\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ puts\ \"\"\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ set\ msg\ \"Ball\ \$i:\ \$ball(\$i,ss)\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ toss\ \[format\ %4d\ \$ball(\$i,toss)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ catch\[format\ %4d\ \$ball(\$i,catch)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ flight\[format\ %4d\ \$ball(\$i,flight)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ x\ \ \[format\ %4d\ \$ball(\$i,x)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ w\ \ \[format\ %4d\ \$ball(\$i,w)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ k\ \ \$ball(\$i,k)\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ kh\ \$ball(\$i,kh)\"\n\ \ \ \ \ \ \ \ puts\ \$msg\n\ \ \ \ \}\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 2\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ set\ msg\ \"Hand\ \$i:\ \[format\ %5s\ \$hand(\$i,ss)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ ball\ \[format\ %2s\ \$hand(\$i,ball)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ toss\ \[format\ %4d\ \$hand(\$i,toss)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ catch\ \[format\ %4d\ \$hand(\$i,catch)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ duration\ \$hand(\$i,duration)\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ y\ \ \$hand(\$i,y)\"\n\ \ \ \ \ \ \ \ puts\ \$msg\n\ \ \ \ \}\n\ \ \ \ puts\ \"time:\ \$ss(t)\"\n\ \ \ \ puts\ \"\"\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Init_ball\ -\ Given\ the\ starting\ position\ of\ a\ ball,\ it\ determines\ the\n\ #\ ss\ the\ ball\ is\ in\ and\ what\ its\ toss/catch\ values\ should\ be.\n\ #\n\ proc\ init_ball\ \{who\ time\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ if\ \{\$time\ <\ \$ss(p1)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Left\ to\ right\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ LR\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{-\$time\}\]\ to_right\ 0\n\ \ \ \ \}\ elseif\ \{\$time\ <\ \$ss(p2)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ right\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ SR\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ HR\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{\$ss(p2)\ -\ \$time\}\]\ to_left\ 1\n\ \ \ \ \}\ elseif\ \{\$time\ <\ \$ss(p3)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Right\ to\ left\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ RL\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{\$ss(p2)\ -\ \$time\}\]\ to_left\ 1\n\ \ \ \ \}\ elseif\ \{\$time\ <\ \$ss(p4)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ left\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ SL\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ HL\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{\$ss(p4)\ -\ \$time\}\]\ to_right\ 0\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ puts\ \"ERROR:\ init_ball\ \$who\ \$time:\ time\ out\ of\ range\"\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Startup\ -\ Re-init\ the\ balls\ so\ that\ they\ all\ start\ in\ the\ hands.\n\ #\ Not\ fully\ working\ yet.\n\ #\n\ proc\ startup\ \{\}\ \{\n\ \ \ \ global\ ss\ ball\n\ \n\ \ \ \ set\ newss(LR)\ SL\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Cheap\ way\ to\ avoid\ an\ if\n\ \ \ \ set\ newss(HR)\ SR\n\ \ \ \ set\ newss(RL)\ SR\n\ \ \ \ set\ newss(HL)\ SL\n\ \n\ \ \ \ set\ max\ \$ss(t)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Find\ longest\ in\ air\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$ball(\$i,toss)\ <\ \$max\}\ \{\ set\ max\ \$ball(\$i,toss)\ \}\n\ \ \ \ \}\n\ \n\ \ \ \ set\ max\ \[expr\ \{\$ss(t)\ -\ \$max\}\]\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\ \ \ \ \;#\ Adjust\ everyone\ by\ max\n\ \ \ \ \ \ \ \ set\ ball(\$i,toss)\ \ \ \ \ \ \ \[expr\ \{\$ball(\$i,toss)\ +\ \$max\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$i,catch)\ \ \ \ \ \ \[expr\ \{\$ball(\$i,toss)\ +\ \$ball(\$i,flight)\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ \$newss(\$ball(\$i,ss))\n\ \n\ \ \ \ \ \ \ \ move_ball\ 0\ \$i\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Init_hands\ -\ Initializes\ where\ the\ hands\ are\n\ #\n\ proc\ init_hands\ \{\}\ \{\n\ \ \ \ global\ ball\ ss\ hand\n\ \n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"shower\"\}\ return\n\ \n\ \ \ \ set\ hand(0,y)\ 20\n\ \ \ \ set\ hand(1,y)\ 20\n\ \n\ \ \ \ toss_ball\ 0\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Just\ tossed\ off\ ball\ 0\n\ \ \ \ if\ \{\[expr\ \{(\$ss(num)\ %\ 2)\ ==\ 0\}\]\}\ \{\n\ \ \ \ \ \ \ \ toss_ball\ \[expr\ \{\$ss(num)\ /\ 2\}\]\ 1\n\ \ \ \ \ \ \ \ return\n\ \ \ \ \}\n\ \n\ \ \ \ set\ hand(0,toss)\ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ When\ ball\ gets\ tossed\n\ \ \ \ set\ who\ \[expr\ \{\$ss(num)\ /\ 2\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ the\ right\ hand\n\ \ \ \ set\ hand(1,ss)\ full\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ It\ has\ a\ ball\ in\ it\n\ \ \ \ set\ hand(1,ball)\ \ \$who\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Which\ ball\n\ \ \ \ set\ hand(1,toss)\ \ \$ball(\$who,toss)\ \ \ \ \ \ \ \ \ \ \;#\ When\ toss\ will\ happen\n\ \ \ \ set\ hand(1,catch)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ When\ next\ ball\ lands\n\ \ \ \ set\ hand(1,duration)\ \$ss(hold)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ How\ long\ we\ hold\ ball\ for\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Cascade\ -\ Sets\ up\ balls\ &\ hands\ for\ the\ cascade\ pattern\n\ #\n\ proc\ cascade\ \{\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ best\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ up\ HOLD\n\ \ \ \ adjust\n\ \ \ \ set\ ss(pattern)\ cascade\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Indicate\ this\ pattern\n\ \ \ \ set\ ss(t)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ at\ time\ 0\n\ \ \ \ set\ ss(shift)\ \[expr\ \{(1\ -\ 2*\$ss(back))\ *\ \$ss(s)\}\]\n\ \n\ \ \ \ set\ ss(p1)\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Cycle\ timings\n\ \ \ \ set\ ss(p2)\ \[expr\ \{\$ss(p1)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(p3)\ \[expr\ \{\$ss(p2)\ +\ \$ss(flight)\}\]\n\ \ \ \ set\ ss(p4)\ \[expr\ \{\$ss(p3)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(total)\ \$ss(p4)\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \ \ \ \ init_ball\ \$i\ \[expr\ \{\$ss(total)\ *\ \$i\ /\ \$ss(num)\}\]\n\ \ \ \ \}\n\ \ \ \ #startup\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ into\ start\ position\n\ \n\ \ \ \ create_hand\ 0\n\ \ \ \ create_hand\ 1\n\ \ \ \ init_hands\n\ \n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ them\ in\ position\n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Don't\ ask,\ it\ looks\ better\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Shower\ -\ Sets\ up\ for\ the\ shower\ pattern\n\ #\n\ proc\ shower\ \{\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ set\ ss(pattern)\ shower\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Indicate\ this\ pattern\n\ \ \ \ set\ ss(t)\ 0\n\ \ \ \ set\ ss(shift)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Get\ rid\ of\ the\ shift\n\ \ \ \ .c\ delete\ hands\n\ \n\ \ \ \ ##\ total\ =\ f\ +\ 2hold\ +\ f2\n\ \ \ \ ##\ f2\ =\ total/n\ \ \ \ \ \ \ \ \ \ \ \ \ \ ==>\ f/(n-2)\n\ \ \ \ ##\ hold\ =\ 1/2\ *\ (total\ /\ n)\ \ ==>\ f/2(n-2)\n\ \ \ \ set\ ss(flight2)\ \ \ \ \ \[expr\ \{round(\$ss(flight)\ /\ (\$ss(num)\ -\ 2.0))\}\]\n\ \ \ \ if\ \{\$ss(flight2)\ <=\ 1\}\ \{\ set\ ss(flight2)\ 2\ \}\n\ \ \ \ if\ \{\$ss(flight2)\ >=\ 5\}\ \{\ set\ ss(flight2)\ 4\ \}\n\ \ \ \ set\ ss(hold)\ \ \ \ \ \ \ \ \[expr\ \{round(\$ss(flight2)\ /\ 2.0)\}\]\n\ \n\ \ \ \ set\ ss(p1)\ \ \$ss(flight2)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Cycle\ timings\n\ \ \ \ set\ ss(p2)\ \ \[expr\ \{\$ss(p1)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(p3)\ \ \[expr\ \{\$ss(p2)\ +\ \$ss(flight)\}\]\n\ \ \ \ set\ ss(p4)\ \ \[expr\ \{\$ss(p3)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(total)\ \ \ \ \ \ \ \$ss(p4)\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \ \ \ \ init_ball\ \$i\ \[expr\ \{\$ss(total)\ *\ \$i\ /\ \$ss(num)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ them\ in\ position\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Even\ -\ Sets\ up\ for\ even\ ball\ pattern\n\ #\n\ proc\ even\ \{\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ set\ ss(pattern)\ even\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Indicate\ this\ pattern\n\ \ \ \ set\ ss(t)\ 0\n\ \ \ \ set\ ss(shift)\ \[expr\ \{(1\ -\ 2*\$ss(back))\ *\ 2*\$ss(s)\}\]\ \;#\ Bigger\ shift\n\ \ \ \ set\ ss(w)\ \[expr\ \{round(\$ss(scale)\ *\ 110)\}\]\ \ \;#\ Width\ of\ hands\n\ \n\ \ \ \ set\ ss(HR)\ LR\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Change\ the\ transitions\n\ \ \ \ set\ ss(HL)\ RL\n\ \n\ \ \ \ set\ ss(hold)\ \[expr\ \{\$ss(flight)\ /\ (\$ss(num)\ -\ 1)\}\]\n\ \ \ \ set\ ss(total)\ \[expr\ \{\$ss(flight)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ n2\ \[expr\ \{round(\$ss(num)\ /\ 2.0)\}\]\ \ \ \ \ \ \ \;#\ Balls\ in\ left\ hand\n\ \ \ \ set\ n3\ \[expr\ \{\$ss(num)\ -\ \$n2\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Balls\ in\ right\ hand\n\ \ \ \ set\ ss(n2)\ \$n2\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$n2\}\ \{incr\ i\}\ \{\ \ \ \ \ \ \ \ \ \;#\ Left\ hand\n\ \ \ \ \ \ \ \ create_ball\ \$i\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ New\ ball\n\ \ \ \ \ \ \ \ set\ t\ \[expr\ \{-\$ss(total)\ *\ \$i\ /\ \$n2\}\]\ \ \ \;#\ When\ it\ got\ tossed\n\ \ \ \ \ \ \ \ new_toss\ \$i\ \$t\ xxx\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ in\ then\ toss\ values\n\ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ RL\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Reset\ the\ ss\ info\n\ \ \ \ \ \ \ \ if\ \[expr\ \{\$t\ >\ \$ss(flight)\}\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i2,ss)\ SL\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i2,ss)\ HL\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \n\ \ \ \ set\ offset\ \[expr\ \{\$n2\ ==\ \$n3\ ?\ \$ss(hold)\ :\ 0\}\]\n\ \ \ \ for\ \{set\ i\ \$n2\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\ \ \;#\ Right\ hand\n\ \ \ \ \ \ \ \ set\ i2\ \[expr\ \{\$i\ -\ \$n2\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ other\ hand\n\ \n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \ \ \ \ set\ t\ \[expr\ \{-\$ss(total)\ *\ \$i2\ /\ \$n3\}\]\ \ \;#\ When\ it\ got\ tossed\n\ \ \ \ \ \ \ \ set\ t\ \[expr\ \{-\$offset\ +\ \$t\}\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Offset\ it\ a\ little\n\ \ \ \ \ \ \ \ new_toss\ \$i\ \$t\ xxx\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ in\ the\ toss\ values\n\ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ LR\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Reset\ the\ ss\ info\n\ \ \ \ \ \ \ \ if\ \[expr\ \{\$t\ >\ \$ss(flight)\}\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ SR\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ HR\n\ \ \ \ \ \ \ \ \}\n\ \n\ \ \ \ \}\n\ \ \ \ create_hand\ 0\n\ \ \ \ create_hand\ 1\n\ \ \ \ toss_ball\ 0\ 0\n\ \ \ \ toss_ball\ \$n2\ 1\n\ \n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ them\ in\ position\n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Don't\ ask,\ it\ looks\ better\n\ \}\n\ proc\ wink\ \{onoff\}\ \{\n\ \ \ \ catch\ \{after\ cancel\ \$::ss(wink)\}\n\ \ \ \ if\ \{\$onoff\}\ \{\n\ \ \ \ \ \ \ \ .c\ lower\ reye\n\ \ \ \ \ \ \ \ .c\ raise\ wink\ flagman\n\ \ \ \ \ \ \ \ set\ ::ss(wink)\ \[after\ 500\ \{wink\ 0\}\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ .c\ lower\ wink\n\ \ \ \ \ \ \ \ .c\ raise\ reye\ flagman\n\ \ \ \ \ \ \ \ set\ delay\ \[expr\ \{int(1000\ *\ (10\ +\ 40*rand()))\}\]\n\ \ \ \ \ \ \ \ set\ ::ss(wink)\ \[after\ \$delay\ \{wink\ 1\}\]\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Place_obj\n\ #\n\ #\ Moves\ OBJ\ to\ absolute\ coordinates\ (x,y).\ If\ center\ is\ 0\ then\ the\n\ #\ top\ left\ corner\ moves\ to\ (x,y).\ If\ center\ is\ 1\ then\ the\ object\ is\n\ #\ centered\ at\ (x,y).\ If\ center\ is\ -1,\ then\ only\ centered\ in\ x.\n\ #\n\ proc\ place_obj\ \{obj\ xy\ \{center\ 1\}\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ foreach\ \{x\ y\}\ \$xy\ break\n\ \ \ \ set\ bb\ \[.c\ bbox\ \$obj\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Where\ it\ is\n\ \ \ \ set\ x\ \[expr\ \{\$x\ -\ \$ss(s2)\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Center\ at\ this\ point\n\ \ \ \ if\ \{\$center\ !=\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ \$ss(s2)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ set\ dx\ \[expr\ \{\$x\ -\ \[lindex\ \$bb\ 0\]\}\]\ \ \ \ \ \ \ \ \ \;#\ Delta\ in\ X\n\ \ \ \ set\ dy\ \[expr\ \{\$y\ -\ \[lindex\ \$bb\ 1\]\}\]\ \ \ \ \ \ \ \ \ \;#\ Delta\ in\ Y\n\ \n\ \ \ \ .c\ move\ \$obj\ \$dx\ \$dy\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Move\ into\ place\n\ \}\n\ proc\ About\ \{\}\ \{\n\ \ \ \ tk_messageBox\ -icon\ info\ -parent\ .\ -title\ \"About\ TkJuggler\"\ \\\n\ \ \ \ \ \ \ \ -message\ \"Tk\ Juggler\\n\\nby\ Keith\ Vetter\\nNovember,\ 2002\"\n\ \}\n\ proc\ flagman\ \{\}\ \{\n\ \ \ \ #\ stolen\ from\ http://wiki.tcl.tk/3208\n\ \ \ \ .c\ create\ rect\ \{-5000\ 110\ 5000\ 5000\}\ -fill\ grey\ -outline\ grey\ -tag\ flagman\n\ \ \ \ .c\ create\ poly\ \{-80\ 280\ -20\ 280\ 0\ 80\ 20\ 280\ 80\ 280\ 100\ -136\ 0\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -160\ -100\ -136\}\ -fill\ white\ -tag\ flagman\n\ \ \ \ .c\ create\ oval\ \{-40\ -236\ 40\ -140\}\ -fill\ orange\ \ -outline\ orange\ -tag\ flagman\n\ \ \ \ .c\ create\ line\ \{-16\ -200\ -16\ -188\}\ -tag\ \{flagman\ reye\}\n\ \ \ \ .c\ create\ line\ \{-8\ -194\ -24\ -194\}\ -tag\ \{flagman\ wink\}\n\ \ \ \ .c\ create\ line\ \{16\ \ -200\ \ 16\ -188\}\ -tag\ flagman\n\ \ \ \ .c\ create\ arc\ -24\ -216\ 24\ -160\ -start\ 210\ -extent\ 125\ -style\ arc\ \\\n\ \ \ \ \ \ \ \ -tag\ flagman\n\ \ \ \ .c\ create\ rect\ \{-36\ -236\ 36\ -216\}\ -fill\ white\ -outline\ white\ -tag\ flagman\n\ \n\ \ \ \ .c\ create\ poly\ \{-80\ -120\ -100\ -120\ -100\ 0\ -60\ 0\ -60\ -120\}\ -fill\ grey95\ \\\n\ \ \ \ \ \ \ \ -tag\ flagman\n\ \ \ \ .c\ create\ poly\ \{80\ -120\ 100\ -120\ \ 100\ 0\ \ 60\ 0\ 60\ -120\}\ -fill\ grey95\ \\\n\ \ \ \ \ \ \ \ -tag\ flagman\n\ \ \ \ .c\ lower\ wink\n\ \n\ \ \ \ array\ set\ ::ss\ \{elbowx,0\ -80\ elbowy,0\ -10\ elbowx,1\ 80\ elbowy,1\ -10\}\n\ \}\n\ proc\ scaler\ \{bigger\}\ \{\n\ \ \ \ global\ ss\n\ \ \ \ \n\ \ \ \ if\ \{\$bigger\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$ss(scale)\ >\ 2\}\ return\n\ \ \ \ \ \ \ \ set\ f\ 1.25\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ if\ \{\$ss(scale)\ <\ .15\}\ return\n\ \ \ \ \ \ \ \ set\ f\ .8\n\ \ \ \ \}\n\ \ \ \ .c\ scale\ all\ 0\ 0\ \$f\ \$f\n\ \n\ \ \ \ foreach\ w\ \{scale\ s\ s2\ w\ v,h\ elbowx,0\ elbowx,1\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(\$w)\ \[expr\ \{\$ss(\$w)\ *\ \$f\}\]\n\ \ \ \ \}\n\ \ \ \ set\ ss(v,flight)\ \[expr\ \{round(\$ss(v,flight)\ /\ \$f)\}\]\n\ \ \ \ adjust\n\ \ \ \ reinit\n\ \}\n\ ##+##############################################################\n\ #################################################################\n\ #################################################################\n\ init\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ One\ time\ inits\n\ display\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ up\ all\ the\ widgets\n\ reinit\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Inits\ for\ this\ pattern\n\ startstop\n\ ======\n\n<<categories>>\ Graphics\ |\ Application regexp2} CALL {my render Juggler \[Keith\ Vetter\]\ 2002-11-25\ -\ This\ is\ from\ an\ old\ graphics\ class\ I\ took\ back\ in\ 1994.\ It\ shows\ a\ person\ juggling\ from\ 3\ to\ 20\ balls\ in\ either\ the\ cascade\ or\ even\ ball\ juggling\ pattern.\n\nI\ added\ the\ juggling\ man\ just\ last\ night--with\ the\ design\ borrowed\ from\ \[Flag\ signalling\].\n\nThe\ goal\ of\ this\ program\ was\ not\ just\ to\ show\ a\ perfect\ juggler--although\ if\ you\ turn\ on\ the\ ''perfect''\ button\ it\ will\ do\ that.\ Rather,\ the\ goal\ was\ to\ add\ errors\ into\ each\ throw\ and\ see\ how\ the\ juggler\ responds.\ I've\ remove\ much\ of\ that\ code,\ but\ still\ each\ throw\ is\ unique,\ based\ on\ how\ fast\ the\ ball\ must\ be\ released\ before\ the\ next\ ball\ lands.\n\nOne\ undocumented\ feature\ is\ that\ you\ can\ use\ the\ up\ and\ down\ arrows\ to\ zoom\ in\ and\ out.\n\n\[http://mini.net/pub/juggler.png\]\n----\n\[KBK\]\ Lovely!\ \ Now\ if\ we\ can\ get\ \[Vince\ Darley\]\ to\ add\ site\ swap\ notation\n(http://www.juggling.org/help/siteswap/),\ we'll\ be\ all\ set.\n\n\[Vince\]\ Ok,\ you've\ tempted\ me\ \;-)\n\n\[http://www.juggling.org/pics/Pics/muddle-970219.gif\]\n----\n\[AM\]\ If\ I\ remember\ correctly,\ the\ physics\ behind\ juggling\ is\ not\ at\ all\ trivial\ -\ you\ need\ a\ certain\nrhythmic\ motion\ which\ is\ difficult\ to\ learn.\ I\ do\ not\ remember\ the\ details,\ unfortunately.\n\n======\n\ ##+################################################################\n\ #\n\ #\ tkjuggler.tcl\ --\ an\ interactive\ juggling\ program.\n\ #\ by\ Keith\ P.\ Vetter\n\ #\n\ #\ Revisions:\n\ #\ KPV\ Nov,\ 1994\ -\ initial\ revision\ for\ UCB\ CS285,\ Fall\ 1994\n\ #\ KPV\ Nov\ 25,\ 2002\ -\ removed\ 3d\ YART\ support\;\ added\ juggler\ \n\ #\n\n\ package\ require\ Tk\n\ \n\ ##+################################################################\n\ #\ \n\ #\ Juggle\ --\ controls\ the\ animation.\ Probable\ should\ rewrite\ using\ after\ to\n\ #\ avoid\ the\ update\ call,\ perhaps\ later.\n\ #\ \n\ proc\ juggle\ \{\{delta\ 1\}\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ while\ \{1\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Go\ until\ button\ press\n\ \ \ \ \ \ \ \ incr\ ss(t)\ \$delta\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Another\ clock\ tick\n\ \ \ \ \ \ \ \ for\ \{set\ j\ 0\}\ \{\$j\ <\ \$ss(num)\}\ \{incr\ j\}\ \{\;#\ For\ each\ ball\n\ \ \ \ \ \ \ \ \ \ \ \ move_ball\ \$ss(t)\ \$j\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Move\ it\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ move_hands\n\ \n\ \ \ \ \ \ \ \ update\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Show\ it\ on\ the\ screen\n\ \ \ \ \ \ \ \ if\ \{\$ss(stop)\ ||\ \$delta\ ==\ 0\}\ return\ \ \ \ \;#\ Should\ we\ stop\n\ \ \ \ \}\n\ \}\n\ ##+###############################################################\n\ #\n\ #\ Init\ -\ Initializes\ all\ non-varying\ state\ variables\n\ #\n\ proc\ init\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ set\ ss(pattern)\ \ \ \ \ cascade\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Juggling\ pattern\n\ \ \ \ set\ ss(perfect)\ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Add\ randomness\n\ \n\ \ \ \ set\ ss(stop)\ \ \ \ \ \ \ \ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Animation\ on/off\n\ \ \ \ set\ ss(h)\ \ \ \ \ \ \ \ \ \ \ 300\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Height\n\ \ \ \ set\ ss(flight)\ \ \ \ \ \ 64\n\ \ \ \ set\ ss(num)\ \ \ \ \ \ \ \ \ 5\n\ \ \ \ set\ ss(v,h)\ \ \ \ \ \ \ \ \ \$ss(h)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Display\ variants\ of\ above\n\ \ \ \ set\ ss(v,flight)\ \ \ \ \$ss(flight)\n\ \ \ \ set\ ss(v,num)\ \ \ \ \ \ \ \$ss(num)\n\ \ \ \ set\ ss(w)\ \ \ \ \ \ \ \ \ \ \ 140\n\ \ \ \ set\ ss(s)\ \ \ \ \ \ \ \ \ \ \ 40\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Size\ of\ the\ ball\n\ \ \ \ set\ ss(s2)\ \ \ \ \ \ \ \ \ \ \[expr\ \{\$ss(s)/2\}\]\ \ \ \ \ \ \ \;#\ Half\ the\ size\ of\ the\ ball\n\ \ \ \ set\ ss(startstop)\ \ \ Start\n\ \ \ \ set\ ss(scale)\ \ \ \ \ \ \ 1\n\ \n\ \ \ \ set\ ss(colors)\ \ \ \ \ \ \{magenta2\ orange2\ MediumPurple2\ orchid2\ SpringGreen2\}\n\ \ \ \ lappend\ ss(colors)\ \ lightslateblue\ PaleVioletRed2\ chartreuse\ DarkOrchid2\n\ \ \ \ lappend\ ss(colors)\ \ lightslateblue\ PaleVioletRed2\ chartreuse\ DarkOrchid2\n\ \ \ \ lappend\ ss(colors)\ \ purple2\ cyan2\ goldenrod2\ plum2\ HotPink2\ deepskyblue\n\ \ \ \ lappend\ ss(colors)\ \ firebrick2\ slateblue1\ maroon2\ DarkGoldenrod2\n\ \ \ \ lappend\ ss(colors)\ \ coral2\ thistle2\ skyblue2\n\ \}\n\ ##+###############################################################\n\ #\n\ #\ Display\ -\ Sets\ up\ the\ display\ with\ its\ canvas\ and\ sliders\n\ #\n\ proc\ display\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ foreach\ w\ \[winfo\ child\ .\]\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Delete\ any\ existing\ widgets\n\ \ \ \ \ \ \ \ destroy\ \$w\n\ \ \ \ \}\n\ \ \ \ set\ ss(ch)\ \[expr\ \[winfo\ screenheight\ .\]\ -\ 300\]\;#\ Canvas\ height\n\ \ \ \ set\ ss(cw)\ 664\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Canvas\ width\n\ \ \ \ frame\ .ftop\n\ \ \ \ frame\ .fbot\n\ \ \ \ pack\ .fbot\ -side\ bottom\ -fill\ x\n\ \ \ \ pack\ .ftop\ -side\ top\ -expand\ 1\ -fill\ both\n\ \ \ \ catch\ \{image\ create\ photo\ ::img::blank\ -width\ 1\ -height\ 1\}\n\ \ \ \ make_canvas\n\ \n\ \ \ \ frame\ .fstop\ -relief\ sunken\ -bd\ 1\n\ \ \ \ button\ .stop\ -textvariable\ ss(startstop)\ -command\ startstop\ -width\ 5\n\ \ \ \ frame\ .fqbtn\ -relief\ sunken\ -bd\ 1\n\ \ \ \ button\ .qbtn\ -text\ \{\ Quit\ \}\ -command\ exit\n\ \ \ \ button\ .about\ -image\ ::img::blank\ -command\ About\ -highlightthickness\ 0\n\ \ \ \ pack\ .fqbtn\ .fstop\ -side\ right\ -expand\ yes\ -in\ .fbot\n\ \ \ \ pack\ .stop\ -in\ .fstop\ -side\ left\ -expand\ yes\ -padx\ 3m\ -pady\ 2m\n\ \ \ \ pack\ .qbtn\ -in\ .fqbtn\ -side\ left\ -expand\ yes\ -padx\ 3m\ -pady\ 2m\n\ \ \ \ bind\ .stop\ <2>\ juggle\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Single\ step\n\ \ \ \ \n\ \ \ \ scale\ .s1\ -label\ Height\ -orient\ horizontal\ -from\ 1\ -to\ 1000\n\ \ \ \ .s1\ config\ -relief\ ridge\ -showvalue\ 1\ -variable\ ss(v,h)\n\ \ \ \ scale\ .s2\ -label\ \"Flight\ Time\"\ -orient\ horizontal\ -from\ 1\ -to\ 500\n\ \ \ \ .s2\ config\ -relief\ ridge\ -showvalue\ 1\ -variable\ ss(v,flight)\n\ \ \ \ scale\ .s4\ -label\ Balls\ -orient\ horizontal\ -from\ 3\ -to\ 20\n\ \ \ \ .s4\ config\ -relief\ ridge\ -showvalue\ 1\ -variable\ ss(v,num)\n\ \n\ \ \ \ pack\ .s1\ .s2\ .s4\ -side\ left\ -in\ .fbot\n\ \ \ \ bind\ .s1\ \ <ButtonRelease-1>\ \"set_value\ height\"\n\ \ \ \ bind\ .s2\ \ <ButtonRelease-1>\ \"set_value\ flight\"\n\ \ \ \ bind\ .s4\ \ <ButtonRelease-1>\ \"set_value\ balls\"\n\ \n\ \ \ \ frame\ .frb\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Radiobuttons\ for\ patterns\n\ \ \ \ radiobutton\ .cascade\ -text\ \"Cascade\"\ -var\ ss(pattern)\ \\\n\ \ \ \ \ \ \ \ -value\ cascade\ -command\ reinit\ -anchor\ w\n\ \ \ \ radiobutton\ .shower\ -text\ \"Shower\"\ -var\ ss(pattern)\ \\\n\ \ \ \ \ \ \ \ -value\ shower\ -command\ reinit\ -anchor\ w\n\ \ \ \ radiobutton\ .even\ -text\ \"Even\"\ -var\ ss(pattern)\ \\\n\ \ \ \ \ \ \ \ -value\ even\ -command\ reinit\ -anchor\ w\n\ \ \ \ pack\ .frb\ -side\ left\ -in\ .fbot\ -padx\ 1\n\ \ \ \ pack\ .cascade\ .even\ -in\ .frb\ -side\ top\ -expand\ yes\ -anchor\ w\ -fill\ x\n\ \n\ \ \ \ frame\ .fcb\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Checkbuttons\ for\ options\n\ \ \ \ checkbutton\ .crandom\ -text\ \"Perfect\"\ -var\ ss(perfect)\ -anc\ w\n\ \ \ \ checkbutton\ .cback\ -text\ \"Outside\"\ -var\ ss(back)\ -command\ reinit\ -anc\ w\n\ \ \ \ pack\ .fcb\ -side\ left\ -in\ .fbot\ -padx\ 1\n\ \ \ \ pack\ .crandom\ .cback\ -in\ .fcb\ -side\ top\ -expand\ no\ -anchor\ w\ -fill\ x\n\ \ \ \ place\ .about\ -in\ .fbot\ -relx\ 1\ -rely\ 0\ -anchor\ ne\n\ \n\ \ \ \ wm\ withdraw\ .\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Update\ to\ get\ sizes\n\ \ \ \ wm\ geom\ .\ +0+0\n\ \ \ \ wm\ deiconify\ .\n\ \ \ \ wm\ title\ .\ \"Tk\ Juggler\"\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Make_canvas\ -\ Creates\ the\ canvas\ on\ which\ all\ output\ will\ be\ done\n\ #\n\ proc\ make_canvas\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ scrollbar\ .vscroll\ -relief\ sunken\ -command\ \".c\ yview\"\n\ \ \ \ set\ c2\ \[expr\ \{\$ss(cw)\ /\ 2\}\]\n\ \ \ \ canvas\ .c\ -relief\ raised\ -borderwidth\ 2\ -height\ \$ss(ch)\ -width\ \$ss(cw)\ \\\n\ \ \ \ \ \ \ \ -bg\ steelblue3\ -highlightthickness\ 0\n\ \ \ \ .c\ config\ -scrollregion\ \[list\ -\$c2\ -1200\ \$c2\ 500\]\n\ \ \ \ .c\ config\ -yscrollcommand\ \".vscroll\ set\"\ -yscrollincrement\ 1\n\ \ \ \ .c\ config\ -highlightcolor\ \[.c\ cget\ -bg\]\n\ \ \ \ .c\ yview\ moveto\ .4\n\ \ \ \ flagman\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Draws\ are\ flagman\n\ \ \ \ wink\ 0\n\ \n\ \ \ \ pack\ .vscroll\ -in\ .ftop\ -side\ right\ -fill\ y\n\ \ \ \ pack\ .c\ -in\ .ftop\ -fill\ both\ -expand\ 1\n\ \n\ \ \ \ bind\ .c\ <2>\ \".c\ scan\ mark\ %x\ %y\"\n\ \ \ \ bind\ .c\ <B2-Motion>\ \".c\ scan\ drag\ %x\ %y\"\n\ \ \ \ bind\ .c\ <MouseWheel>\ \{%W\ yview\ scroll\ \[expr\ \{-\ (%D\ /\ 120)\ *\ 20\}\]\ units\}\n\ \ \ \ bind\ .c\ <Configure>\ \{Recenter\ %W\ %h\ %w\}\n\ \ \ \ bind\ .\ <Up>\ \ \ \{scaler\ 1\}\n\ \ \ \ bind\ .\ <Down>\ \{scaler\ 0\}\n\ \ \ \ focus\ .c\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ So\ mouse\ wheel\ works\n\ \}\n\ ##+######################################################\n\ #\ \n\ #\ Recenter\ -\ Called\ when\ window\ gets\ resized.\n\ #\ \n\ proc\ Recenter\ \{W\ h\ w\}\ \{\n\ \ \ \ set\ h\ \[expr\ \{\$h\ /\ 2.0\}\]\ \;\ set\ w\ \[expr\ \{\$w\ /\ 2.0\}\]\n\ \ \ \ \$W\ config\ -scrollregion\ \[list\ -\$w\ -1200\ \$w\ 500\]\n\ \}\n\ \n\ ##+#####################################################\n\ #\n\ #\ Move_ball\ -\ Moves\ ball\ WHO\ to\ parameter\ value\ T.\ It\ flies\ in\ a\n\ #\ parabola\ going\ through\ points\ (-w,0),\ (0,height),\ (w,0).\n\ #\n\ proc\ move_ball\ \{t\ w\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ switch\ \$ball(\$w,ss)\ \{\n\ \ \ \ \ \ \ \ \"LR\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Left\ to\ right\ toss\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ >=\ \$ball(\$w,catch)\}\ \{\ \ \ \ \ \ \ \ \;#\ ...just\ got\ caught\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ catch_ball\ \$w\ 1\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ HR\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"HR\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ in\ right\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ >=\ \$ball(\$w,toss)\}\ \{\ \ \ \ \ \ \ \ \ \;#\ ...just\ got\ tossed\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \$ss(HR)\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ toss_ball\ \$w\ 1\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"RL\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Right\ to\ left\ toss\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ ==\ \$ball(\$w,catch)\}\ \{\ \ \ \ \ \ \ \ \;#\ ...just\ got\ caught\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ catch_ball\ \$w\ 0\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ HL\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"HL\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ in\ left\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\$t\ >=\ \$ball(\$w,toss)\}\ \{\ \ \ \ \ \ \ \ \ \;#\ ...just\ got\ tossed\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \$ss(HL)\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ toss_ball\ \$w\ 0\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$t\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"SL\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ in\ left\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$ball(\$w,toss)\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \"HL\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \"SR\"\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ in\ right\ hand\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ ball\$w\ \[tossing\ \$ball(\$w,toss)\ \$w\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$w,ss)\ \"HR\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Tossing\ -\ Figures\ out\ the\ path\ for\ a\ ball:\ x,y\ \n\ #\n\ #\ u\ =\ (2t/sqrt(k)*f\ -\ 1)\n\ #\ x\ =\ w*u\n\ #\ y\ =\ kh\ *\ (1\ -\ u^2)\n\ #\n\ proc\ tossing\ \{time\ who\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ set\ t\ \[expr\ \{\$time\ -\ \$ball(\$who,toss)\}\]\ \ \ \ \ \;#\ Time\ since\ the\ toss\n\ \ \ \ set\ f\ \$ball(\$who,flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Flight\ time\n\ \n\ \ \ \ set\ u\ \[expr\ \{-1\ +\ 2.0\ *\ \$t\ /\ \$f\}\]\ \ \ \ \ \ \ \ \ \ \ \;#\ range\ -1\ to\ 1\n\ \ \ \ set\ x\ \[expr\ \{\$ball(\$who,x)\ +\ ((1\ +\ \$u)/2)\ *\ \$ball(\$who,w)\}\]\n\ \ \ \ set\ y\ \[expr\ \{-(\$ball(\$who,kh)\ *\ (1\ -\ \$u\ *\ \$u))\}\]\;#\ Y\ is\ a\ parabola\n\ \n\ \ \ \ return\ \[list\ \$x\ \$y\]\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Create_hand\ -\ Creates\ a\ new\ hand,\ and\ put\ them\ anywhere\ on\ the\ canvas\n\ #\n\ proc\ create_hand\ \{name\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ .c\ delete\ hand\$name\n\ \ \ \ .c\ create\ arc\ 0\ -\$ss(s)\ \$ss(s)\ \$ss(s)\ -fill\ orange\ -outline\ orange\ \\\n\ \ \ \ \ \ \ \ -tag\ \"hands\ hand\$name\ hand_x\$name\"\ -start\ 0\ -extent\ -180\n\ \ \ \ foreach\ \{x1\ y1\ x2\ y2\}\ \[.c\ bbox\ hand_x\$name\]\ break\n\ \ \ \ set\ color\ \[lindex\ \[.c\ config\ -bg\]\ 4\]\ \ \ \ \ \ \ \ \;#\ Erasure\ color\n\ \ \ \ .c\ create\ arc\ \$x1\ 0\ \$x2\ \$ss(s)\ -fill\ \$color\ -outline\ \"\"\ \\\n\ \ \ \ \ \ \ \ -tag\ \"hands\ hand\$name\ hand_y\$name\"\ -start\ 0\ -extent\ -180\n\ \ \ \ .c\ lower\ hand\$name\n\ \ \ \ .c\ lower\ flagman\n\ \ \ \ place_obj\ hand_x\$name\ \{0\ 0\}\ -1\n\ \ \ \ place_obj\ hand_y\$name\ \{0\ 0\}\ -1\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Create_ball\ -\ Creates\ a\ new\ ball\n\ #\n\ proc\ create_ball\ \{n\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ .c\ delete\ ball\$n\n\ \ \ \ set\ color\ \[lindex\ \$ss(colors)\ 0\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Take\ head\ of\ the\ list\n\ \ \ \ set\ ss(colors)\ \"\[lrange\ \$ss(colors)\ 1\ end\]\ \$color\"\ \;#\ Put\ head\ at\ end\n\ \ \ \ .c\ create\ oval\ -\$ss(s2)\ -\$ss(s2)\ \$ss(s2)\ \$ss(s2)\ -fill\ \$color\ \\\n\ \ \ \ \ \ \ \ -tag\ \"balls\ ball\$n\"\n\ \ \ \ #.c\ create\ text\ 0\ 0\ -text\ \$n\ -tag\ \"balls\ ball\$n\"\ -anchor\ c\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ New_balls\ -\ Deletes\ then\ recreates\ the\ balls\n\ #\n\ proc\ new_balls\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \}\n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Update\ the\ display\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Startstop\ -\ Manipulates\ the\ start\ /\ stop\ button\n\ #\n\ proc\ startstop\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ if\ \{\$ss(startstop)\ ==\ \"Start\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(startstop)\ \"Stop\"\n\ \ \ \ \ \ \ \ set\ ss(stop)\ 0\n\ \ \ \ \ \ \ \ after\ 1\ juggle\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ ss(startstop)\ \"Start\"\n\ \ \ \ \ \ \ \ set\ ss(stop)\ 1\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Set_value\n\ #\n\ #\ Handles\ changing\ the\ values\ of\ any\ juggling\ parameter.\ We\ late-bind\n\ #\ so\ we\ only\ change\ on\ button\ release.\n\ #\n\ proc\ set_value\ who\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ if\ \{\$who\ ==\ \"height\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(h)\ \$ss(v,h)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Just\ get\ the\ height\n\ \ \ \ \ \ \ \ return\n\ \ \ \ \}\ elseif\ \{\$who\ ==\ \"flight\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(flight)\ \$ss(v,flight)\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Get\ new\ flight\ time\n\ \ \ \ \}\ elseif\ \{\$who\ ==\ \"balls\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(num)\ \$ss(v,num)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ New\ number\ of\ balls\n\ \ \ \ \}\n\ \ \ \ adjust\n\ \ \ \ reinit\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Update\ global\ values\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Reinit\ --\ Initializes\ the\ ss\ variables\ for\ the\ balls\n\ #\n\ proc\ reinit\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ set\ ss(t)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ at\ time\ 0\n\ \ \ \ set\ ss(h)\ \$ss(v,h)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Height\n\ \ \ \ set\ ss(flight)\ \$ss(v,flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Flight\ time\n\ \ \ \ set\ ss(num)\ \$ss(v,num)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ How\ many\ balls\n\ \ \ \ set\ ss(w)\ \[expr\ \{round(\$ss(scale)\ *\ 140)\}\]\ \ \;#\ Width\ of\ hands\n\ \ \ \ .cback\ config\ -state\ normal\n\ \n\ \ \ \ set\ ss(LR)\ HR\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ State\ transitions\n\ \ \ \ set\ ss(RL)\ HL\n\ \ \ \ set\ ss(HR)\ RL\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Even\ does\ weirdness\n\ \ \ \ set\ ss(HL)\ LR\n\ \n\ \ \ \ \$ss(pattern)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ up\ for\ given\ pattern\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Best\ -\ Sets\ up\ the\ hold\ time\ for\ N\ balls\n\ #\n\ #\ empty\ (e)\ =\ \ \ P3\ \ \ -\ \ \ \ BALL(n-1)\n\ #\ \ \ \ \ \ \ \ \ \ \ =\ (2f+h)\ -\ (n-1)(2f+2h)/n\n\ #\ \ \ \ \ \ \ \ \ \ \ =\ (2f\ -\ h(n-2))\ /\ n\n\ #\ hold\ (h)\ \ =\ (2f\ -\ en)\ \ /\ (n-2)\n\ #\n\ #\ Also\ h\ +\ e\ =\ time\ between\ balls\ =\ (2f+2h)/n\n\ #\n\ #\ Constraints:\ at\ the\ start\ the\ last\ ball\ must\ be\ in\ the\ air\n\ #\ \ \ \ \ BALL(n-1)\ \ <\ P3\n\ #\ \ ==>\ \ \ \ \ hold\ \ <\ 2f\ /\ (n-2)\n\ #\ \ ==>\ \ \ \ \ empty\ <\ 2f\ /\ n\n\ #\ \ alt.\ hold\ time\ less\ than\ time\ between\ balls\n\ #\ \ \ \ \ hold\ \ \ \ \ \ \ <\ (2f+2h)/n\n\ #\ \ \ \ \ hold\ \ \ \ \ \ \ <\ 2f\ /\ (n-2)\n\ #\n\ #\ Best:\ e\ ==\ h\ ==>\ h\ =\ f\ /\ (n-1)\n\ #\n\ #\ To\ compute:\ the\ last\ ball\ starts\ at\ the\ exact\ moment\ when\ the\ first\ ball\n\ #\ is\ launched.\ The\ hand\ is\ empty\ until\ the\ ball\ lands.\n\ #\n\ proc\ best\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ set\ ss(hold)\ \$ss(flight)\n\ \ \ \ if\ \{\$ss(num)\ >\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(hold)\ \[expr\ \{round(1.0\ *\ \$ss(flight)\ /\ (\$ss(num)\ -\ 1))\}\]\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Move_hands\ -\ Positions\ the\ hands\ correctly.\n\ #\n\ proc\ move_hands\ \{\}\ \{\n\ \ \ \ global\ hand\ ss\n\ \n\ \ \ \ if\ \{\[.c\ find\ withtag\ hands\]\ ==\ \"\"\}\ return\ \ \;#\ No\ hands,\ do\ nothing\n\ \ \ \ .c\ delete\ arms\n\ \ \ \ foreach\ h\ \{0\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ where\ \[where_hands\ \$ss(t)\ \$h\]\ \ \ \ \ \ \ \;#\ Where\ it\ belongs\n\ \ \ \ \ \ \ \ foreach\ \{x\ y\}\ \$where\ break\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x\ -\ 1\ -\ \$h\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Fudge\ factor\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ 1\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Fudge\ factor\n\ \ \ \ \ \ \ \ place_obj\ hand\$h\ \[list\ \$x\ \$y\]\ -1\ \ \ \ \ \ \ \ \;#\ Put\ into\ place\n\ \n\ \ \ \ \ \ \ \ set\ w\ \[expr\ \{3\ *\ \$ss(s)\ /\ 4\}\]\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ +\ \$w\}\]\n\ \ \ \ \ \ \ \ .c\ create\ line\ \$ss(elbowx,\$h)\ \$ss(elbowy,\$h)\ \$x\ \$y\ -tag\ arms\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -fill\ gray95\ -width\ \$w\n\ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ if\ \{\$hand(\$h,ss)\ ==\ \"full\"\}\ \{\ \ \ \ \ \ \ \ \ \ \ \;#\ Does\ it\ have\ a\ ball\ in\ it?\n\ \ \ \ \ \ \ \ \ \ \ \ set\ b\ ball\$hand(\$h,ball)\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Yep,\ then\ move\ the\ ball\ also\n\ \ \ \ \ \ \ \ \ \ \ \ place_obj\ \$b\ \$where\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ .c\ lower\ arms\ hands\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Where_hands\ -\ Determines\ where\ H\ hand\ should\ be\ at\ time\ T\n\ #\n\ proc\ where_hands\ \{t\ h\}\ \{\n\ \ \ \ global\ hand\ ss\n\ \n\ \ \ \ set\ d\ \[expr\ \{\$hand(\$h,duration)\ -\ 1\}\]\n\ \ \ \ if\ \{\$d\ <=\ 0\}\ \{set\ d\ 1\}\n\ \n\ \ \ \ if\ \{\$hand(\$h,ss)\ ==\ \"full\"\}\ \{\n\ \ \ \ \ \ \ \ set\ p\ \[expr\ \{1.0\ -\ (1.0*\$hand(\$h,toss)\ -\ \$t\ -1)\ /\ \$d\}\]\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$hand(\$h,y)\ -\ \$ss(s)\ *\ (4\ *\ (\$p\ *\ (\$p\ -\ 1)))\}\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ p\ \[expr\ \{(1.0\ *\ \$hand(\$h,catch)\ -\ \$t)\ /\ \$hand(\$h,duration)\}\]\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$ss(s2)\ *\ (4\ *\ (\$p\ *\ (\$p\ -\ 1)))\}\]\n\ \ \ \ \}\n\ \ \ \ set\ w\ \[expr\ \{\$ss(w)\ +\ \$ss(shift)\}\]\ \ \ \ \ \ \ \ \ \ \;#\ Biggest\ width\n\ \n\ \ \ \ if\ \$h\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ X\ depends\ on\ which\ hand\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \ \{\$w\ -\ 2\ *\ \$p\ *\ \$ss(shift)\}\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{-\$w\ +\ 2\ *\ \$p\ *\ \$ss(shift)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ set\ x\ \[expr\ \{round(\$x)\}\]\n\ \ \ \ set\ y\ \[expr\ \{round(\$y)\}\]\n\ \ \ \ return\ \[list\ \$x\ \$y\]\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Adjust\ -\ Adjust\ the\ flight\ &\ hold\ time\ so\ that\ their\ sum\ is\ a\n\ #\ multiple\ of\ the\ number\ of\ balls.\ This\ way,\ we\ get\ no\ round\ off\n\ #\ errors\ in\ computing\ where\ the\ balls\ should\ start.\n\ #\n\ proc\ adjust\ \{\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ if\ \{\$ss(pattern)\ !=\ \"cascade\"\}\ return\n\ \ \ \ set\ n\ \$ss(num)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Number\ of\ balls\n\ \ \ \ set\ f\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Flight\ time\n\ \ \ \ set\ h\ \$ss(hold)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ time\n\ \n\ \ \ \ set\ r\ \[expr\ \{(\$f\ +\ \$h)\ %\ \$n\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ How\ much\ we're\ off\ by\n\ \n\ \ \ \ if\ \{\$r\ !=\ 0\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$r\ >\ \$n\ /\ 2\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ r\ \[expr\ \{\$r\ -\ \$n\}\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ ss(flight)\ \[expr\ \{\$ss(flight)\ -\ \$r\}\]\ \;#\ Adjust\ flight\ down\n\ \ \ \ \ \ \ \ set\ ss(v,flight)\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ the\ scale\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Toss_ball\ -\ Called\ when\ a\ ball\ has\ just\ been\ tossed.\ We\ need\ to\n\ #\ update\ the\ hand\ info.\n\ #\n\ proc\ toss_ball\ \{who\ which\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ set\ next\ \[next_ball\ \$who\ \$which\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Next\ ball\ to\ land\ here\n\ \ \ \ set\ hand(\$which,ss)\ \ \ \ \ \ \ \ \ empty\ \ \ \ \ \ \ \ \ \ \ \;#\ No\ longer\ holding\ a\ ball\n\ \ \ \ set\ hand(\$which,ball)\ \ \ \ \ \ \ -1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ hand\n\ \ \ \ set\ hand(\$which,catch)\ \ \ \ \ \ \$ball(\$next,catch)\ \;#\ Next\ ball\ to\ land\ here\n\ \ \ \ set\ hand(\$which,duration)\ \ \ \[expr\ \{\$ball(\$next,catch)\ -\ \$ss(t)\}\]\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Catch_ball\ -\ Called\ when\ ball\ WHO\ lands\ in\ hand\ WHICH.\ Generates\ a\n\ #\ new\ toss\ and\ updates\ the\ hand\ information.\n\ #\n\ proc\ catch_ball\ \{who\ which\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ set\ dirs(RL)\ to_right\n\ \ \ \ set\ dirs(LR)\ to_left\n\ \n\ \ \ \ set\ next\ \[next_ball\ \$who\ \$which\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Next\ ball\ to\ land\ here\n\ \n\ \ \ \ set\ when\ \[expr\ \{(\$ss(t)\ +\ \$ball(\$next,catch))\ /2.0\}\]\;#\ Time\ for\ us\ to\ leave\n\ \ \ \ set\ when\ \[expr\ \{round(\$when)\}\]\n\ \ \ \ if\ \{\$when\ ==\ \$ss(t)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Problem\ when\ WHO\ ==\ NEXT\n\ \ \ \ \ \ \ \ set\ when\ \[expr\ \{\$ss(t)\ +\ \$ss(hold)\}\]\n\ \ \ \ \}\n\ \ \ \ if\ \{0\ &&\ \$which\ ==\ 0\}\ \{\n\ \ \ \ \ \ \ \ puts\ -nonewline\ \"catch\ \$who:\ time\ \$ss(t)\ catch(\$next)\ \"\n\ \ \ \ \ \ \ \ puts\ -nonewline\ \"\$ball(\$next,catch)\ when\ \$when\ \"\n\ \ \ \ \ \ \ \ puts\ \"when:\ +\[expr\ \{\$when\ -\ \$ss(t)\}\]\"\n\ \ \ \ \}\n\ \n\ \ \ \ new_toss\ \$who\ \$when\ \$dirs(\$ball(\$who,ss))\ \$which\n\ \n\ \ \ \ set\ hand(\$which,ss)\ \ \ \ \ \ \ \ \ full\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Holding\ a\ ball\n\ \ \ \ set\ hand(\$which,ball)\ \ \ \ \ \ \ \$who\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ hand\n\ \ \ \ set\ hand(\$which,toss)\ \ \ \ \ \ \ \$ball(\$who,toss)\;#\ When\ we\ throw\ it\n\ \ \ \ set\ hand(\$which,duration)\ \ \ \[expr\ \{\$ball(\$who,toss)\ -\ \$ss(t)\}\]\n\ \n\ \ \ \ set\ u\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[expr\ \{-1\ +\ 2.0/\$ball(\$who,flight)\}\]\n\ \ \ \ set\ y\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[expr\ \{\$ball(\$who,kh)\ *\ (1\ -\ \$u*\$u)\}\]\n\ \ \ \ set\ hand(\$which,y)\ \ \ \ \ \ \ \ \ \ \$y\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Next_ball\ -\ Returns\ the\ next\ ball\ after\ WHO\ to\ land\ in\ hand\ WHICH\n\ #\n\ proc\ next_ball\ \{w\ h\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ incr\ w\ -1\n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"even\"\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$w\ ==\ -1\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ w\ \[expr\ \{\$ss(n2)\ -\ 1\}\]\n\ \ \ \ \ \ \ \ \}\ elseif\ \{\$w\ ==\ \$ss(n2)\ -\ 1\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ w\ \[expr\ \{\$ss(num)\ -\ 1\}\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\ elseif\ \{\$w\ ==\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ w\ \[expr\ \{\$ss(num)\ -\ 1\}\]\n\ \ \ \ \}\n\ \ \ \ return\ \$w\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ New_toss\ -\ Sets\ up\ ball\ WHO\ for\ being\ tossed\ again\ at\ time\ WHEN\n\ #\ in\ direction\ DIR.\n\ #\ new\ height\ =\ k\ *\ height\n\ #\ new\ flight\ =\ sqrt(k)\ *\ flight\n\ #\n\ proc\ new_toss\ \{who\ when\ dir\ xhand\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ set\ k\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Scaling\ factor\n\ \ \ \ set\ f\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Total\ flight\ time\n\ \ \ \ set\ x\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Overlap\ into\ holding\ time\n\ \n\ \ \ \ if\ \{!\ \$ss(perfect)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Should\ we\ add\ randomness?\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{int(rand()\ *\ \$ss(hold))\}\]\ \ \;#\ Use\ this\ much\ of\ hold\ time\n\ \ \ \ \ \ \ \ set\ f\ \[expr\ \{\$ss(flight)\ +\ \$x\}\]\ \ \ \ \ \ \ \ \ \;#\ New\ flight\ time\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{1.0\ *\ \$f\ /\ \$ss(flight)\}\]\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{\$k\ *\ \$k\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ if\ \{\$dir\ ==\ \"to_right\"\ &&\ \$ss(pattern)\ ==\ \"shower\"\}\ \{\n\ \ \ \ \ \ \ \ set\ f\ \$ss(flight2)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Special\ low\ path\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{1.0\ *\ \$f\ /\ \$ss(flight)\}\]\n\ \ \ \ \ \ \ \ set\ k\ \[expr\ \{\$k\ *\ \$k\}\]\n\ \ \ \ \}\n\ \ \ \ set\ ball(\$who,k)\ \ \ \ \ \ \$k\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Random\ height\ scale\ factor\n\ \ \ \ set\ ball(\$who,toss)\ \ \ \$when\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Time\ of\ the\ toss\n\ \ \ \ set\ ball(\$who,flight)\ \$f\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ New\ flight\ time\n\ \ \ \ set\ ball(\$who,catch)\ \ \[expr\ \{\$when\ +\ \$f\}\]\ \ \ \;#\ Time\ of\ catch\n\ \ \ \ set\ ball(\$who,kh)\ \ \ \ \ \[expr\ \{\$k\ *\ \$ss(h)\}\]\ \ \;#\ How\ high\ this\ toss\ goes\n\ \n\ \ \ \ set\ ball(\$who,w)\ \ \ \ \ \ \[expr\ \{2\ *\ \$ss(w)\}\]\n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"even\"\}\ \{\n\ \ \ \ \ \ \ \ set\ ball(\$who,w)\ \ \[expr\ \{-2*\$ss(shift)\}\]\n\ \ \ \ \}\n\ \ \ \ set\ ball(\$who,x)\ \ \ \ \ \ \[expr\ \{-(\$ss(w)\ -\ \$ss(shift))\}\]\n\ \ \ \ if\ \{\$xhand\ ==\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ ball(\$who,w)\ \ \[expr\ \{-\$ball(\$who,w)\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$who,x)\ \ \[expr\ \{-\$ball(\$who,x)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"shower\"\ &&\ \$ss(back)\ ==\ 1\}\ \{\n\ \ \ \ \ \ \ \ set\ ball(\$who,w)\ \ \[expr\ \{-\$ball(\$who,w)\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$who,x)\ \ \[expr\ \{-\$ball(\$who,x)\}\]\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Dump\ -\ Dumps\ out\ the\ ss\ of\ a\ ball\ or\ all\ the\ balls\n\ #\n\ proc\ dump\ \{\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ puts\ \"\"\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ set\ msg\ \"Ball\ \$i:\ \$ball(\$i,ss)\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ toss\ \[format\ %4d\ \$ball(\$i,toss)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ catch\[format\ %4d\ \$ball(\$i,catch)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ flight\[format\ %4d\ \$ball(\$i,flight)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ x\ \ \[format\ %4d\ \$ball(\$i,x)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ w\ \ \[format\ %4d\ \$ball(\$i,w)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ k\ \ \$ball(\$i,k)\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ kh\ \$ball(\$i,kh)\"\n\ \ \ \ \ \ \ \ puts\ \$msg\n\ \ \ \ \}\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ 2\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ set\ msg\ \"Hand\ \$i:\ \[format\ %5s\ \$hand(\$i,ss)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ ball\ \[format\ %2s\ \$hand(\$i,ball)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ toss\ \[format\ %4d\ \$hand(\$i,toss)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ catch\ \[format\ %4d\ \$hand(\$i,catch)\]\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ duration\ \$hand(\$i,duration)\"\n\ \ \ \ \ \ \ \ set\ msg\ \"\$msg\ \ y\ \ \$hand(\$i,y)\"\n\ \ \ \ \ \ \ \ puts\ \$msg\n\ \ \ \ \}\n\ \ \ \ puts\ \"time:\ \$ss(t)\"\n\ \ \ \ puts\ \"\"\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Init_ball\ -\ Given\ the\ starting\ position\ of\ a\ ball,\ it\ determines\ the\n\ #\ ss\ the\ ball\ is\ in\ and\ what\ its\ toss/catch\ values\ should\ be.\n\ #\n\ proc\ init_ball\ \{who\ time\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ if\ \{\$time\ <\ \$ss(p1)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Left\ to\ right\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ LR\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{-\$time\}\]\ to_right\ 0\n\ \ \ \ \}\ elseif\ \{\$time\ <\ \$ss(p2)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ right\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ SR\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ HR\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{\$ss(p2)\ -\ \$time\}\]\ to_left\ 1\n\ \ \ \ \}\ elseif\ \{\$time\ <\ \$ss(p3)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Right\ to\ left\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ RL\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{\$ss(p2)\ -\ \$time\}\]\ to_left\ 1\n\ \ \ \ \}\ elseif\ \{\$time\ <\ \$ss(p4)\}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Hold\ left\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ SL\n\ \ \ \ \ \ \ \ set\ ball(\$who,ss)\ \ \ \ \ \ \ HL\n\ \ \ \ \ \ \ \ new_toss\ \$who\ \[expr\ \{\$ss(p4)\ -\ \$time\}\]\ to_right\ 0\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ puts\ \"ERROR:\ init_ball\ \$who\ \$time:\ time\ out\ of\ range\"\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Startup\ -\ Re-init\ the\ balls\ so\ that\ they\ all\ start\ in\ the\ hands.\n\ #\ Not\ fully\ working\ yet.\n\ #\n\ proc\ startup\ \{\}\ \{\n\ \ \ \ global\ ss\ ball\n\ \n\ \ \ \ set\ newss(LR)\ SL\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Cheap\ way\ to\ avoid\ an\ if\n\ \ \ \ set\ newss(HR)\ SR\n\ \ \ \ set\ newss(RL)\ SR\n\ \ \ \ set\ newss(HL)\ SL\n\ \n\ \ \ \ set\ max\ \$ss(t)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Find\ longest\ in\ air\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$ball(\$i,toss)\ <\ \$max\}\ \{\ set\ max\ \$ball(\$i,toss)\ \}\n\ \ \ \ \}\n\ \n\ \ \ \ set\ max\ \[expr\ \{\$ss(t)\ -\ \$max\}\]\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\ \ \ \ \;#\ Adjust\ everyone\ by\ max\n\ \ \ \ \ \ \ \ set\ ball(\$i,toss)\ \ \ \ \ \ \ \[expr\ \{\$ball(\$i,toss)\ +\ \$max\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$i,catch)\ \ \ \ \ \ \[expr\ \{\$ball(\$i,toss)\ +\ \$ball(\$i,flight)\}\]\n\ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ \$newss(\$ball(\$i,ss))\n\ \n\ \ \ \ \ \ \ \ move_ball\ 0\ \$i\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Init_hands\ -\ Initializes\ where\ the\ hands\ are\n\ #\n\ proc\ init_hands\ \{\}\ \{\n\ \ \ \ global\ ball\ ss\ hand\n\ \n\ \ \ \ if\ \{\$ss(pattern)\ ==\ \"shower\"\}\ return\n\ \n\ \ \ \ set\ hand(0,y)\ 20\n\ \ \ \ set\ hand(1,y)\ 20\n\ \n\ \ \ \ toss_ball\ 0\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Just\ tossed\ off\ ball\ 0\n\ \ \ \ if\ \{\[expr\ \{(\$ss(num)\ %\ 2)\ ==\ 0\}\]\}\ \{\n\ \ \ \ \ \ \ \ toss_ball\ \[expr\ \{\$ss(num)\ /\ 2\}\]\ 1\n\ \ \ \ \ \ \ \ return\n\ \ \ \ \}\n\ \n\ \ \ \ set\ hand(0,toss)\ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ When\ ball\ gets\ tossed\n\ \ \ \ set\ who\ \[expr\ \{\$ss(num)\ /\ 2\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ the\ right\ hand\n\ \ \ \ set\ hand(1,ss)\ full\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ It\ has\ a\ ball\ in\ it\n\ \ \ \ set\ hand(1,ball)\ \ \$who\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Which\ ball\n\ \ \ \ set\ hand(1,toss)\ \ \$ball(\$who,toss)\ \ \ \ \ \ \ \ \ \ \;#\ When\ toss\ will\ happen\n\ \ \ \ set\ hand(1,catch)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ When\ next\ ball\ lands\n\ \ \ \ set\ hand(1,duration)\ \$ss(hold)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ How\ long\ we\ hold\ ball\ for\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Cascade\ -\ Sets\ up\ balls\ &\ hands\ for\ the\ cascade\ pattern\n\ #\n\ proc\ cascade\ \{\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ best\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ up\ HOLD\n\ \ \ \ adjust\n\ \ \ \ set\ ss(pattern)\ cascade\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Indicate\ this\ pattern\n\ \ \ \ set\ ss(t)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Start\ at\ time\ 0\n\ \ \ \ set\ ss(shift)\ \[expr\ \{(1\ -\ 2*\$ss(back))\ *\ \$ss(s)\}\]\n\ \n\ \ \ \ set\ ss(p1)\ \$ss(flight)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Cycle\ timings\n\ \ \ \ set\ ss(p2)\ \[expr\ \{\$ss(p1)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(p3)\ \[expr\ \{\$ss(p2)\ +\ \$ss(flight)\}\]\n\ \ \ \ set\ ss(p4)\ \[expr\ \{\$ss(p3)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(total)\ \$ss(p4)\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \ \ \ \ init_ball\ \$i\ \[expr\ \{\$ss(total)\ *\ \$i\ /\ \$ss(num)\}\]\n\ \ \ \ \}\n\ \ \ \ #startup\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ into\ start\ position\n\ \n\ \ \ \ create_hand\ 0\n\ \ \ \ create_hand\ 1\n\ \ \ \ init_hands\n\ \n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ them\ in\ position\n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Don't\ ask,\ it\ looks\ better\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Shower\ -\ Sets\ up\ for\ the\ shower\ pattern\n\ #\n\ proc\ shower\ \{\}\ \{\n\ \ \ \ global\ ball\ ss\n\ \n\ \ \ \ set\ ss(pattern)\ shower\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Indicate\ this\ pattern\n\ \ \ \ set\ ss(t)\ 0\n\ \ \ \ set\ ss(shift)\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Get\ rid\ of\ the\ shift\n\ \ \ \ .c\ delete\ hands\n\ \n\ \ \ \ ##\ total\ =\ f\ +\ 2hold\ +\ f2\n\ \ \ \ ##\ f2\ =\ total/n\ \ \ \ \ \ \ \ \ \ \ \ \ \ ==>\ f/(n-2)\n\ \ \ \ ##\ hold\ =\ 1/2\ *\ (total\ /\ n)\ \ ==>\ f/2(n-2)\n\ \ \ \ set\ ss(flight2)\ \ \ \ \ \[expr\ \{round(\$ss(flight)\ /\ (\$ss(num)\ -\ 2.0))\}\]\n\ \ \ \ if\ \{\$ss(flight2)\ <=\ 1\}\ \{\ set\ ss(flight2)\ 2\ \}\n\ \ \ \ if\ \{\$ss(flight2)\ >=\ 5\}\ \{\ set\ ss(flight2)\ 4\ \}\n\ \ \ \ set\ ss(hold)\ \ \ \ \ \ \ \ \[expr\ \{round(\$ss(flight2)\ /\ 2.0)\}\]\n\ \n\ \ \ \ set\ ss(p1)\ \ \$ss(flight2)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Cycle\ timings\n\ \ \ \ set\ ss(p2)\ \ \[expr\ \{\$ss(p1)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(p3)\ \ \[expr\ \{\$ss(p2)\ +\ \$ss(flight)\}\]\n\ \ \ \ set\ ss(p4)\ \ \[expr\ \{\$ss(p3)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ ss(total)\ \ \ \ \ \ \ \$ss(p4)\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \ \ \ \ init_ball\ \$i\ \[expr\ \{\$ss(total)\ *\ \$i\ /\ \$ss(num)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ them\ in\ position\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Even\ -\ Sets\ up\ for\ even\ ball\ pattern\n\ #\n\ proc\ even\ \{\}\ \{\n\ \ \ \ global\ ball\ hand\ ss\n\ \n\ \ \ \ set\ ss(pattern)\ even\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Indicate\ this\ pattern\n\ \ \ \ set\ ss(t)\ 0\n\ \ \ \ set\ ss(shift)\ \[expr\ \{(1\ -\ 2*\$ss(back))\ *\ 2*\$ss(s)\}\]\ \;#\ Bigger\ shift\n\ \ \ \ set\ ss(w)\ \[expr\ \{round(\$ss(scale)\ *\ 110)\}\]\ \ \;#\ Width\ of\ hands\n\ \n\ \ \ \ set\ ss(HR)\ LR\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Change\ the\ transitions\n\ \ \ \ set\ ss(HL)\ RL\n\ \n\ \ \ \ set\ ss(hold)\ \[expr\ \{\$ss(flight)\ /\ (\$ss(num)\ -\ 1)\}\]\n\ \ \ \ set\ ss(total)\ \[expr\ \{\$ss(flight)\ +\ \$ss(hold)\}\]\n\ \ \ \ set\ n2\ \[expr\ \{round(\$ss(num)\ /\ 2.0)\}\]\ \ \ \ \ \ \ \;#\ Balls\ in\ left\ hand\n\ \ \ \ set\ n3\ \[expr\ \{\$ss(num)\ -\ \$n2\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Balls\ in\ right\ hand\n\ \ \ \ set\ ss(n2)\ \$n2\n\ \n\ \ \ \ .c\ delete\ balls\n\ \ \ \ for\ \{set\ i\ 0\}\ \{\$i\ <\ \$n2\}\ \{incr\ i\}\ \{\ \ \ \ \ \ \ \ \ \;#\ Left\ hand\n\ \ \ \ \ \ \ \ create_ball\ \$i\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ New\ ball\n\ \ \ \ \ \ \ \ set\ t\ \[expr\ \{-\$ss(total)\ *\ \$i\ /\ \$n2\}\]\ \ \ \;#\ When\ it\ got\ tossed\n\ \ \ \ \ \ \ \ new_toss\ \$i\ \$t\ xxx\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ in\ then\ toss\ values\n\ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ RL\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Reset\ the\ ss\ info\n\ \ \ \ \ \ \ \ if\ \[expr\ \{\$t\ >\ \$ss(flight)\}\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i2,ss)\ SL\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i2,ss)\ HL\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \n\ \ \ \ set\ offset\ \[expr\ \{\$n2\ ==\ \$n3\ ?\ \$ss(hold)\ :\ 0\}\]\n\ \ \ \ for\ \{set\ i\ \$n2\}\ \{\$i\ <\ \$ss(num)\}\ \{incr\ i\}\ \{\ \ \;#\ Right\ hand\n\ \ \ \ \ \ \ \ set\ i2\ \[expr\ \{\$i\ -\ \$n2\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Ball\ in\ other\ hand\n\ \n\ \ \ \ \ \ \ \ create_ball\ \$i\n\ \ \ \ \ \ \ \ set\ t\ \[expr\ \{-\$ss(total)\ *\ \$i2\ /\ \$n3\}\]\ \ \;#\ When\ it\ got\ tossed\n\ \ \ \ \ \ \ \ set\ t\ \[expr\ \{-\$offset\ +\ \$t\}\]\ \ \ \ \ \ \ \ \ \ \ \ \;#\ Offset\ it\ a\ little\n\ \ \ \ \ \ \ \ new_toss\ \$i\ \$t\ xxx\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ in\ the\ toss\ values\n\ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ LR\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Reset\ the\ ss\ info\n\ \ \ \ \ \ \ \ if\ \[expr\ \{\$t\ >\ \$ss(flight)\}\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ SR\n\ \ \ \ \ \ \ \ \ \ \ \ set\ ball(\$i,ss)\ HR\n\ \ \ \ \ \ \ \ \}\n\ \n\ \ \ \ \}\n\ \ \ \ create_hand\ 0\n\ \ \ \ create_hand\ 1\n\ \ \ \ toss_ball\ 0\ 0\n\ \ \ \ toss_ball\ \$n2\ 1\n\ \n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Put\ them\ in\ position\n\ \ \ \ juggle\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Don't\ ask,\ it\ looks\ better\n\ \}\n\ proc\ wink\ \{onoff\}\ \{\n\ \ \ \ catch\ \{after\ cancel\ \$::ss(wink)\}\n\ \ \ \ if\ \{\$onoff\}\ \{\n\ \ \ \ \ \ \ \ .c\ lower\ reye\n\ \ \ \ \ \ \ \ .c\ raise\ wink\ flagman\n\ \ \ \ \ \ \ \ set\ ::ss(wink)\ \[after\ 500\ \{wink\ 0\}\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ .c\ lower\ wink\n\ \ \ \ \ \ \ \ .c\ raise\ reye\ flagman\n\ \ \ \ \ \ \ \ set\ delay\ \[expr\ \{int(1000\ *\ (10\ +\ 40*rand()))\}\]\n\ \ \ \ \ \ \ \ set\ ::ss(wink)\ \[after\ \$delay\ \{wink\ 1\}\]\n\ \ \ \ \}\n\ \}\n\ ##+#####################################################\n\ #\n\ #\ Place_obj\n\ #\n\ #\ Moves\ OBJ\ to\ absolute\ coordinates\ (x,y).\ If\ center\ is\ 0\ then\ the\n\ #\ top\ left\ corner\ moves\ to\ (x,y).\ If\ center\ is\ 1\ then\ the\ object\ is\n\ #\ centered\ at\ (x,y).\ If\ center\ is\ -1,\ then\ only\ centered\ in\ x.\n\ #\n\ proc\ place_obj\ \{obj\ xy\ \{center\ 1\}\}\ \{\n\ \ \ \ global\ ss\n\ \n\ \ \ \ foreach\ \{x\ y\}\ \$xy\ break\n\ \ \ \ set\ bb\ \[.c\ bbox\ \$obj\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Where\ it\ is\n\ \ \ \ set\ x\ \[expr\ \{\$x\ -\ \$ss(s2)\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Center\ at\ this\ point\n\ \ \ \ if\ \{\$center\ !=\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ \$ss(s2)\}\]\n\ \ \ \ \}\n\ \n\ \ \ \ set\ dx\ \[expr\ \{\$x\ -\ \[lindex\ \$bb\ 0\]\}\]\ \ \ \ \ \ \ \ \ \;#\ Delta\ in\ X\n\ \ \ \ set\ dy\ \[expr\ \{\$y\ -\ \[lindex\ \$bb\ 1\]\}\]\ \ \ \ \ \ \ \ \ \;#\ Delta\ in\ Y\n\ \n\ \ \ \ .c\ move\ \$obj\ \$dx\ \$dy\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Move\ into\ place\n\ \}\n\ proc\ About\ \{\}\ \{\n\ \ \ \ tk_messageBox\ -icon\ info\ -parent\ .\ -title\ \"About\ TkJuggler\"\ \\\n\ \ \ \ \ \ \ \ -message\ \"Tk\ Juggler\\n\\nby\ Keith\ Vetter\\nNovember,\ 2002\"\n\ \}\n\ proc\ flagman\ \{\}\ \{\n\ \ \ \ #\ stolen\ from\ http://wiki.tcl.tk/3208\n\ \ \ \ .c\ create\ rect\ \{-5000\ 110\ 5000\ 5000\}\ -fill\ grey\ -outline\ grey\ -tag\ flagman\n\ \ \ \ .c\ create\ poly\ \{-80\ 280\ -20\ 280\ 0\ 80\ 20\ 280\ 80\ 280\ 100\ -136\ 0\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -160\ -100\ -136\}\ -fill\ white\ -tag\ flagman\n\ \ \ \ .c\ create\ oval\ \{-40\ -236\ 40\ -140\}\ -fill\ orange\ \ -outline\ orange\ -tag\ flagman\n\ \ \ \ .c\ create\ line\ \{-16\ -200\ -16\ -188\}\ -tag\ \{flagman\ reye\}\n\ \ \ \ .c\ create\ line\ \{-8\ -194\ -24\ -194\}\ -tag\ \{flagman\ wink\}\n\ \ \ \ .c\ create\ line\ \{16\ \ -200\ \ 16\ -188\}\ -tag\ flagman\n\ \ \ \ .c\ create\ arc\ -24\ -216\ 24\ -160\ -start\ 210\ -extent\ 125\ -style\ arc\ \\\n\ \ \ \ \ \ \ \ -tag\ flagman\n\ \ \ \ .c\ create\ rect\ \{-36\ -236\ 36\ -216\}\ -fill\ white\ -outline\ white\ -tag\ flagman\n\ \n\ \ \ \ .c\ create\ poly\ \{-80\ -120\ -100\ -120\ -100\ 0\ -60\ 0\ -60\ -120\}\ -fill\ grey95\ \\\n\ \ \ \ \ \ \ \ -tag\ flagman\n\ \ \ \ .c\ create\ poly\ \{80\ -120\ 100\ -120\ \ 100\ 0\ \ 60\ 0\ 60\ -120\}\ -fill\ grey95\ \\\n\ \ \ \ \ \ \ \ -tag\ flagman\n\ \ \ \ .c\ lower\ wink\n\ \n\ \ \ \ array\ set\ ::ss\ \{elbowx,0\ -80\ elbowy,0\ -10\ elbowx,1\ 80\ elbowy,1\ -10\}\n\ \}\n\ proc\ scaler\ \{bigger\}\ \{\n\ \ \ \ global\ ss\n\ \ \ \ \n\ \ \ \ if\ \{\$bigger\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$ss(scale)\ >\ 2\}\ return\n\ \ \ \ \ \ \ \ set\ f\ 1.25\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ if\ \{\$ss(scale)\ <\ .15\}\ return\n\ \ \ \ \ \ \ \ set\ f\ .8\n\ \ \ \ \}\n\ \ \ \ .c\ scale\ all\ 0\ 0\ \$f\ \$f\n\ \n\ \ \ \ foreach\ w\ \{scale\ s\ s2\ w\ v,h\ elbowx,0\ elbowx,1\}\ \{\n\ \ \ \ \ \ \ \ set\ ss(\$w)\ \[expr\ \{\$ss(\$w)\ *\ \$f\}\]\n\ \ \ \ \}\n\ \ \ \ set\ ss(v,flight)\ \[expr\ \{round(\$ss(v,flight)\ /\ \$f)\}\]\n\ \ \ \ adjust\n\ \ \ \ reinit\n\ \}\n\ ##+##############################################################\n\ #################################################################\n\ #################################################################\n\ init\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ One\ time\ inits\n\ display\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Set\ up\ all\ the\ widgets\n\ reinit\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Inits\ for\ this\ pattern\n\ startstop\n\ ======\n\n<<categories>>\ Graphics\ |\ Application} CALL {my revision Juggler} CALL {::oo::Obj1053366 process revision/Juggler} CALL {::oo::Obj1053364 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