Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def throwingBlocks(field):
- def isFirstColumnFull(field):
- result = True
- for i in range(len(field)):
- result = result and (field[i][0] == '#')
- return result
- def countMoves(field, result, moves):
- if isFirstColumnFull(field):
- result[0] = min(result[0], moves)
- result[1] = max(result[1], moves)
- return
- for i in range(len(field)):
- if field[i][0] == '#':
- continue
- j = i
- column = 0
- while column < len(field[j]) and field[j][column] == '.':
- column += 1
- j -= 1
- while j < len(field) and field[j][column] == '.':
- j += 1
- j -= 1
- field[j][column] = '#'
- countMoves(field, result, moves + 1)
- field[j][column] = '.'
- INF = len(field) * len(field[0]) + 1
- result = [INF, -INF]
- countMoves(field, result, 0)
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement