game_matrix01
index
/home/tom/py/gm/game_matrix01.py

# ==================================================================
# 3D Matrix Gane - Define Classes, etc,
# ==================================================================

 
Modules
       
game_matrix_config
game_matrix_menu
random

 
Classes
       
Node

 
class Node
    The node at each cell in the 3D matrix.
 
Attributes:
  x                 node's x coordinate
  y                 node's y coordinate
  z                 node's z coordinate
  up                y axis (y+1) adjacent node, if any
  down              y axis (y-1) adjacent node, if any
  forward           z axis (z+1) adjecent node, if any
  backward          z axis (z-1) adjecent node, if any
  left              x axis (x-1) adjecent node, if any
  right             x axis (x+1) adjecent node, if any
  wormhole          wormhole node, if any
  id                node's ID (integer)
 
  Methods defined here:
__init__(self, x, y, z, id)
Initialize a matrix node.
get_coords(self)
Return a node's coordinates as a tuple (x,y,z).
get_id(self)
Return a Node's id.
get_nav_info(self)
Return a node's navigation information as a list of tuples.
 
The returned navigation tuples are (x,y,z) coordinates of the
destination node or 'None' if there is no destination.
 
The order of the list is
[ up, down, forward, backward, left, right, wormhole ].
minimum_display(self)
Display basic node information (x, y, z, and id)
set_backward(self, node)
Set the backward link.
set_down(self, node)
Set the down link.
set_forward(self, node)
Set the forward link.
set_left(self, node)
Set the left link.
set_right(self, node)
Set the right link.
set_up(self, node)
Set the up link.
set_wormhole(self, node)
Set the wormhole link.

 
Functions
       
create_matrix(mtrxedge, id=100)
Return a matrix of unconnected nodes.
 
(A cube mtrxedge by mtrxedge by mtrxedge)
display_matrix(mtrx, mtrxedge)
Display the minimum information about every
node in the matrix.
display_matrix_info()
Display matrix information.
display_node_nav_info(node)
Display a node's navigation information.
 
Display:
    Available move directions
    Blocked move directions
    Wormhole available or not available
reset(mtrx, mtrxedge)
Reset all of the matrix nodes movement links.
(up, down, forward, backward, left, right, wormhole = None)
start_end_nodes(mtrxedge)
Calculate the coordinates of randomly selected
start and end nodes for the path through the matrix.
 
Return the coordinates as a tuple.
(start_x,start_y,0,end_x,end_y,mtrxedge-1)
 
Note the hard Z coordinate.