parameters: (self)
docstring: Check whether the snake has died (out of bounds or doubled up.)
docstring_summary: Check whether the snake has died (out of bounds or doubled up.)
docstring_tokens: Check whether the snake has died ( out of bounds or doubled up . )
function: def check_death(self):
          """Check whether the snake has died (out of bounds or doubled up.)"""
  
          head = self.snake[0]
          if head.x < 0 or head.y < HEIGHT_SCORE or head.x >= WIDTH or head.y >= HEIGHT:
              self.death_event()
          elif len(self.snake) != len(set(self.snake)):
              self.death_event()
function_tokens: def check_death ( self ) : head = self . snake [ 0 ] if head . x < 0 or head . y < HEIGHT_SCORE or head . x >= WIDTH or head . y >= HEIGHT : self . death_event ( ) elif len ( self . snake ) != len ( set ( self . snake ) ) : self . death_event ( )