Skip to content

script

This is a Python script that runs the Gym and agent, typically from the command-line. See the Makefile for how to run this script.

pp = pprint.PrettyPrinter(width=41, compact=True) module-attribute

ascii_list(al)

Source code in roc/script.py
15
16
17
18
19
20
21
def ascii_list(al: list[int]) -> str:
    result_string = ""

    for ascii_value in al:
        result_string += chr(ascii_value)

    return result_string

cli(arg)

Source code in roc/script.py
41
42
43
44
45
@click.command
@click.option("--arg", default=1)
def cli(arg: Any) -> None:
    roc.init()
    roc.start()

int_list(al)

Source code in roc/script.py
24
25
26
27
28
29
30
def int_list(al: list[int]) -> str:
    result_string = ""

    for ascii_value in al:
        result_string += str(ascii_value) + " "

    return result_string

print_screen(screen, *, as_int=False)

Source code in roc/script.py
33
34
35
36
37
38
def print_screen(screen: list[list[int]], *, as_int: bool = False) -> None:
    for row in screen:
        if not as_int:
            print(ascii_list(row))  # noqa: T201
        else:
            print(int_list(row))  # noqa: T201