diff --git a/gauss-turing/webserver/gauss_turing.py b/gauss-turing/webserver/gauss_turing.py index 98f9043..74d26f9 100644 --- a/gauss-turing/webserver/gauss_turing.py +++ b/gauss-turing/webserver/gauss_turing.py @@ -1,7 +1,6 @@ import numpy as np import random import pygame - import os BLACK = np.array([0, 0, 0], dtype=np.uint8) @@ -377,8 +376,10 @@ class Game: def process_inputs(self): # proceed events for event in pygame.event.get(): + if event.type == pygame.QUIT: + self.state = 'quit' # handle MOUSEBUTTONUP - if event.type == pygame.MOUSEBUTTONUP: + elif event.type == pygame.MOUSEBUTTONUP: pos = pygame.mouse.get_pos() # select command to edit by the programmer @@ -439,6 +440,8 @@ class Game: self.state = self.prg.step() elif self.state == 'reset': self.state = self.reset() + elif self.state == 'quit': + running = False else: print("unknown state") return