boxo=[[1,1],[1,1]]
boxz_1=[[1,1,0],[0,1,1],[0,0,0]]
boxz_2=[[0,1,1],[1,1,0],[0,0,0]]
box7_1=[[1,1,0],[0,1,0],[0,1,0]]
box7_2=[[0,1,1],[0,1,0],[0,1,0]]
boxt=[[0,1,0],[1,1,1],[0,0,0]]
boxi=[[0,0,0,0,0],[0,0,0,0,0],[1,1,1,1,0],[0,0,0,0,0],[0,0,0,0,0]]
boxes=[boxo,boxz_1,boxz_2,box7_1,box7_2,boxt,boxi]
color=[0xFFE0,0x867f,0x7ef,0xfb08]
def autodown():
global box_row,box_column,box,box_id
leave()
box_row+=1
if checkvalid()==False:
box_row-=1
enter()
clear()
box=newbox()
box_column=4
box_row=0
enter()
if buttonB.value()==0:
up()
print("up")
elif yValue >40000:
right()
print("right")
elif yValue <1000:
left()
print("left")
elif xValue >40000:
down()
print("down")
else:
print("stop")
drawbox()
def up():
leave()
clockwise()
if checkvalid()==False:
counter_clockwise()
enter()
def down():
global box_row
leave()
box_row+=1
if checkvalid()==False:
box_row-=1
enter()
def left():
global box_column
leave()
box_column-=1
if checkvalid()==False:
box_column-=1
enter()
def right():
global box_column
leave()
box_column+=1
if checkvalid()==False:
box_column-=1
enter()
def restart():
display.fill(0x0000)
display.fill_rect(4,0,4,240,0x07FFF)
display.fill_rect(227,0,4,240,0x077FF)
display.text(font2,"muc hyy",30,10,color=0x4416)
display.text(font2,"A to start",30,130,color=0x7e0)
display.text(font2,"Tetris",70,60,color=0x471a)
buttonValueB=buttonB.value()
while True:
buttonValueA=buttonA.value()
if buttonValueA==0:
print("OK")
g=[]
for i in range(16):
g.append([0]*12)
enter()
game()
restart()