#!/usr/bin/env python3

import sys, getopt
import pyMadness

def main(argv):
    first = ""
    second = ""
    verbose = False
    neutral = False
    test = False
    try:
        opts, args = getopt.getopt(argv, "hf:s:vnt", ["help", "first=", "second=", "verbose", "neutral", "test"])
    except getopt.GetoptError as err:
        print(err)
        usage()
        sys.exit(2)
    output = None
    verbose = False
    for o, a in opts:
        if o in ("-v", "--verbose"):
            verbose = True
        elif o in ("-n", "--neutral"):
            neutral = True
        elif o in ("-t", "--test"):
            test = True
        elif o in ("-h", "--help"):
            usage()
            sys.exit
        elif o in ("-f", "--first"):
            first = a
        elif o in ("-s", "--second"):
            second = a
        else:
            assert False, "unhandled option"
    if (test):
        testResult = pyMadness.Test(verbose)
        if (testResult):
            print ("Test result - pass")
        else:
            print ("Test result - fail")
    else:
        dict_score = {}
        dict_score = pyMadness.Calculate(first, second, neutral, verbose)

def usage():
    usage = """
    -h --help                 Prints this
    -v --verbose              Increases the information level
    -f --first                First Team (The Away Team)
    -s --second               Second Team (The Home Team)
    -n --neutral              Playing on a neutral Field
    -t --test                 runs test routine to check calculations
    """
    print (usage) 

if __name__ == "__main__":
  main(sys.argv[1:])

@@ -74,21 +74,25 @@
 v):%0A    
-first
+stat_file
  = %22%22%0A  
@@ -93,22 +93,28 @@
  %22%22%0A    
-second
+bracket_file
  = %22%22%0A  
@@ -119,35 +119,56 @@
     
-verbose = False%0A    neutral
+merge_file = %22%22%0A    output_file = %22%22%0A    verbose
  = F
@@ -245,14 +245,17 @@
 , %22h
-f:s
+s:b:m:o
 :v
-n
 t%22, 
@@ -268,24 +268,65 @@
 %22, %22
-first=%22, %22second
+stat_file=%22, %22bracket_file=%22, %22merge_file=%22, %22output_file
 =%22, 
@@ -339,19 +339,8 @@
 se%22,
- %22neutral%22,
  %22te
@@ -566,74 +566,8 @@
 rue%0A
-        elif o in (%22-n%22, %22--neutral%22):%0A            neutral = True%0A
     
@@ -724,20 +724,24 @@
  (%22-
-f
+s
 %22, %22--
-first
+stat_file
 %22):%0A
@@ -752,21 +752,25 @@
         
-first
+stat_file
  = a%0A   
@@ -791,43 +791,195 @@
  (%22-
-s
+b
 %22, %22--
-second%22):%0A            second
+bracket_file%22):%0A            bracket_file = a%0A        elif o in (%22-b%22, %22--merge_file%22):%0A            merge_file = a%0A        elif o in (%22-o%22, %22--output_file%22):%0A            output_file
  = a
@@ -1241,96 +1241,158 @@
     
+Pre
 dict
-_score = %7B%7D%0A        dict_score = pyMadness.Calculate(first, second, neutral, verbose
+Tournament(stat_file = %22kenpom.json%22, bracket_file = %22espn.json%22, merge_file = %22merge.csv%22, output_file = %22predict.csv%22)%0A        print (%22done.%22
 )%0A%0Ad
@@ -1532,21 +1532,21 @@
    -
-f --first    
+s --stat_file
     
@@ -1557,149 +1557,242 @@
     
-First Team (The Away Team
+stats file (json file format
 )%0A    -
-s --second               Second Team (The Home Team
+b --bracket_file         bracket file (json file format)%0A    -m --merge_file           merge file (csv/spreadsheet file format
 )%0A    -
-n --neutral              Playing on a neutral Field
+o --output_file          output file (csv/spreadsheet file format)
 %0A   
@@ -1886,16 +1886,184 @@
 sage) %0A%0A
+def PredictTournament(stat_file, bracket_file, merge_file, output_file):%0A    print (stat_file)%0A    print (bracket_file)%0A    print (merge_file)%0A    print (output_file)%0A%0A
 if __nam

start the predict tournament code