-- GameState.hs -- Tom Moertel -- CVS $Id: GameState.hs,v 1.4 2002/09/06 04:03:51 thor Exp $ -- | The GameState module represents the present state of the game. -- We keep track of the everything we know about the robots and other -- items in play. module GameState where import Data.FiniteMap import BasicTypes data GameState = GS { -- | What we know about robots in the game. gsRobots :: RobotKnowledge -- | What we know about packages. , gsPackages :: PackageKnowledge } instance Show GameState where showsPrec _ (GS rbtK pkgK) s = "ROBOTS\n" ++ unlines (map show (fmToList rbtK)) ++ "\n\n" ++ "PACKAGES\n" ++ unlines (map show (fmToList pkgK)) ++ "\n\n" ++ s type RobotKnowledge = FiniteMap RobotID Robot type PackageKnowledge = FiniteMap PackageID Package emptyState :: GameState emptyState = GS { gsRobots = emptyFM , gsPackages = emptyFM } -- ================================================================= -- -- 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. -- -- =================================================================