I'm programming a simple text adventure game with Python 3 and the `cmd` module. 

I need to somehow trigger the game over method but I didn't find a solution on document.

The `CMD` module got the `do_quit()` function, but that needs user input, and `quit()` or `exit()` kills the whole program, whereas I just need to get out of `cmdloop()`

Any idea how to deal with this?

Thanks in advance!

```
def moveDirection(direction):
global location

if direction in rooms[location]:
        if rooms[rooms[location][direction]].get(UNLOCKED, True) == True:
            print('You move to the %s.' % direction)
            location = rooms[location][direction]
            if location == 'Hallway' and bGuardAlive == True:
                print("Game over! Guard caught you!")

            printLocation(location)

        else:
            print("Door is locked")
else:
    print('You cannot move in that direction')

def main():
    printLocation(location)
    GameLoop().cmdloop()

class GameLoop(cmd.Cmd):
prompt = '\n> '

def do_quit(self, arg):
    """Quit the game."""
    return True

```