#! /usr/bin/python3
# ==================================================================
# 3D Matrix Game - Main Program
#
# Create random links between nodes in the matrix. Using the Links,
# find a path from the matrix start node to the end node.
#
# ------------------------------------------------------------------
# Notes:
#
# 1. the matrix is a cube (n by n by n) of nodes
#
# ------------------------------------------------------------------
# Useful links:
#
# a. docs.python.org/3/library/random.html
#
# ==================================================================
import game_matrix_config as cfg
import game_matrix01 as gm1
import game_matrix_menu as mnu
# ---- global data -------------------------------------------------
# CurrentNode matrix current (working) node
# Debug flag - print debug messages
# EndNode matrix path end node
# MatrixEdge nodes per matrix dimensions (x,y,z)
# StartNode matrix path start node
# Verbose flag - print verbose messages
# ------------------------------------------------------------------
global CurrentNode
global Debug
global EndNode
global MatrixEdge
global StartNode
global Verbose
# --------------------------------------------------------------
# ---- main ----------------------------------------------------
# --------------------------------------------------------------
if __name__ == '__main__':
# ---- calculate the start and end node coordinates
# ---- for the path thru the matrix
sx,sy,sz,ex,ey,ez = gm1.start_end_nodes(cfg.MatrixEdge)
if cfg.Verbose or cfg.Debug:
print('Start node: {},{},{} End node: {},{},{}'.
format(sx,sy,sz,ex,ey,ez))
mnu.pause_program()
# ---- create 3D matrix
mtrx = gm1.create_matrix(cfg.MatrixEdge,100)
# ---- set current node
cfg.CurrentNode = mtrx[sx][sy][sz]
cfg.StartNode = mtrx[sx][sy][sz]
cfg.EndNode = mtrx[ex][ey][ez]
# ---- build matrix path link
##build_matrix_path(mtrx,cfg.MatrixEdge,
## cfg.StartNode,cfg.EndNode)
# ---- main menu
mnu.main_menu(mtrx,'Find A Path Thru The 3D Matrix')
print()