Safe HaskellSafe

Types

Synopsis

Documentation

data State #

The data State is composed by a maze (:: Maze), a playersState (:: [Player]) and a level (:: Int).

Constructors

State 

Fields

Instances
Show State # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> State -> ShowS

show :: State -> String

showList :: [State] -> ShowS

type Maze = [Corridor] #

The type Maze is composed by a list of Corridors.

type Corridor = [Piece] #

The type Corridor is composed by a list of Pieces.

data Piece #

The data Piece can be a Food with a data FoodType (Big or Little), a PacPlayer with a data Player (Pacman or Ghost), a Empty Piece or a Wall piece.

Instances
Eq Piece # 
Instance details

Defined in Types

Methods

(==) :: Piece -> Piece -> Bool

(/=) :: Piece -> Piece -> Bool

Show Piece # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Piece -> ShowS

show :: Piece -> String

showList :: [Piece] -> ShowS

data FoodType #

Constructors

Big 
Little 
Instances
Eq FoodType # 
Instance details

Defined in Types

Methods

(==) :: FoodType -> FoodType -> Bool

(/=) :: FoodType -> FoodType -> Bool

Show FoodType # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> FoodType -> ShowS

show :: FoodType -> String

showList :: [FoodType] -> ShowS

data Player #

The data Player either is Pacman (PacState) or Ghost (GhoState).

Constructors

Pacman PacState 
Ghost GhoState 
Instances
Eq Player # 
Instance details

Defined in Types

Methods

(==) :: Player -> Player -> Bool

(/=) :: Player -> Player -> Bool

Show Player # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Player -> ShowS

show :: Player -> String

showList :: [Player] -> ShowS

data PacState #

The data PacState is composed by a pacState (:: PlayerState), a timeMega (:: Double), a openClosed (:: Mouth), and a pacmanMode (:: PacMode).

Constructors

PacState 
Instances
Eq PacState # 
Instance details

Defined in Types

Methods

(==) :: PacState -> PacState -> Bool

(/=) :: PacState -> PacState -> Bool

Show PacState # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> PacState -> ShowS

show :: PacState -> String

showList :: [PacState] -> ShowS

data GhoState #

The data GhoState is composed by: a ghostState (:: PlayerState) and a ghostMode (:: GhostMode).

Constructors

GhoState 
Instances
Eq GhoState # 
Instance details

Defined in Types

Methods

(==) :: GhoState -> GhoState -> Bool

(/=) :: GhoState -> GhoState -> Bool

Show GhoState # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> GhoState -> ShowS

show :: GhoState -> String

showList :: [GhoState] -> ShowS

type PlayerState = (Int, Coords, Double, Orientation, Int, Int) #

The type PlayerState is present in the datas PacState and GhoState, The PlayerState is given by: ID (:: Int) -> identifier for the player, where the ID is unique for each player; Coords (:: (Int,Int)) -> coordenates in a maze of the Player; Velocity (:: Double) -> velocity of the player; Orientation (:: Orientation) -> direction faced by the player; Points (:: Int) -> score of the Player; Lives (:: Int) -> number of player lifes;

type Coords = (Int, Int) #

The type Coords represents the coordinates of a player in a maze where the first coord represents the number of Corridors and the second the number of pieces on each Corridor.

data Orientation #

The data Orientation determines the direction a Player is facing (Left, Right, Up, Down and Null)

Constructors

L 
R 
U 
D 
Null 
Instances
Eq Orientation # 
Instance details

Defined in Types

Methods

(==) :: Orientation -> Orientation -> Bool

(/=) :: Orientation -> Orientation -> Bool

Show Orientation # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Orientation -> ShowS

show :: Orientation -> String

showList :: [Orientation] -> ShowS

data Mouth #

The data Mouth is used for the data pacState and it can either be Closed or Open.

Constructors

Open 
Closed 
Instances
Eq Mouth # 
Instance details

Defined in Types

Methods

(==) :: Mouth -> Mouth -> Bool

(/=) :: Mouth -> Mouth -> Bool

