Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- maxvalue = 90
- board = maxvalue*["B"]
- counter = 2
- def flipPiece(board, piece):
- if board[piece-1] == "W": #"-1" because ordinal -> cardinal
- board[piece-1] = "B"
- else:
- board[piece-1] = "W"
- def counterPossibilities(counter):
- possibilities = math.floor(maxvalue / counter) #math.floor rounds down any floating point
- return int(possibilities)
- def flipBoard(possibilities, counter, board):
- for i in range(1, possibilities + 1):
- flipPiece(board, counter * i)
- while counter < maxvalue + 1:
- flipBoard(counterPossibilities(counter), counter, board)
- print(board)
- print(counter)
- counter += 1
Advertisement
Add Comment
Please, Sign In to add comment