def scoreGame(view: GameViewSource, showDisplay: bool=False, showFullDisplay: bool=False, slowDown: int=1):
    """The main game function."""

    prevFrame = None

    if showFullDisplay:
        cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
        cv2.setWindowProperty("window", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)

    servingSide = getSideSignal(view, [0, 0], showFullDisplay)
    if servingSide is None:
        print('Quiting...')
        exit(-1)

    ball = Ball(view.netX, servingSide=servingSide)
    game = GameState(view)
    game.begin(view.netX, servingSide)
    CURRENT_DISPLAY = getDisplay(game.score, servingSide)
    print('Got serving side')

    gameMonitor = GameMonitor(game)

    while True:
        frame = view.read()

        # End of video
        if frame is None:
            print("Stream ended.")
            break

        if ball.updatePosFromFrame(prevFrame, frame, showProcessedFrame=False, showMaskFrame=False):
            ball.updateProcessedData(output=False)
            game.updateState(ball, output=False)

            gameMonitor.printNewEvents()

            if showDisplay:
                key = cv2.waitKey(int(1000 / view.fps * (slowDown if slowDown != -1 else 1.0)))
                if key == ord('q'):
                    print('Quiting.')
                    exit(0)
                if slowDown == -1:
                    input('>')

            if showFullDisplay:
                newDisplay = gameMonitor.getGameDisplay()
                if newDisplay is not None:
                    CURRENT_DISPLAY = newDisplay
                cv2.imshow('window', CURRENT_DISPLAY)
                if cv2.waitKey(1) == ord('q'):
                    break

        prevFrame = frame