I am creating a big program, so first there is a cmd var that asks for an input but when I type in snake_game it runs the problem is whenever the whole snake game ends the whole program ends like the cmd var ends. Here is the GitHub.
I want for when the program ends, the cmd appears again, so the user can keep typing other commands
What part of the code you wrote do you think should be allowing the game not to exit the program?
The following conditions are what end up calling the game_over function and the game_over function calls the built-in quit function. So if you want something else to happen, I suggest not calling quit.
if snake_position < 0 or snake_position > window_x-10:
if snake_position < 0 or snake_position > window_y-10:
# Touching the snake body
for block in snake_body[1:]:
if snake_position == block and snake_position == block:
I have tried calling sys.exit() but that ends up with the same result, and I have also tried looping the game then calling a break when the game ends. But the loop just does not work because it is called within the def() function. So I have no clue honestly of what to do now.