# import modulesfromrandomimport*fromturtleimport*# set the screenscreen=Screen()#choose background colorscreen.bgcolor("yellow")# define the function# for creating a square section# for the gamedefSquare(x,y):up()goto(x,y)down()color('white','green')begin_fill()forcountinrange(4):forward(50)left(90)end_fill()# define function to# keep a check of index numberdefNumbering(x,y):returnint((x+200)//50+((y+200)//50)*8)# define functiondefCoordinates(count):return(count%8)*50-200,(count//8)*50-200# define function# to make it interactive# user clickdefclick(x,y):spot=Numbering(x,y)mark=state['mark']ifmarkisNoneormark==spotortiles[mark]!=tiles[spot]:state['mark']=spotelse:hide[spot]=Falsehide[mark]=Falsestate['mark']=Nonedefdraw():clear()goto(0,0)stamp()forcountinrange(64):ifhide[count]:x,y=Coordinates(count)Square(x,y)mark=state['mark']ifmarkisnotNoneandhide[mark]:x,y=Coordinates(mark)up()goto(x+2,y)color('black')write(tiles[mark],font=('Arial',30,'normal'))update()ontimer(draw,10)tiles=list(range(32))*2state={'mark':None}hide=[True]*64# for shuffling the# numbers placed inside# the square tilesshuffle(tiles)tracer(False)onscreenclick(click)draw()done()