Tic-Tac-Toe/main.py
2020-12-28 22:39:37 +01:00

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()