Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created May 8, 2023 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaurel/eafedbda1f0348884a29edbb2cfcce83 to your computer and use it in GitHub Desktop.
Save ssaurel/eafedbda1f0348884a29edbb2cfcce83 to your computer and use it in GitHub Desktop.
Flip methods for a Flipping Bits Game on SSaurel's Blog
# 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