pyrat.src.enums
This file is part of the PyRat library. It is meant to be used as a library, and not to be executed directly.
Please import necessary elements using the following syntax:
from pyrat import
1##################################################################################################################################################### 2######################################################################## INFO ####################################################################### 3##################################################################################################################################################### 4 5""" 6 This file is part of the PyRat library. 7 It is meant to be used as a library, and not to be executed directly. 8 Please import necessary elements using the following syntax: 9 from pyrat import <element_name> 10""" 11 12##################################################################################################################################################### 13###################################################################### IMPORTS ###################################################################### 14##################################################################################################################################################### 15 16# External imports 17import enum 18 19##################################################################################################################################################### 20###################################################################### CLASSES ###################################################################### 21##################################################################################################################################################### 22 23class Action (enum.Enum): 24 25 """ 26 This enumeration defines all the possible actions a player can take in a maze. 27 Values: 28 * NOTHING: No action. 29 * NORTH: Move north. 30 * SOUTH: Move south. 31 * EAST: Move east. 32 * WEST: Move west. 33 """ 34 35 NOTHING = "nothing" 36 NORTH = "north" 37 SOUTH = "south" 38 EAST = "east" 39 WEST = "west" 40 41##################################################################################################################################################### 42 43class RenderMode (enum.Enum): 44 45 """ 46 This enumeration defines all accepted rendering modes. 47 Values: 48 * GUI: The game will be rendered graphically in a window. 49 * ANSI: The game will be rendered in the terminal using ANSI characters. 50 * ASCII: The game will be rendered in the terminal using ASCII characters. 51 * NO_RENDERING: The game will not be rendered. 52 """ 53 54 GUI = "gui" 55 ANSI = "ansi" 56 ASCII = "ascii" 57 NO_RENDERING = "no_rendering" 58 59##################################################################################################################################################### 60 61class GameMode (enum.Enum): 62 63 """ 64 This enumeration defines all accepted game modes. 65 Values: 66 * STANDARD: Players have their own process and play simultaneously, with timeouts that can be missed. 67 * SYNCHRONOUS: Players have their own process and play simultaneously, but actions are applied when all players are ready. 68 * SEQUENTIAL: All players are asked for a decision, and then actions are applied simultaneously, but there is no multiprocessing. 69 * SIMULATION: The game is run as fast as possible, i.e., there is no rendering, no multiprocessing, and no timeouts. 70 """ 71 72 STANDARD = "standard" 73 SYNCHRONOUS = "synchronous" 74 SEQUENTIAL = "sequential" 75 SIMULATION = "simulation" 76 77##################################################################################################################################################### 78 79class StartingLocation (enum.Enum): 80 81 """ 82 This enumeration defines all named starting locations for players. 83 The player will start at the closest existing cell to the desired location. 84 Values: 85 * CENTER: The player will start at the center of the maze. 86 * TOP_LEFT: The player will start at the top left corner of the maze. 87 * TOP_RIGHT: The player will start at the top right corner of the maze. 88 * BOTTOM_LEFT: The player will start at the bottom left corner of the maz. 89 * BOTTOM_RIGHT: The player will start at the bottom right corner of the maze. 90 * RANDOM: The player will start at a random location. 91 * SAME: The player will start at the same location as the previously registered player. 92 """ 93 94 CENTER = "center" 95 TOP_LEFT = "top_left" 96 TOP_RIGHT = "top_right" 97 BOTTOM_LEFT = "bottom_left" 98 BOTTOM_RIGHT = "bottom_right" 99 RANDOM = "random" 100 SAME = "same" 101 102##################################################################################################################################################### 103 104class PlayerSkin (enum.Enum): 105 106 """ 107 This enumeration defines all available player skins. 108 The value should correspond to the directory name containing the skin. 109 Values: 110 * RAT: The player is a rat. 111 * PYTHON: The player is a python. 112 * GHOST: The player is a ghost from Pacman. 113 * MARIO: The player is Super Mario. 114 """ 115 116 RAT = "rat" 117 PYTHON = "python" 118 GHOST = "ghost" 119 MARIO = "mario" 120 121##################################################################################################################################################### 122 123class RandomMazeAlgorithm (enum.Enum): 124 125 """ 126 This enumeration defines all the possible algorithms to generate a random maze. 127 Values: 128 * HOLES_ON_SIDE: Missing cells tend to be on the sides of the maze. 129 * UNIFORM_HOLES: Missing cells are uniformly distributed. 130 * BIG_HOLES: Missing cells tend to be grouped together. 131 """ 132 133 HOLES_ON_SIDE = "holes_on_side" 134 UNIFORM_HOLES = "uniform_holes" 135 BIG_HOLES = "big_holes" 136 137##################################################################################################################################################### 138#####################################################################################################################################################
class
Action(enum.Enum):
24class Action (enum.Enum): 25 26 """ 27 This enumeration defines all the possible actions a player can take in a maze. 28 Values: 29 * NOTHING: No action. 30 * NORTH: Move north. 31 * SOUTH: Move south. 32 * EAST: Move east. 33 * WEST: Move west. 34 """ 35 36 NOTHING = "nothing" 37 NORTH = "north" 38 SOUTH = "south" 39 EAST = "east" 40 WEST = "west"
This enumeration defines all the possible actions a player can take in a maze.
Values:
- NOTHING: No action.
- NORTH: Move north.
- SOUTH: Move south.
- EAST: Move east.
- WEST: Move west.
NOTHING =
<Action.NOTHING: 'nothing'>
NORTH =
<Action.NORTH: 'north'>
SOUTH =
<Action.SOUTH: 'south'>
EAST =
<Action.EAST: 'east'>
WEST =
<Action.WEST: 'west'>
Inherited Members
- enum.Enum
- name
- value
class
RenderMode(enum.Enum):
44class RenderMode (enum.Enum): 45 46 """ 47 This enumeration defines all accepted rendering modes. 48 Values: 49 * GUI: The game will be rendered graphically in a window. 50 * ANSI: The game will be rendered in the terminal using ANSI characters. 51 * ASCII: The game will be rendered in the terminal using ASCII characters. 52 * NO_RENDERING: The game will not be rendered. 53 """ 54 55 GUI = "gui" 56 ANSI = "ansi" 57 ASCII = "ascii" 58 NO_RENDERING = "no_rendering"
This enumeration defines all accepted rendering modes.
Values:
- GUI: The game will be rendered graphically in a window.
- ANSI: The game will be rendered in the terminal using ANSI characters.
- ASCII: The game will be rendered in the terminal using ASCII characters.
- NO_RENDERING: The game will not be rendered.
GUI =
<RenderMode.GUI: 'gui'>
ANSI =
<RenderMode.ANSI: 'ansi'>
ASCII =
<RenderMode.ASCII: 'ascii'>
NO_RENDERING =
<RenderMode.NO_RENDERING: 'no_rendering'>
Inherited Members
- enum.Enum
- name
- value
class
GameMode(enum.Enum):
62class GameMode (enum.Enum): 63 64 """ 65 This enumeration defines all accepted game modes. 66 Values: 67 * STANDARD: Players have their own process and play simultaneously, with timeouts that can be missed. 68 * SYNCHRONOUS: Players have their own process and play simultaneously, but actions are applied when all players are ready. 69 * SEQUENTIAL: All players are asked for a decision, and then actions are applied simultaneously, but there is no multiprocessing. 70 * SIMULATION: The game is run as fast as possible, i.e., there is no rendering, no multiprocessing, and no timeouts. 71 """ 72 73 STANDARD = "standard" 74 SYNCHRONOUS = "synchronous" 75 SEQUENTIAL = "sequential" 76 SIMULATION = "simulation"
This enumeration defines all accepted game modes.
Values:
- STANDARD: Players have their own process and play simultaneously, with timeouts that can be missed.
- SYNCHRONOUS: Players have their own process and play simultaneously, but actions are applied when all players are ready.
- SEQUENTIAL: All players are asked for a decision, and then actions are applied simultaneously, but there is no multiprocessing.
- SIMULATION: The game is run as fast as possible, i.e., there is no rendering, no multiprocessing, and no timeouts.
STANDARD =
<GameMode.STANDARD: 'standard'>
SYNCHRONOUS =
<GameMode.SYNCHRONOUS: 'synchronous'>
SEQUENTIAL =
<GameMode.SEQUENTIAL: 'sequential'>
SIMULATION =
<GameMode.SIMULATION: 'simulation'>
Inherited Members
- enum.Enum
- name
- value
class
StartingLocation(enum.Enum):
80class StartingLocation (enum.Enum): 81 82 """ 83 This enumeration defines all named starting locations for players. 84 The player will start at the closest existing cell to the desired location. 85 Values: 86 * CENTER: The player will start at the center of the maze. 87 * TOP_LEFT: The player will start at the top left corner of the maze. 88 * TOP_RIGHT: The player will start at the top right corner of the maze. 89 * BOTTOM_LEFT: The player will start at the bottom left corner of the maz. 90 * BOTTOM_RIGHT: The player will start at the bottom right corner of the maze. 91 * RANDOM: The player will start at a random location. 92 * SAME: The player will start at the same location as the previously registered player. 93 """ 94 95 CENTER = "center" 96 TOP_LEFT = "top_left" 97 TOP_RIGHT = "top_right" 98 BOTTOM_LEFT = "bottom_left" 99 BOTTOM_RIGHT = "bottom_right" 100 RANDOM = "random" 101 SAME = "same"
This enumeration defines all named starting locations for players. The player will start at the closest existing cell to the desired location.
Values:
- CENTER: The player will start at the center of the maze.
- TOP_LEFT: The player will start at the top left corner of the maze.
- TOP_RIGHT: The player will start at the top right corner of the maze.
- BOTTOM_LEFT: The player will start at the bottom left corner of the maz.
- BOTTOM_RIGHT: The player will start at the bottom right corner of the maze.
- RANDOM: The player will start at a random location.
- SAME: The player will start at the same location as the previously registered player.
CENTER =
<StartingLocation.CENTER: 'center'>
TOP_LEFT =
<StartingLocation.TOP_LEFT: 'top_left'>
TOP_RIGHT =
<StartingLocation.TOP_RIGHT: 'top_right'>
BOTTOM_LEFT =
<StartingLocation.BOTTOM_LEFT: 'bottom_left'>
BOTTOM_RIGHT =
<StartingLocation.BOTTOM_RIGHT: 'bottom_right'>
RANDOM =
<StartingLocation.RANDOM: 'random'>
SAME =
<StartingLocation.SAME: 'same'>
Inherited Members
- enum.Enum
- name
- value
class
PlayerSkin(enum.Enum):
105class PlayerSkin (enum.Enum): 106 107 """ 108 This enumeration defines all available player skins. 109 The value should correspond to the directory name containing the skin. 110 Values: 111 * RAT: The player is a rat. 112 * PYTHON: The player is a python. 113 * GHOST: The player is a ghost from Pacman. 114 * MARIO: The player is Super Mario. 115 """ 116 117 RAT = "rat" 118 PYTHON = "python" 119 GHOST = "ghost" 120 MARIO = "mario"
This enumeration defines all available player skins. The value should correspond to the directory name containing the skin.
Values:
- RAT: The player is a rat.
- PYTHON: The player is a python.
- GHOST: The player is a ghost from Pacman.
- MARIO: The player is Super Mario.
RAT =
<PlayerSkin.RAT: 'rat'>
PYTHON =
<PlayerSkin.PYTHON: 'python'>
GHOST =
<PlayerSkin.GHOST: 'ghost'>
MARIO =
<PlayerSkin.MARIO: 'mario'>
Inherited Members
- enum.Enum
- name
- value
class
RandomMazeAlgorithm(enum.Enum):
124class RandomMazeAlgorithm (enum.Enum): 125 126 """ 127 This enumeration defines all the possible algorithms to generate a random maze. 128 Values: 129 * HOLES_ON_SIDE: Missing cells tend to be on the sides of the maze. 130 * UNIFORM_HOLES: Missing cells are uniformly distributed. 131 * BIG_HOLES: Missing cells tend to be grouped together. 132 """ 133 134 HOLES_ON_SIDE = "holes_on_side" 135 UNIFORM_HOLES = "uniform_holes" 136 BIG_HOLES = "big_holes"
This enumeration defines all the possible algorithms to generate a random maze.
Values:
- HOLES_ON_SIDE: Missing cells tend to be on the sides of the maze.
- UNIFORM_HOLES: Missing cells are uniformly distributed.
- BIG_HOLES: Missing cells tend to be grouped together.
HOLES_ON_SIDE =
<RandomMazeAlgorithm.HOLES_ON_SIDE: 'holes_on_side'>
UNIFORM_HOLES =
<RandomMazeAlgorithm.UNIFORM_HOLES: 'uniform_holes'>
BIG_HOLES =
<RandomMazeAlgorithm.BIG_HOLES: 'big_holes'>
Inherited Members
- enum.Enum
- name
- value