-- BasicTypes.hs -- Tom Moertel -- CVS $Id: BasicTypes.hs,v 1.5 2002/09/06 04:03:51 thor Exp $ -- | The BasicTypes module defines the basic types such as Robot -- and Package. module BasicTypes where import Maybe (fromJust) import Board type Money = Integer type RobotID = Int data Robot = Robot { rbtID :: RobotID , rbtLocation :: Point , rbtPackages :: [PackageID] , rbtMoney :: Maybe Integer , rbtScore :: Maybe Int , rbtAlive :: Bool } deriving (Show, Read, Eq, Ord) type PackageID = Int data Package = Package { pkgID :: PackageID , pkgLocation :: Maybe PackageLocation , pkgDestination :: Maybe Point , pkgWeight :: Maybe Weight } deriving (Show, Read, Eq, Ord) data PackageLocation = OnGround Point | OnRobot RobotID deriving (Show, Read, Eq, Ord) type Weight = Int data Direction = North | South | East | West deriving (Show, Read, Eq, Ord) directions :: [(Char, Direction)] directions = [ ('N', North) , ('S', South) , ('E', East) , ('W', West) ] lookupDirection :: Char -> Direction lookupDirection d = fromJust (lookup d directions) -- ================================================================= -- -- Copyright (C) 2002 Thomas Moertel. -- -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- The text of the GNU GPL may be found in the LICENSE file, -- included with this software, or online at the following URL: -- -- http://www.gnu.org/copyleft/gpl.html -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- Except as provided for under the terms of the GNU GPL, all rights -- are reserved worldwide. -- -- =================================================================