initial framework added
[fp1415-soccerfun.git] / src / Game / matchControl.dcl
1 definition module matchControl
2
3 /** This module defines the logical behavior of Soccer-Fun.
4 The core function is stepMatch, which computes a single, complete transition of a match.
5 */
6 import Referee
7
8 :: Match = { team1 :: !Team // team1
9 , team2 :: !Team // team2
10 , theBall :: !FootballState // the whereabouts of the football
11 , theField :: !FootballField // the football field
12 , theReferee :: !Referee // the referee
13 , playingHalf :: !Half // first half or second half team1 plays West at first half and East at second half
14 , playingTime :: !PlayingTime // 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
15 , score :: !Score // the score
16 , nextRandomP :: !St RandomSeed P // generate pseudo random value
17 , seed :: !RandomSeed // random seed for generating pseudo random values
18 , unittime :: !TimeUnit // the time unit of a single simulation step
19 , lastContact :: !Maybe FootballerID // the player who has the ball the last time (ball can have bounced against this player)
20 }
21 :: PlayingTime :== Minutes
22 :: Score :== (!NrOfGoals,!NrOfGoals) // (goals by Team1, goals by Team2)
23 :: NrOfGoals :== Int // zero <= nr of goals
24
25 :: TimeUnit :== Seconds // time unit in sec.
26 :: Seconds
27
28 s :: !Real -> Seconds // (s x) represents x seconds of time
29 instance zero Seconds
30 instance == Seconds
31 instance < Seconds
32 instance + Seconds
33 instance - Seconds
34 instance minutes Seconds
35 instance toReal Seconds
36 instance scale Seconds
37 instance toString Seconds
38
39 doSoccerFun :: !*World -> *World
40 setMatchStart :: !Team !Team !FootballField !Referee !PlayingTime !RandomSeed -> Match
41 stepMatch :: !Match -> (!(![RefereeAction],!AssocList FootballerID FootballerAction),!Match)