What wrong with this code, it is looping infinite/getting tle

Continuing the discussion from Help me in ZCO14001 (Video Game):

hello, can someone reply by looking into my code

PROBLEM
SOLUTION