Show Mouth # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Mouth -> ShowS

show :: Mouth -> String

showList :: [Mouth] -> ShowS

data PacMode #

The data Pacmode is formed by the datas: Dying -> Represents when the pacman dies; Normal -> The pacman can be killed by ghosts when the GhostMode is Alive); Mega -> This is the only time where pacman can defeat ghosts (when PacMode switches to Mega, all the ghosts GhostMode switch to Dead); Pacman is switched to Mega when he eats a Food Big.

Constructors

Dying 
Mega 
Normal 
Instances
Eq PacMode # 
Instance details

Defined in Types

Methods

(==) :: PacMode -> PacMode -> Bool

(/=) :: PacMode -> PacMode -> Bool

Show PacMode # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> PacMode -> ShowS

show :: PacMode -> String

showList :: [PacMode] -> ShowS

data GhostMode #

Constructors

Dead 
Alive 
Instances
Eq GhostMode # 
Instance details

Defined in Types

Methods

(==) :: GhostMode -> GhostMode -> Bool

(/=) :: GhostMode -> GhostMode -> Bool

Show GhostMode # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> GhostMode -> ShowS

show :: GhostMode -> String

showList :: [GhostMode] -> ShowS

data Color #

Constructors

Blue 
Green 
Purple 
Red 
Yellow 
None 
Instances
Eq Color # 
Instance details

Defined in Types

Methods

(==) :: Color -> Color -> Bool

(/=) :: Color -> Color -> Bool

data Play #

The data Play is formed by a player ID (:: Int) and a Orientation. The ID espeficies the player we want to move and the Orientation the direction where we want to move that player.

Constructors

Move Int Orientation 
Instances
Eq Play # 
Instance details

Defined in Types

Methods

(==) :: Play -> Play -> Bool

(/=) :: Play -> Play -> Bool

Show Play # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Play -> ShowS

show :: Play -> String

showList :: [Play] -> ShowS

data Instruction #

Constructors

Instruct [(Int, Piece)] 
Repeat Int 
Instances
Eq Instruction # 
Instance details

Defined in Types

Methods

(==) :: Instruction -> Instruction -> Bool

(/=) :: Instruction -> Instruction -> Bool

Show Instruction # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Instruction -> ShowS

show :: Instruction -> String

showList :: [Instruction] -> ShowS

coloredString :: String -> Color -> String #

placePlayersOnMap :: [Player] -> Maze -> Maze #

Takes as inputs a list of Players and a Maze and then returns a new Maze with the Players in the respective Coords.

printMaze :: Maze -> String #

Converts a Maze to a String

printPlayerStats :: Player -> String #

Outputs the String with the ID, the Points and the Lives info for a player given in the input

getPlayerID :: Player -> Int #

Take as input a Player and returns the respective Player ID

getPlayerPoints :: Player -> Int #

Take as input a Player and returns his points

setPlayerCoords :: Player -> Coords -> Player #

Takes as inputs a Player and Coords and then replaces the Player Coords by the new Coords returning a Player with the given new coords

getPieceOrientation :: Piece -> Orientation #

Take as input a Piece and returns that Piece Orientation. If the Piece doesn't have any Orientation returns Null

getPacmanMode :: Player -> PacMode #

Take as input a Player Pacman and returns his PacMode

getPlayerState :: Player -> PlayerState #

Takes as input a Player and returns his PlayerState

getPlayerOrientation :: Player -> Orientation #

Take as input a Player and returns that player Orientation

replaceElemInMaze :: Coords -> Piece -> Maze -> Maze #

Takes as inputs a Coords, a Piece and a Maze and then returns the Maze with the given piece at the given Coords replaced.

replaceNElem :: Int -> a -> [a] -> [a] #

Takes as input a Int (n), a element with any type (t) and a list of elements t type ([t]), and returns the list of elements t type ([t]) where is replaced the n position element (starting at 0) by the inputed element with t type in the given list of elements t type. If the list haves n or more elements then the returned output is the same list .

getPlayerCoords :: Player -> Coords #

Take as input a Player and returns that player Coords