Setup BitPlane and Neighborhood
parent
307b025d01
commit
fbc9cdc435
|
@ -0,0 +1 @@
|
||||||
|
__pycache__/
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import numpy
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ class BitPlane:
|
||||||
one can allow for ECHOing, providing a more intuitive sense of "velocity" based on the master.
|
one can allow for ECHOing, providing a more intuitive sense of "velocity" based on the master.
|
||||||
|
|
||||||
That is not to say one could not have multiple CAM's operating simultaneously though. We can consider
|
That is not to say one could not have multiple CAM's operating simultaneously though. We can consider
|
||||||
a configuration to consist of an arbitrary numer of planes, of which one is the master, but multiple
|
a configuration to consist of an arbitrary number of planes, of which one is the master, but multiple
|
||||||
masters can exist in separate CAMs that can interact with one another.
|
masters can exist in separate CAMs that can interact with one another.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, *dimensions):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
pass
|
self.grid = np.zeros(dimensions)
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
class Cells(enum.Enum):
|
||||||
|
"""
|
||||||
|
Allows for specification of which cells should be considered in a 2D or 3D matrix.
|
||||||
|
|
||||||
|
For example, to specify the CENTER and NORTH cells, we consider CENTER | NORTH. It
|
||||||
|
does not make sense to use FORWARD and BACKWARD in a 2D matrix, as that specifies
|
||||||
|
looking up and down a bitplane for further cells.
|
||||||
|
|
||||||
|
For higher level dimensions, forgo use of this enumeration entirely, as described in
|
||||||
|
the Neighborhood class.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 2D & 3D
|
||||||
|
CENTER = 1 << 0
|
||||||
|
NORTH = 1 << 1
|
||||||
|
NORTHEAST = 1 << 2
|
||||||
|
EAST = 1 << 3
|
||||||
|
SOUTHEAST = 1 << 4
|
||||||
|
SOUTH = 1 << 5
|
||||||
|
SOUTHWEST = 1 << 6
|
||||||
|
WEST = 1 << 7
|
||||||
|
NORTHWEST = 1 << 8
|
||||||
|
NORTH = 1 << 9
|
||||||
|
|
||||||
|
# 3D
|
||||||
|
FORWARD = 1 << 10
|
||||||
|
BACKWARD = 1 << 11
|
||||||
|
|
||||||
|
# Shortcuts
|
||||||
|
NEUMANN = NORTH | EAST | SOUTH | WEST
|
||||||
|
MOORE = NORTH | NORTHEAST | EAST | SOUTHEAST | SOUTH | SOUTHWEST | WEST | NORTHWEST | NORTH
|
||||||
|
|
||||||
|
|
||||||
|
class Neighborhood:
|
||||||
|
"""
|
||||||
|
The following represents the cells that must be considered when applying a ruleset.
|
||||||
|
|
||||||
|
Since neighborhoods can be made arbitrarily complex, we allow extending in all directions. For example,
|
||||||
|
the basic Moore neighborhood comprises of the 8 cells surrounding the center, but what if we wanted
|
||||||
|
these 8 and include the cell north of north? The following enables this:
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
This allows indexing at levels beyond 3D, which the Cells enumeration does not allow, though visualization
|
||||||
|
at this point isn't possible.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue