Tic-Tac-Toe/main.py

21 lines
471 B
Python
Raw Normal View History

2020-12-24 06:10:53 +01:00
import sys, getopt
from TicTacToe import TicTacToe
2020-12-20 21:46:22 +01:00
2020-12-24 06:10:53 +01:00
number_of_rounds = None
2020-12-25 04:20:54 +01:00
try:
opts, args = getopt.getopt(sys.argv[1:], "n:", ["numberofrounds="])
except getopt.GetoptError:
2020-12-25 04:45:14 +01:00
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:
2020-12-25 04:20:54 +01:00
print("main.py -n <numberofrounds>")
sys.exit()
2020-12-20 02:13:38 +01:00
game = TicTacToe()
2020-12-24 06:10:53 +01:00
for x in range(0, int(number_of_rounds)):
2020-12-25 04:59:32 +01:00
game.run()