''' File: entity.py Author: Damien Riquet <*****@*****.**> Description: This file contains Entity class that represents any character (playable or not) of the game ''' # imports from math import sqrt from enum import automatic_enum # enums Genre = automatic_enum('HUMAN', 'COP', 'ZOMBIE', 'BERZERK') class EntityManager: def __init__(self, nb_players): self._entities = {} # Create containers for entities self._entities['all'] = [] self._entities['humans'] = [] self._entities['zombies'] = [] self._entities['cops'] = [] self._entities['berzerks'] = [] for i in xrange(1, nb_players + 1): self._entities[i] = {} self._entities[i]['id'] = 1 self._entities[i]['zombies'] = [] def get_all(self):
Description: The map is defined in this class. As well, there is some functions related to the map ''' # imports import re import random from math import sqrt from enum import automatic_enum, enum from entity import EntityManager, Entity # enums Direction = enum(NORTH='N', EAST='E', SOUTH='S', WEST='W') Surface = automatic_enum('WATER', 'GROUND') class MapException(Exception): pass class Cell: def __init__(self, surface=Surface.GROUND): self.surface = surface class Arena: def __init__(self, filename, config): self.filename = filename self.entities = None self.read_map(config)