Îõ³h$Bœ?u5      !"#$%&'()*+,-./01234None}5 worldturtle*What it says on the tin. A lerp function. 6 worldturtle±Return a valid heading value between (0, 360]. We want 360 to be 360 (full rotation). We want 361 to be 1 (wraparound rotation). Special case: we want 0 to be 0 (no rotation). Though really 0 is equal to 360 we will let this special case slide as it helps in our time elapsed calculations.789:;<=>?@ABCDEFGHI56Color functions"(c) Archibald Neil MacDonald, 2020BSD3archibaldnmac@gmail.com experimentalPOSIXNoneÚ worldturtle5Rotates a given color's hue between [0, 360) degrees. worldturtleDegrees to change hue. worldturtleColor to shift. worldturtle!Resultant color with hue shifted.JKLMNOPQRSTUVWXYZ[\]^_`abcdef WorldTurtle"(c) Archibald Neil MacDonald, 2020BSD3archibaldnmac@gmail.com experimentalPOSIXNone worldturtle×Creates the default turtle polygon arrow with a given outline color and fill color. worldturtleÇDraws a line from a start-point to an end-point with a given thickness. worldturtle Outline color worldturtle Fill color worldturtle Arrow shape. worldturtleStarting point. worldturtle Ending point. worldturtleLine thickness. worldturtleProduced line.None= ghijklmnopqrsNoneÒt worldturtle,All pictures that make up the current canvasu worldturtle!Remaining available for animatingv worldturtle"ID of next turtle to be generated. worldturtleÄThe Turtle that is drawn on the canvas! Create a new turtle using .w worldturtle.Maybe Monad on top of the State Monad of form SequenceCommand a€. This represents a computation that can be "partial." I.E. we can only animate so much of the scene with the time given.x worldturtleState Monad that takes our y type as its state object.z worldturtle&Generates default parameter arguments.{ worldturtle¤Gets the remaining simulation time of the current turtle process. The simulation time dictates how much time is remaining for an animation, and it will be reduced as the animations play in sequence. Once this value hits 0 the exit command will be called and the monad will stop processing.| worldturtle»Sets the simulation time in the state monad. If the simulation time is <= 0 then this setter will immediately call the exit function which will kill any further processing of the monad.} worldturtleÎTakes a value away form the current sim time and store the updated time. See |.~ worldturtle-Given a picture, adds it to the picture list. worldturtleöGiven a sequence and a State, returns the result of the computation and the final state of the computation of form (r, s). When r is Justˆ, then the computation completed, otherwise the computation ended early due to lack of time available (i.e. a partial animation).€ worldturtleÞGiven a computation to run and an amount of time to run it in, renders the final "picture". worldturtle®Runs two items in parallel then applies a semigroup combination operator to the result of both. This combination can only return if both A and B return. Compare to ‚! which can return if one returns.‚ worldturtle2Runs two items in sequence, returns the result of a if a- passes, otherwise returns the results of b€. The implication of this is that only the result of a will be returned while animating, and b when animation is finished.ƒ worldturtleGiven two sequences a and bÕ, instead of running them both as separate animations, run them both in parallel!| worldturtle Time to set.} worldturtle-Value to subtract from store simulation time.~ worldturtlePicture to add to our animation worldturtle Sequence a to run. worldturtle Sequence b to run. worldturtle$New sequence of A and B in parallel.‚ worldturtle Sequence a to run. worldturtle Sequence b to run.ƒ worldturtle Sequence a to run. worldturtle Sequence b to run. worldturtle3New sequence of A and B which returns both results.yw„…†z{|}~€‡ˆ‰‚ None worldturtleA  represents an instruction to execute on a turtle. It could be as simple as "draw a line" or more complicated like "draw 300 circles."Ìs can be executed in order by combining them using the monadic operator Š.8For example, to draw an equilateral triangle using  1https://en.wikibooks.org/wiki/Haskell/do_notation do notation: „drawTriangle :: TurtleCommand () drawTriangle = do setHeading east forward 100 left 120 forward 100 left 120 forward 100Which would produce: docs/images/drawtriangle.gifdraw triangle gif worldturtleA Ê represents an instruction that affects the entire animation canvas.ëThis could be as simple as "make a turtle" or more complicated like "run these 5 turtles in parallel."Like s, Ús can be executed in order by combining commands in order using the monadic operator Š. To execute a  in a , use either the   function or the   operator./For how to achieve parallel animations see Graphics.WorldTurtle#parallel.  worldturtle  takes a  and a Ö to execute the command on. The result of the computation is returned wrapped in a .-For example, to create a turtle and get its x position one might write: ä myCommand :: Turtle -> WorldCommand Float myCommand t = do (x, _) <- run position t return xÅOr to create a command that accepts a turtle and draws a right angle: ÝmyCommand :: Turtle -> WorldCommand () myCommand = run $ forward 10 >> right 90 >> forward 10  worldturtleCommand to execute worldturtle!Turtle to apply the command upon. worldturtle Result as a ‹ŒŽ The commands used"(c) Archibald Neil MacDonald, 2020BSD3archibaldnmac@gmail.com experimentalPOSIXNoneÔÙ8¸-  worldturtleCreates a new † and displays it on the canvas. This turtle can then be manipulated! For example, to create a turtle and then move the turtle forward: Ê main:: IO () main = runWorld $ do t <- makeTurtle t >/> forward 90&The default turtle starts at position (0, 0) and is orientated ..  worldturtleThis variant of  ñ takes a starting position, a starting orientation, and a color to apply to the turtle and the turtle's pen. ¦ myCommand :: WorldCommand () myCommand = do t1 <- makeTurtle' (0, 0) 0 green t2 <- makeTurtle' (0, 0) 90 red (t1 >/> forward 90) \<|\> (t2 >/> forward 90)See  .  worldturtle*Move the turtle backward by the specified distance,, in the direction the turtle is headed.  worldturtleShorthand for  . worldturtle)Move the turtle forward by the specified distance,, in the direction the turtle is headed. worldturtleShorthand for . worldturtleÔStamp a copy of the turtle shape onto the canvas at the current turtle position. worldturtle0Turn a turtle right by the given degrees amount. worldturtleShorthand for . worldturtle/Turn a turtle left by the given degrees amount. worldturtleShorthand for . worldturtleDraw a circle with a given radius. The center is radius units left of the turtle if positive. Otherwise radius units right of the turtle if negative.The circle is drawn in an anticlockwise direction if the radius is positive, otherwise, it is drawn in a clockwise direction.Circle is an alias for circle r = arc r 360. worldturtleÏDraws an arc starting from a given starting point on the edge of the circle. worldturtleDraw an arc with a given radius. The center is radius units left of the turtle if positive. Otherwise radius units right of the turtle if negative.ýThe arc is drawn in an anticlockwise direction if the radius is positive, otherwise, it is drawn in a clockwise direction. worldturtleÉReturns the turtle's current position. Default (starting) position is (0, 0). worldturtle*Warps the turtle to its starting position (0, 0)" and resets the orientation to . (90. degrees). No line is drawn moving the turtle. worldturtle‹Warps the turtle to a new position. The turtle jumps to this new position with no animation. If the pen is down then a line is drawn.*This does not affect the turtle's heading. worldturtle Alias of . worldturtleReturns the turtle's heading.07 is along the positive x-axis, going anticlockwise. So:East is 0 degrees. North is 90 degrees.West is 180 degrees. South is 270 degrees.The default heading is North (90 degrees). worldturtleSets the turtle's heading. See . worldturtleÖReturns the turtle's pen color. The color of the turtle's pen.The default color is black. worldturtle"Set the turtle's pen color. See . worldturtle†Returns whether the turtle's pen is down. When the turtle's pen is down it will draw a line when it moves. The default value is True.  worldturtle,Sets the turtle's pen to down or up. See .! worldturtle.Returns the turtle's pen size. Defaults to 2." worldturtle#Sets the turtle's pen size. See !.# worldturtle?Returns whether the turtle is visible. The default value is True.$ worldturtle%Sets the turtle's visibility. See #.% worldturtle3Returns the turtle's current speed. Speed is is distance per second. A speed of 0ß is equivalent to no animation being performed and instant movement. The default value is 200.& worldturtle Sets the turtle's speed. See %.' worldturtleŠReturns the turtle's current rotation speed. Rotation speed is is the speed in seconds it takes to do a full revolution. A speed of 0ß is equivalent to no animation being performed and instant rotation. The default value is 20.( worldturtle)Sets the turtle's rotation speed. See '.) worldturtle&Gets the turtle's representation as a ‘.* worldturtle&Sets the turtle's representation to a ‘ . See )4. For example, to set the turtle as a red circle: Ôimport Graphics.WorldTurtle import qualified Graphics.Gloss.Data.Picture as G myCommand :: TurtleCommand () myCommand = do setPenColor red setRepresentation (G.color red $ G.circleSolid 10) forward 90+ worldturtleÇClears all drawings form the canvas. Does not alter any turtle's state., worldturtleöSleep for a given amount of time in seconds. When sleeping no animation runs. A negative value will be clamped to 0.- worldturtleûGiven a command, runs the command, then resets the turtle's state back to what the state was before the command was run.. worldturtle90 degrees./ worldturtle0 degrees.0 worldturtle180 degrees.1 worldturtle270 degrees.’ worldturtle•Looks up the turtle data for the given turtle in the state monad. This type signature comes form GHC...my prism-foo is not good enough to sugar it.“ worldturtle€This is a helper function for our getter commands. It takes a default value, the lense to compose, and the turtle to inspect.” worldturtleËThis is a helper function that extracts the turtle data for a given turtle.• worldturtleñThis is a helper function for our setter commands It takes a lens, the value to apply, and the turtle to modify.  worldturtleInitial position of the turtle. worldturtleInitial heading of the turtle. worldturtle)Color of the turtle and the turtle's pen. worldturtleThe generated turtle.  worldturtleDistance to move the turtle.– worldturtleStarting point worldturtleDistance worldturtleHeading in degrees. worldturtlecoefficient [0, 1] worldturtleDistance to move the turtle. worldturtle#Rotation amount to apply to turtle. worldturtle#Rotation amount to apply to turtle.— worldturtle1Bias decides in which direction rotation happens. worldturtleAmount to rotate by worldturtleRadius of the circle. worldturtle%Point on edge of circle to start from worldturtleRadius of circle worldturtle"Absolute starting angle in degrees worldturtle'Rotation amount about radius in degrees worldturtleLine thickness (penSize) worldturtleColor of circle  worldturtleResulting circle˜ worldturtlePoint on edge of circle worldturtleRadius of circle worldturtle"Absolute starting angle in degrees worldturtle'Rotation amount about radius in degrees worldturtleResulting new point worldturtleRadius of the circle. worldturtle+Angle to travel in degrees. For example: 360 for a full circle or 180 for a semicircle. worldturtleReturned current point. worldturtlePosition to warp to. worldturtle%Returned heading as angle in degrees. worldturtleHeading to apply.  worldturtleReturned current pen color. worldturtleNew pen color to apply worldturtle"True if pen is down, false if not.  worldturtle4New state for pen flag. True for down. False for up.! worldturtleSize of turtle's pen." worldturtleNew size for turtle's pen.# worldturtleTrue if turtle is visible, False if not.$ worldturtleNew state for visible flag.% worldturtleSpeed of turtle.& worldturtle New speed.' worldturtleRotation speed of turtle.( worldturtleNew rotation speed.* worldturtlePicture to apply.*  !"#$%&'()*+,-./01* +, &()%'!#- "*$/.01 WorldTurtle"(c) Archibald Neil MacDonald, 2020BSD3archibaldnmac@gmail.com experimentalPOSIXNone?2 worldturtleTakes a Õ and executes the command on an implicitly created turtle that starts at position (0, 0) with heading .. 3This is a convenience function written in terms of 3 as: -runTurtle c = runWorld $ makeTurtle >>= run c See also:  .3 worldturtle3 takes a 3 and produces the animation in a new window! Interacting with the window.ÅWhile running, you can interact with the window in the following way:Action InteractionPan the viewport.Click and drag Zoom in/out.Mousewheel up/down'Reset the viewport to initial position.SpacebarReset the animation.R keyPause the animation.P keyQuit Escape key4 worldturtleThis is an infix version of  ! where the arguments are swapped.óWe take a turtle and a command to execute on the turtle. The result of the computation is returned wrapped in a .*To create a turtle and draw a right-angle: ômyCommand :: WorldCommand () myCommand = do t <- makeTurtle t >/> do forward 10 right 90 forward 10™ worldturtle-Tests to see if a key-event is the reset key.2 worldturtleCommand sequence to execute.3 worldturtleCommand sequence to execute4 worldturtle!Turtle to apply the command upon. worldturtleCommand to execute worldturtle Result as a ÒJKLMNOPQRSTUVWXYZ[\]^_`abcdef  !"#$%&'()*+,-./0123423 444š      !"#$%&'()*+,-./0123456789:;<=>?@A BCDEFGDHIDHJDHKDHLDMNDMODMPDMQDMRDMSDMTDMUDMVWDXYDXZDX[\]D^_D^`D^aD^bD^cD^dD^eD^fD^gD^hD^iD^jD^kD^lD^mD^nD^oD^pD^qD^rD^sD^tD^uD^vD^w\x\y\z{)+-/%75|31}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“” •  –  — ˜™š›œžŸ ¡¢£worldturtle-0.2.2.1-inplaceGraphics.WorldTurtleGraphics.WorldTurtle.CommandsGraphics.WorldTurtle.ColorGraphics.WorldTurtle.Shapes$Graphics.WorldTurtle.Internal.Coords$Graphics.WorldTurtle.Internal.Turtle&Graphics.WorldTurtle.Internal.Sequence makeTurtle&Graphics.WorldTurtle.Internal.Commandsrun>/>baseGHC.Base<|>emptyÀgloss-renderi_-1.13.1.1-24a70db1fc57441ea8c102385983bfec5098da2e%Graphics.Gloss.Internals.Data.PicturePointshiftHue turtleArrow thickLineTurtle TurtleCommand WorldCommand makeTurtle'backwardbkforwardfdstamprightrtleftltcirclearcpositionhomegoto setPositionheading setHeadingpenColor setPenColorpenDown setPenDownpenSize setPenSizevisible setVisiblespeedsetSpeed rotationSpeedsetRotationSpeedrepresentationsetRepresentationclearsleepbranchnortheastwestsouth runTurtlerunWorldlerpnormalizeHeading7gloss-1.13.2.1-9747bf3fab92b78050a1d52bdd4f1fe9d28025deGraphics.Gloss.Data.Point pointInBoxPath$Graphics.Gloss.Data.Point.Arithmetic*+-negateGraphics.Gloss.Data.VectorangleVVargVdetVdotVmagVmulSV normalizeVrotateVunitVectorAtAngleVectorGraphics.Gloss.Geometry.AngledegToRadnormalizeAngleradToDeg#Graphics.Gloss.Internals.Data.ColorColorGraphics.Gloss.Data.Color addColors aquamarineazureblackbluebright chartreusecyandarkdimgreengreyNlightmagenta mixColorsorangeredrosevioletwhite withAlphawithBlue withGreenwithRedyellow makeColor makeColorI rgbaOfColor TurtleDatascale defaultTurtle drawTurtle_pics _totalSimTime _nextTurtleIdSequenceCommand TurtleStateTSC defaultTSCsimTime setSimTimedecrementSimTime addPicture processTurtle renderTurtlecombineSequencealternateSequence runParallelpics totalSimTimeturtlesgenerateTurtleanimate'animate>>seqTseqWseqToT drawCircle_Picture turtLens_getter_tData_setter_calculateNewPointF_ rotateTo_calculateNewPointC_ isResetKey_