MCPcopy Create free account
hub / github.com/chynl/snake / parse_args

Function parse_args

main.py:19–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18
19def parse_args() -> argparse.Namespace:
20 parser = argparse.ArgumentParser()
21
22 parser.add_argument(
23 "-m",
24 choices=["human", "graph", "rl"],
25 default="graph",
26 help="set game mode (default: graph)",
27 type=str,
28 dest="mode",
29 )
30
31 parser.add_argument(
32 "-f",
33 metavar="<freq>",
34 default=80,
35 help="set snake move frequency in milliseconds (default: 80)",
36 type=int,
37 dest="move_freq",
38 )
39
40 parser.add_argument(
41 "-g",
42 help="show grid lines",
43 action="store_true",
44 dest="show_grid",
45 )
46
47 parser.add_argument(
48 "-r",
49 help="record game play",
50 action="store_true",
51 dest="record_frames",
52 )
53
54 parser.add_argument(
55 "-s",
56 metavar="<seed>",
57 default=None,
58 help="set random seed for food generation",
59 type=int,
60 dest="seed",
61 )
62
63 parser.add_argument(
64 "-b",
65 metavar="<rounds>",
66 default=None,
67 help="run benchmark for the given number of rounds",
68 type=int,
69 dest="bench_rounds",
70 )
71
72 return parser.parse_args()
73
74
75if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected