用户:
关灯_黑_柚子查看:4 回复:3 评论:4 创建时间:2022-12-26T15:33:50

#2022年11月20日11:21:29
#Python
#变量
xy=[0,1,2,3,\
0,0,0,0,\
0,0,0,0,\
0,0,0,0]
return_direction=False
temp_xy=False
def mobile(direction):
global xy
#//////////ERROR//////////#
if direction =='a'or'w':
temp_xy=15
if direction =='s'or'd':
temp_xy=0
#//////////ERROR//////////#
print('temp_xy='+str(temp_xy))
print('direction='+direction)
if temp_xy != False:
print('Ln:21 True')
if xy[temp_xy] == 0:
print('Ln:23 True')
if xy[temp_xy+1] == 0:
print('Ln:25 True')
if xy[temp_xy+2] == 0:
xy[temp_xy+2]=xy[temp_xy+3]
xy[temp_xy+3]=0
else:
print('Ln:25 False')
xy[temp_xy+1]=xy[temp_xy+3]
xy[temp_xy+3]=0
else:
print('Ln:23 False')
print(xy[temp_xy])
xy[temp_xy]=xy[temp_xy+3]
xy[temp_xy+3]=0
else:
print('Ln:21 False')
def merge():
pass
mobile('a')
print('xy='+str(xy))

(真麻烦,发个帖还要翻代码库,翻帖子)
(链接被屏蔽了,只能发图片)
SCS_user_LoeheodVOQ#2022年11月20日11:21:29
#Python
#变量
xy=[0,1,2,3,\
0,0,0,0,\
0,0,0,0,\
0,0,0,0]
return_direction=False
temp_xy=False
def mobile(direction):
global xy
#//////////ERROR//////////#
if direction == 'a' or direction == 'w': # 第一种写法
temp_xy=15
if direction in ['s', 'd']: # 第二种写法
temp_xy=0
#//////////ERROR//////////#
print('temp_xy='+str(temp_xy))
print('direction='+direction)
if temp_xy != False:
print('Ln:21 True')
if xy[temp_xy] == 0:
print('Ln:23 True')
if xy[temp_xy+1] == 0:
print('Ln:25 True')
if xy[temp_xy+2] == 0:
xy[temp_xy+2]=xy[temp_xy+3]
xy[temp_xy+3]=0
else:
print('Ln:25 False')
xy[temp_xy+1]=xy[temp_xy+3]
xy[temp_xy+3]=0
else:
print('Ln:23 False')
print(xy[temp_xy])
xy[temp_xy]=xy[temp_xy+3]
xy[temp_xy+3]=0
else:
print('Ln:21 False')
def merge():
pass
mobile('a')
print('xy='+str(xy))点赞1
评论