-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
42 lines (30 loc) · 1.21 KB
/
start.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
33
34
35
36
37
38
39
40
41
42
import argparse
import logging
from utilities import safe_int_checker, print_graphics, print_player_type_selection
from play import Play
def main():
"""
The primary function of this application that runs the game.
Parameters:
None
Logs:
An error if the string url is entered incorrectly.
"""
logging.basicConfig(filename='errors_log/errors.log', level=logging.ERROR, format='%(message)s')
logging.getLogger('assignment8')
parser = argparse.ArgumentParser()
parser.add_argument('--player1', default="human", help='choose human or computer')
parser.add_argument('--player2', default="human", help='choose human or computer')
parser.add_argument('--timed', default=0, const=60, nargs='?', help='pass the --timed flag to play for 1 min.')
args = parser.parse_args()
player1 = args.player1
player2 = args.player2
timed = args.timed
print_graphics('artwork/PIG-ART.txt')
print_player_type_selection(player1, player2)
play = Play([player1, player2], timed)
play.start()
print_graphics('artwork/END.txt')
print("\nThank you for playing PIG. Please run the script to play again!\n")
if __name__ == '__main__':
main()