3D Matrix Game - Matrix Definition File

Introduction

A matrix definition file is a "hand coded" matrix and path used for testing, etc.

Matrix Definition File Format

  1. lines with the first non-blank character a '#' are comments and are ignored
  2. blank lines are skipped
  3. only lowercase keywords and integers are allowed
  4. keywords and coordinates are separated by one or more spaces
  5. coordinates are matrix x,y,z coordinates
  6. startnode, endnode, currentnode have matrix x,y,z coordinates
  7. coordinates are from zero (0) to matrxedge-1
  8. file creator is responsible for ensuring coordinates are within the matrix
  9. allowed node movement directions are: forward, backward, up, down, left, right
  10. file creator is responsible for ensuring movement directions do not exceed the matrix coordinates
  11. line formats are:
    • matrixedge <edge length>
    • startnode <node coords>
    • endnode <node coords>
    • currentnode <node coords>
    • node <node coords> <movement direction> <bi-direct>
    • wormhole <source coords> <destination coords> <bi-direct>

    if <bi-direct> is "twoway", the link is two way (bi-directional).
    if <bi-direct> ls "oneway", the link is one way (one direction only).
    if there is no <bi-direct> parameter (it does not exist) the link is one way.

Examples

# a simple matrix definition

matrixedge   5
startnode    2 2 0
endnode      2 2 4
currentnode  2 2 0

node 2 2 0  forward  twoway
node 2 2 1  forward  oneway
node 2 2 2  forward
node 2 2 3  forward

# another simple matrix definition

matrixedge   5
startnode    2 2 0
endnode      2 2 4
currentnode  2 2 0

node 2 2 0  forward    twoway
node 2 2 1  forward
node 2 2 2  forward    oneway
node 2 2 3  forward
node 2 1 4  up

wormhole 2 2 1  2 1 4  twoway

# ---------------------------------------------------
# a more complicated matrix definition
#
# Note: this matrix definition is not complicated enough.
#       you should fill in more of the matrix paths.
#
# a. the end node is not on the maximum Z plane
# b. all wormholes should go in both directions
# c. all node directions, if any, are bi-directional
#
# ---------------------------------------------------------------

matrixedge   9
startnode    4 2 0
endnode      8 6 7
currentnode  4 2 0

node 4 2 0  forward    twoway
node 4 2 0  up         twoway
node 4 2 0  right      twoway

node 4 2 1  down
node 4 2 1  right      twoway
node 4 3 0  forward    twoway
node 4 3 0  left       twoway
node 5 2 0  forward    twoway

wormhole 5 2 0  8 6 8  twoway 

node 8 6 8  backward   twoway