-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
32 lines (27 loc) · 1.19 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import argparse
import BadAI
import HumanSolver
import Tester
# Edit only the following line to change the AI Class to test
SOLVER = BadAI.BadAI
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Run the word game')
parser.add_argument('-l', '--length', type=int,
help='Word length', default=5)
parser.add_argument('-g', '--guesses', type=int,
help='Guesses limit', default=6)
parser.add_argument('-t', '--test', action='store_true',
help='Run the tests')
parser.add_argument('-c', '--cases', type=int,
help='Number of test cases', default=100)
parser.add_argument('-p', '--print', type=int,
help='Print mode (0: no print, 1: print results boxes, 2: print guesses, 3: print game results)',
default=0)
args = parser.parse_args()
# By default, run the game to play in terminal
if not args.test:
hs = HumanSolver.HumanSolver(args.length, args.guesses, args.print)
hs.gameLoop()
exit(0)
tester = Tester.Tester(args.length, args.cases, args.guesses)
tester.test(SOLVER, args.print)