SoccerFun-0.1.2: Football simulation framework for teaching functional programming

SoccerFun.Player

Description

This module defines the part of the SoccerFun API that is concerned with the player data types.

Synopsis

Documentation

data Player Source

Constructors

forall m . Player 

Fields

playerID :: PlayerID

The identification of a player: this must be unique

name :: String

The name of a player: this need not be unique

height :: Length

The height of a player: should be in range [minHeight..maxHeight]

pos :: Position

The position of a player: should be on the ball field

speed :: Speed

The speed of a player: absolute direction and velocity with which player is moving

nose :: Angle

The bearing of a player: absolute direction in which player is looking

skills :: MajorSkills

The major skills of a player: these improve performance of affected actions

effect :: Maybe PlayerEffect

The effect(s) of the previous action

stamina :: Stamina

The current stamina of a player: 1.0 is optimal, 0.0 is worst

health :: Health

The current health of a player: 1.0 is optimal, 0.0 is worst

brain :: Brain (PlayerAI m) m

The precious asset: use and update the memory and compute an action

data BrainInput Source

Constructors

BrainInput 

Fields

referee :: [RefereeAction]

the referee actions

ball :: BallState

the state of the ball

others :: [Player]

all other ball players

me :: Player

the player himself

data Skill Source

Constructors

Running

Faster running without ball in possession

Dribbling

Faster running with ball in possession

Rotating

Wider range of rotation

Gaining

Better ball gaining ability

Kicking

More accurate and wider ball kicking

Heading

More accurate and wider ball heading

Feinting

Wider range of feint manouvre

Jumping

Further jumping

Catching

Better catching

Tackling

More effective tackling

Schwalbing

Better acting of tackles

PlayingTheater

Better acting of playing theater

Instances

data PlayerAction Source

actions a player can intend to perform

Constructors

Move Speed Angle

wish to rotate over given angle, and then move with given speed

Feint FeintDirection

wish to make feint manouvre

KickBall Speed3D

wish to kick ball with given speed

HeadBall Speed3D

wish to head ball with given speed

GainBall

wish to gain possession of the ball from other player

CatchBall

wish to catch the ball with his hands

Tackle PlayerID Velocity

wish to tackle identified player, higher velocity is higher chance of succes AND injury

Schwalbe

wish to fall as if he was tackled

PlayTheater

wish to act as if he was hurt

data PlayerEffect Source

Constructors

Moved Speed Angle

player has rotated with given angle, and then ran with given speed

Feinted FeintDirection

player had feinted

KickedBall (Maybe Speed3D)

player kicked ball (Just v) with velocity, or didn't (Nothing)

HeadedBall (Maybe Speed3D)

player headed ball (Just v) with velocity, or didn't (Nothing)

GainedBall Success

player attempt to gain ball from other player

CaughtBall Success

player caught the ball with his hands

Tackled PlayerID Velocity Success

player attempt to tackle an opponent

Schwalbed

player had performed a schwalbe

PlayedTheater

player had started to act hurt

OnTheGround FramesToGo

tackled by someone else; FramesToGo is the amount of frames that you will be on the ground

getBall :: BallState -> [Player] -> BallSource

getBall returns the ball (containing its position and speed-information) that is either free or gained by a player. For this reason, the list of players must contain all players, otherwise this function may fail.

ballGainedByKeeper :: BallState -> [Player] -> ClubName -> Home -> Field -> BoolSource

Returns True if the ball is held by a Keeper in his own penaltyarea Returns False when the ball is held by a Keeper in open field Returns False when the ball is not held by a Keeper Keepers should be numbered with 1.

data Brain ai memory Source

Constructors

Brain 

Fields

m :: memory
 
ai :: ai
 

class SameClub a whereSource

Methods

sameClubSource

Arguments

:: a 
-> a 
-> Bool

belong to same club

class GetPosition a whereSource

Instances

inRadiusOfPlayerSource

Arguments

:: Position 
-> Player 
-> Bool

True iff position touches/hits player

skillsAsListSource

Arguments

:: Player 
-> [Skill]

Skills of the player as a list

class NameOf a whereSource

chest size of player

stomach size of player

Methods

nameOf :: a -> StringSource

Instances

maxGainReach :: Player -> MetreSource

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: use these functions to make your player correctly dependent of abilities.

maxJumpReach :: Player -> MetreSource

vertical jumping

maxCatchReach :: Player -> MetreSource

includes horizontal jumping

maxRotateAngle :: Player -> AngleSource

maximum angle with which player can rotate

maxFeintStep :: Player -> MetreSource

maximum side step of player for feint manouvre

type HealthStaminaFactor = FloatSource

combination of stamina and health