21 lines
471 B
Python
21 lines
471 B
Python
import sys, getopt
|
|
from TicTacToe import TicTacToe
|
|
|
|
number_of_rounds = None
|
|
try:
|
|
opts, args = getopt.getopt(sys.argv[1:], "n:", ["numberofrounds="])
|
|
except getopt.GetoptError:
|
|
print("main.py -n <numberofrounds>")
|
|
sys.exit(2)
|
|
|
|
if(len(sys.argv) != 1):
|
|
for opt, arg in opts:
|
|
if opt in ("-n", "--numberofrounds"):
|
|
number_of_rounds = arg
|
|
else:
|
|
print("main.py -n <numberofrounds>")
|
|
sys.exit()
|
|
|
|
game = TicTacToe()
|
|
for x in range(0, int(number_of_rounds)):
|
|
game.run() |