Created
May 8, 2023 14:09
-
-
Save ssaurel/eafedbda1f0348884a29edbb2cfcce83 to your computer and use it in GitHub Desktop.
Flip methods for a Flipping Bits Game on SSaurel's Blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# method to flip a column | |
def flipcol(self, r): | |
for i in range(len(self.board[r])): | |
self.board[r][i] ^= 1 # 0 -> 1, 1 -> 0 | |
# method to flip a row | |
def fliprow(self, c): | |
for row in self.board: | |
row[c] ^= 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment