from misc import enum Modes = enum(INVM='INVM', OUTVM='OUTVM', MOUNTPOINT='MOUNTPOINT', OUTCONTAINER='OUTCONTAINER', MESOS='MESOS')
from misc import enum Modes = enum(INVM='INVM', OUTVM='OUTVM', MOUNTPOINT='MOUNTPOINT', DEVICE='DEVICE', FILE='FILE', ISCSI='ISCSI', OUTCONTAINER='OUTCONTAINER', MESOS='MESOS')
import globals import copy import walls import random import misc #create enum for cell directions cellDirEnum = misc.enum('CUP','CDOWN','CLEFT','CRIGHT') # DFS algorithm from: http://www.mazeworks.com/mazegen/mazetut/index.htm # create a CellStack (LIFO) to hold a list of cell locations # set TotalCells = number of cells in grid # choose a cell at random and call it CurrentCell # set VisitedCells = 1 # # while VisitedCells < TotalCells # find all neighbors of CurrentCell with all walls intact # if one or more found # choose one at random # knock down the wall between it and CurrentCell # push CurrentCell location on the CellStack # make the new cell the neighbor cell selected # add 1 to VisitedCells # else # pop the most recent cell entry off the CellStack # make it CurrentCell endIf # endWhile class Class_MCells(): def __init__(self): # place walls on all cells # leave borders zero for now
import misc #movement vectors up = [0.0, -1.0] down = [0.0, 1.0] left = [-1.0, 0.0] right = [1.0, 0.0] upleft = [-.707, -.707] upright = [.707, -.707] downleft = [-.707, .707] downright = [.707, .707] none = [0.0, 0.0] #create enum for directions to avoid using hardcoded numbers dirEnum = misc.enum('UP','DOWN','LEFT','RIGHT','UPLEFT','UPRIGHT','DOWNLEFT','DOWNRIGHT','NONE') number_to_speed_vect = {dirEnum.UP:up,dirEnum.DOWN:down,\ dirEnum.LEFT:left,dirEnum.RIGHT:right,\ dirEnum.UPLEFT:upleft,dirEnum.UPRIGHT:upright,\ dirEnum.DOWNLEFT:downleft,dirEnum.DOWNRIGHT:downright,\ dirEnum.NONE:none} number_to_opposite_direction = [dirEnum.DOWN,dirEnum.UP,\ dirEnum.RIGHT,dirEnum.LEFT,\ dirEnum.DOWNRIGHT,dirEnum.DOWNLEFT,\ dirEnum.UPRIGHT,dirEnum.UPLEFT]