6      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./012345 676767 89:;<=>>spanfilter cond xs = (filter cond xs, filter (not . cond) xs) ?@#break cond (A ++ B ++ C) = (A,B,C) ( where for each x in A: not cond x /\ ' for each x in B: cond x /\ # if C=(x:_): not cond x Abreak1 cond (A ++ [B] ++ C) = (A,B,C) ( where for each x in A: not cond x /\ ' cond B /\ # if C=(x:_): not cond x Bunbreak (a,b,c) = a ++ b ++ c Cunbreak1 (a,b,c) = a ++ [b] ++ c DEisbetween x low up  returns True iff low <= x <= up Fminmax (a,b) = (a,b) if a<=b; (b,a) otherwise G8perhaps p Nothing = False, and perhaps p (Just a) = p a HI8JKL9:;<=>?@ABCDEFGHI89:;<=>?@ABCDEFGHIM1Conversion of radians to degrees and vice versa:  velocity in metre/second speed of an object in space surface speed of object Mvelocity in z-axis (positive: goes up; negative: goes down; 0: horizontally) speed of an object direction of object velocity of object  !"#$difference in x-coordinate |dx| <= 1.0 %difference in y-coordinate |dy| <= 1.0 &'angle in radians, clockwise ()*+,-./01x-coordinate in plane (0.0<=px) 2y-coordinate in plane (0.0<=py) 3456789:;< movePoint v p moves point p over vector v. =>pointToRectangle (a,b) c returns c if pointInRectangle (a,b) c and the  | projected point c' of c2 that is exactly on the closest edge of rectangle  | (a,b). ?pointInRectangle (a,b) c  | returns True iff point c' is inside the rectangle determined by  | the diagonal corner points a and b. @AscaleVector k {dx,dy} returns {k*dx,k*dy}  | scaleVector3D k {dxy,dz} returns {scaleVector k dxy,k*dz} BCDEbetweenPoints (a,b) c4 returns True iff c is on the line between a and b. F)sizeVector {dx,dy} = sqrt (dx**2 + dy**2)  | @sizeVector3D {dxy,dz} = sqrt ((dx dxy)**2 + (dy dxy)**2 + dz**2) GH orthogonal a6 returns the left- and right- orthogonal angles to a IJK#gets the angle between two objects ) | positive angle is CW, negative is CCW M$interpret Float as angle in radians L  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL76543/012+,-.8*)(9'&:;<=>?@"#$% !  ABCDEFGHIJKL    ! !"#$%#$%&'()*+,-.,-./0120123456789:;<=>?@ABCDEFGHIJK>LMN new position O"players that need to be displaced PQRST4no effect on match, message is displayed by referee UVFdisplaces all players at the provided position (used with free kicks) Wball was for the other team X&referee gives advantages to home-team Y/team playing at home may start from the center Zpenalty at homeside [;a throw in ball is granted for team home at given position \'a corner kick is granted for team home ]%a goal kick is granted for team home ^>a direct free kick is granted for team home at given position _player is offside at Home ` team playing at home has scored a/first half is over, teams go for a second half b extra time is added to the game cgame is paused d end of game e+person is seen for doing dangerous actions fg"person is seen for doing schwalbe h person is seen for doing tackle iperson is seen for doing hands j*player with given name receives reprimand k)number of frames to go before event ends lmnoEIf the referee gives a second yellow he should add red to it himself pqrstuvwxyz{|zero < time unit }time unit in sec. ~type with an inverse value >LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~>~}|y{zuvwxtsorqplnmkSjihgfedcba`_^]\[ZYXWVUTPRQONML>LMNOPRQQRSjihgfedcba`_^]\[ZYXWVUTTUVWXYZ[\]^_`abcdefghijklnmmnorqppqrstuvwxvwxy{zz{|}~width of ball field (64m <=width <=75m) height of ball field (100m<=height<=110m) bgoalPoles yields the py coordinates of the north pole and south pole of the goal (note that north < south). NOPQRSTUVWX+mkBall returns a ball with 3D dimensions. 4ballIsFree yields True iff argument is (Free ...). IballAtCenter returns a non-moving ball at the center of the ball field. OballIsGainedBy yields True iff the ball is in possession by the given player. SFunction used for giving a new random direction towards the given BounceDirection (# param1) Qofficially it should be 0.113m, but that turns out to be too small for rendering /maximum speed of ball when moving over surface Jmaximum speed of ball when moving through air (should depend on velocity) *acceleration difference per square second w"combination of stamina and health belong to same club [tackled by someone else; FramesToGo is the amount of frames that you will be on the ground player had started to act hurt  player had performed a schwalbe %player attempt to tackle an opponent &player caught the ball with his hands .player attempt to gain ball from other player 2player headed ball (Just v) with velocity, or didn' t (Nothing) 2player kicked ball (Just v) with velocity, or didn' t (Nothing) player had feinted Cplayer has rotated with given angle, and then ran with given speed 'actions a player can intend to perform wish to act as if he was hurt "wish to fall as if he was tackled dwish to tackle identified player, higher velocity is higher chance of succes AND injury (and foul?) &wish to catch the ball with his hands 6wish to gain possession of the ball from other player #wish to head ball with given speed #wish to kick ball with given speed wish to make feint manouvre @wish to rotate over given angle, and then move with given speed !Better acting of playing theater Better acting of tackles More effective tackling Better catching Further jumping Wider range of feint manouvre %More accurate and wider ball heading %More accurate and wider ball kicking Better ball gaining ability Wider range of rotation 'Faster running with ball in possession *Faster running without ball in possession the referee actions the state of the ball all other ball players the player himself must be unique need not be unique (should be in range [minHeight..maxHeight] should be on the ball field <absolute direction and velocity with which player is moving .absolute direction in which player is looking .these improve performance of affected actions %The effect(s) of the previous action :current stamina of a player: 1.0 is optimal, 0.0 is worst 9current health of a player: 1.0 is optimal, 0.0 is worst AThe precious asset: use and update the memory and make decisions IgetBall returns the ball (containing its position and speed-information) . | that is either free or gained by a player. L | For this reason, the list of players must contain all players, otherwise  | this function may fail. DReturns True if the ball is held by a Keeper in his own penaltyarea A | Returns False when the ball is held by a Keeper in open field 7 | Returns False when the ball is not held by a Keeper & | Keepers should be numbered with 1. True iff position touches/ hits player Skills of the player as a list chest size of player stomach size of player minimum length of a person. Advantages: better gainball; better stamina at sprinting; better dribbling; less health damage when fall, better rotating. maximum length of a person. Advantages: wider gainball; better stamina at running; higher headball; improved catching; harder kicking. minimum height of a person. Advantages: better gainball; better stamina at sprinting; better dribbling; less health damage when fall, better rotating. maximum height of a person. Advantages: wider gainball; better stamina at running; higher headball; improved catching; harder kicking. &Player attribute dependent abilities: L use these functions to make your player correctly dependent of abilities. vertical jumping includes horizontal jumping  +maximum angle with which player can rotate  /maximum side step of player for feint manouvre     !"#YZ[\]^_`      !"#w      !"#w         !"#$%&Lthe fielders are supposed to have different numbers, and all not equal to 1 '()*$%&'()*&'()$%*$%%&'()* $abcdefghi.Wrapper functions for simpler referee brains: jklmnopqrstuvwxyz{|}~JPosition of a referee-granted action like a throw-in, a corner kick, etc. $abcdefghijklmnopqrstuvwxyz{|}~$abcdefdefghijklmnopqrstuvwxyz{|}~ ~The functions below defines the penalty factor: values between 0.0 and 1.0 that define the loss of an attribute of an action. (zero) <= nr of goals !(goals by Team1, goals by Team2) team1 team2 the whereabouts of the ball the ball field  the referee Qfirst half or second half team1 plays West at first half and East at second half todo: add a boolean gameOver, playingtime will not walk back to (zero) and its up to the referee at which time he is to end the game  the score 0random seed for generating pseudo random values *the time unit of a single simulation step 2Attribute altering functions depending on angles:  params: ] Angle  between (zero) and pi, how much the player is running backwards (pi is backwards). v Angle  between (zero) and pi, the difference between the desired angle and the angle the player previously ran to.   =D= #display time in (mm:ss min) format  +,-./012345+,-./012345 +,-./012345 +,-./012345 !"#$$%&''()**+,--./012345567889:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstutvwxyz{||}~      !"#$%&'()*+,-./012345678 9 : ; < = > ? @ A B C D E F G H I J K L MNOPQRSTUVWXYZ[\]^_`a b c d d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                             ,                               SoccerFun-0.3SoccerFun.GeometrySoccerFun.TypesSoccerFun.FieldSoccerFun.BallSoccerFun.PlayerSoccerFun.TeamSoccerFun.UI.GLSoccerFun.RandomSoccerFun.PreludeSoccerFun.RefereeSoccerFun.MatchControlSoccerFun.Referee.IvanovSoccerFun.MatchGameDistdistDegreesFromPosition3DfromPosition3D ToPosition3D toPosition3D FromPosition fromPosition ToPosition toPosition ToRVector toRVector FromSpeed3D fromSpeed3D ToSpeed3D toSpeed3D FromSpeed fromSpeedToSpeedtoSpeedVelocitySpeed3DvxyvzSpeed directionvelocity RVector3DdxydzRVectordxdyRadianAngleZRadiusYRadiusXRadius Position3DpxypzPositionpxpyZPosYPosXPosLengthMetre coordinatesinRadiusOfPositionangleHowFarFromPiangleHowFarFromAngle movePoint movePoint3DpointToRectanglepointInRectangleinCircleRadiusOfPosition scaleVector scaleVector3D fromRadiantoRadian betweenPoints sizeVector sizeVector3D orthogonal oppositeAngleangleWithObjectangleWithObjectForRunMinutes ExtraTime Displacement DisplacementsATeamTeam2Team1 RefereeAction TellMessage ContinueGameDisplacePlayersOwnBallIllegally Advantage CenterKickPenaltyThrowInCornerGoalKickDirectFreeKickOffsideGoalEndHalfAddTime PauseGameGameOver DangerousPlayTheaterDetectedSchwalbeDetectedTackleDetectedHandsReprimandPlayer FramesToGoSuccessFail ReprimandRedCard YellowCardWarning PlayersNumberClubNamePlayerIDclubNameplayerNoEdgeSouthNorthSecondsTimeUnitOtherother PlayingTimeHalf SecondHalf FirstHalfBrainmaiNameOfnameOfHomeEastWest FieldLength FieldWidthFieldfwidthflength defaultField inPenaltyAreaisWestisEast goalPolesBounceDirectionBackForwardUpDownBallballPos ballSpeed BallStateGainedByFreemkBall ballIsFree ballAtCenterballIsGainedBy bounceBall radiusBallsurfaceResistance airResistanceaccellerationSecHealthStaminaFactor GetPosition getPositionSameClubsameClubHealthStamina PlayerEffect OnTheGround PlayedTheater SchwalbedTackled CaughtBall GainedBall HeadedBall KickedBallFeintedMoved PlayerAction PlayTheaterSchwalbeTackle CatchBallGainBallHeadBallKickBallFeintMoveFeintDirection FeintRight FeintLeftSkillPlayingTheater SchwalbingTacklingCatchingJumpingFeintingHeadingKickingGainingRotating DribblingRunning MajorSkillsPlayerWithEffectPlayerWithAction BrainInputrefereeballothersmePlayerAIPlayerplayerIDnameheightposspeednoseskillseffectstaminahealthbrain defaultPlayeridentifyPlayerplayerIdentitygetBallballGainedByKeeper clonePlayerinRadiusOfPlayer skillsAsList isFirstHalf isSecondHalf getClubNameisKeeper isFielder maxGainReach maxJumpReachmaxGainVelocityDifferencemaxCatchVelocityDifference maxKickReach maxHeadReach maxCatchReachmaxTackleReachmaxVelocityBallKickmaxVelocityBallHeadmaxKickingDeviationmaxHeadingDeviationmaxRotateAngle maxFeintStepgetHealthStaminaFactorteamHome opponentHomeisMove isGainBall isCatchBall isKickBall isHeadBallisFeintisPlayerTackle isSchwalbe isPlayTheaterisSkillOfActionisActionOnBallisMoved isGainedBall isKickedBall isHeadedBall isFeinted isTackled isSchwalbed isCaughtBallisPlayedTheater isOnTheGroundfailPlayerActionMirrormirrorTeam validateTeam replaceInTeamgetTeam isValidTeam gameLengthrunMatchregisterCallbackscolorRGBdrawAt3DdrawAtsquarevector2vertex2 convertDouble convertFloatmakeRandomRealisticmakeRandomRealisticSkilled AssocListavgzeroone iterateStnsingleOutElems spanfilter spanfilterStbreak'break1unbreakunbreak1 boundedBy isbetweenminmaxperhaps removeMember removeMembersfst3snd3thd3$fToRVectorFloatradiusCentreCircle goalWidth goalHeight goalAreaDepthradiusCornerKickArea goalPoleWidthradiusCentreSpotradiusPenaltySpotradiusPenaltyAreapenaltyAreaDepthpenaltySpotDepth xWidthPlayer yWidthPlayer minLength maxLength minHeight maxHeight maxStamina maxHealth RefereeAI RefereeBrainRefereernamerbrain cloneRefereedefaultRefereerandomlessRefereeAIamnesiaRefereeAIwitlessRefereeAIisReprimandPlayerisHandsisTackleDetectedisSchwalbeDetectedisTheaterDetectedisDangerousPlay isGameOver isPauseGame isAddTime isEndHalfisGoal isOffsideisDirectFreeKick isGoalKickisCorner isThrowIn isPenalty isCenterKick isAdvantageisOwnBallIllegallyisDisplacePlayersisContinueGame isTellMessage isGoal4ATeam getKickPos PenaltyFactor NrOfGoalsScoreMatchteam1team2theBalltheField theReferee playingHalf playingTimescoreseedunittime lookupPlayer setMatchStart stepMatch alterStamina alterHealthrestoreStaminaVelocity maxVelocitykickingPenaltyheadingPenaltymaxFatigueLossAtTacklemaxFatigueLossAtFeintmaxVelocityLossAtFeintoppositeKickPenaltyminimumFatiguemaximumFatigueMoodReasonRillegalBallPossessionRdangerousPlayRhands RschwalbeRtheaterRoffsideRtackle PunishedScorePunishedPlayerIvanovShortTermMemorygameStoppedForTacklepunishedpenaltythisRoundTacklesmyMoodoffsideAndTouchedBallballKickedOrHeadedFreeKickCountdownForOffsideKickForcedByReferee FreeToKickOffsidePossibleOffenderVictim TackleActionIvanovLongTermMemorylastRoundTacklesinOffsidePositionkeeper1HadBallkeeper2HadBallprevHealthPlayerslastKickedTheBall ballIsForoffsidePossible typeOfKickoffwaitingForSideSkipping firstKickreceivedYellow initialTeams ivanovRefereelowerOffsideCountermkIvanovShortTermMemorymkIvanovLongTermMemorygetNaughtyPlayer punishMoreaddPunishScoresuccessfulActionsrefBrainIvanovisTackleVictimisTackleOffendernearLastRoundTackle offsidelinegetOffsidePlayersfilterOutMeanActions nextBallPosposForFreeKick inKeeperSpotchanceOfPenaltySuccesschanceOfSchwalbeSuccesschanceOfTheaterSuccesschanceOfCatchSuccesshealthInaccurateFactornearEventRadiusreplaceDistanceshowTimelogRefereeAction computeMatchcircleoval drawString drawStatus