bug on moving fr, fl, br, bl

This commit is contained in:
secminhr 2018-10-15 08:04:36 +08:00
parent cf6336691a
commit 3bc6367a90

View File

@ -143,7 +143,8 @@ def _getLowerCross(row, col, arr):
def shiftRightUp(row, col, num, seats):
# the list is follows the predicate: n.row > (n+1).row
corner_list, highest_pos = _getUpperCross(row, col, seats)
corner_list = _arrShiftLeft(row - highest_pos[0] ,corner_list, num)
target = seats[row-1][col-1]
corner_list = _arrShiftLeft(corner_list.index(target) ,corner_list, num)
#fill in
current_row = highest_pos[0]
current_col = highest_pos[1]
@ -157,7 +158,8 @@ def shiftRightUp(row, col, num, seats):
def shiftRightDown(row, col, num, seats):
# the list is follows the predicate: n.row > (n+1).row
corner_list, highest_pos = _getLowerCross(row, col, seats)
corner_list = _arrShiftRight(row - highest_pos[0] ,corner_list, num)
target = seats[row-1][col-1]
corner_list = _arrShiftRight(corner_list.index(target) ,corner_list, num)
#fill in
current_row = highest_pos[0]
current_col = highest_pos[1]
@ -170,7 +172,8 @@ def shiftRightDown(row, col, num, seats):
def shiftLeftUp(row, col, num, seats):
corner_list, highest_pos = _getLowerCross(row, col, seats)
corner_list = _arrShiftLeft(highest_pos[0] - row ,corner_list, num)
target = seats[row-1][col-1]
corner_list = _arrShiftLeft(corner_list.index(target) ,corner_list, num)
#fill in
current_row = highest_pos[0]
current_col = highest_pos[1]
@ -183,7 +186,8 @@ def shiftLeftUp(row, col, num, seats):
def shiftLeftDown(row, col, num, seats):
corner_list, highest_pos = _getUpperCross(row, col, seats)
corner_list = _arrShiftRight(row - highest_pos[0] ,corner_list, num)
target = seats[row-1][col-1]
corner_list = _arrShiftRight(corner_list.index(target) ,corner_list, num)
#fill in
current_row = highest_pos[0]
current_col = highest_pos[1]