0
這是定義手數我需要幫助切片的益智遊戲
def move(pos,empty,board):
m = pos[0]//
n = pos[1]
if empty == (m-1,n) or empty == (m+1,n)or empty == (m,n-1) or empty == (m,n+1):
board[empty[0]][empty[1]] = num
board[m][n] = 0
empty = (m,n)
else :
print('can\'t move! try again.')
結果代碼:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
sliding_puzzle()
File "C:\Users\sungod\Desktop\과제.py", line 57, in sliding_puzzle
(empty,board)=move(pos,empty,board)
File "C:\Users\sungod\Desktop\과제.py", line 35, in move
m = pos[0]
TypeError: 'NoneType' object is not subscriptable