#!/usr/bin/env python

import sys
from Search import Search

# Usage for user error #
def usage(): 
  print "[USAGE]: ./find_route points_file adjacencyMatrix_file searchType start end\n searchTypes:\n Breadth-First Seach: breadth, breadth-first, BFS\n Depth-First Search: depth, depth-first, DFS\n Uniform Search: uniform, U, UNIFORM"

if __name__ == '__main__':
  if len(sys.argv) != 6:
    usage()
    sys.exit(0)
  search = Search( sys.argv[1], sys.argv[2], ord(sys.argv[4][0].lower())-ord('a'), ord(sys.argv[5][0].lower())-ord('a') ) # pass the arguments, adjacency matrix and point files
  # Type of search to perform
  searchType = sys.argv[3]
  if searchType == "breadth" or searchType == "breadth-first" or searchType == "BFS":
    print search.breadth()
  elif searchType == "depth" or searchType == "depth-first" or searchType == "DFS":
    print search.depth()
  elif searchType == "uniform" or searchType == "U" or searchType == "UNIFORM":
    print search.uniform()
