fn detect_collision(&mut self) -> bool {
        let next_head = self.snake.get_next_head();

        if self.snake.bad_touch(&next_head) {
            self.next_move = Game::get_new_time(GAME_OVER_RATE);
            self.game_over = true;
            return true;
        }

        if next_head.x == 0
            || next_head.y == 0
            || next_head.x == self.width - 1
            || next_head.y == self.height - 1
        {
            self.next_move = Game::get_new_time(GAME_OVER_RATE);
            self.game_over = true;
            return true;
        }

        return false;
    }
/// See if snake hit border or own body
See if snake hit border or own body
See if snake hit border or own body
fn detect_collision(&mut self) -> bool {
        let next_head = self.snake.get_next_head();
        if self.snake.bad_touch(&next_head) {
            self.next_move = Game::get_new_time(GAME_OVER_RATE);
            self.game_over = true;
            return true;
        }
        if next_head.x == 0
            || next_head.y == 0
            || next_head.x == self.width - 1
            || next_head.y == self.height - 1
        {
            self.next_move = Game::get_new_time(GAME_OVER_RATE);
            self.game_over = true;
            return true;
        }
        return false;
    }
fn detect_collision ( & mut self ) -> bool { let next_head = self . snake . get_next_head ( ) ; if self . snake . bad_touch ( & next_head ) { self . next_move = Game :: get_new_time ( GAME_OVER_RATE ) ; self . game_over = true ; return true ; } if next_head . x == 0 || next_head . y == 0 || next_head . x == self . width - 1 || next_head . y == self . height - 1 { self . next_move = Game :: get_new_time ( GAME_OVER_RATE ) ; self . game_over = true ; return true ; } return false ; }
See if snake hit border or own body
See if snake hit border or own body
&mut self
&mut self