Created
February 10, 2019 15:22
-
-
Save JPMoresmau/943a4e4b1546ed44896b986b81800b62 to your computer and use it in GitHub Desktop.
Lovecraft: swap
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
fn swap(grid: &Grid, pos: Pos) -> Grid { | |
let mut grid = grid.clone(); | |
for a in 0..4 { | |
grid[pos.0][a] = !grid[pos.0][a]; | |
} | |
for a in 0..4 { | |
grid[a][pos.1] = !grid[a][pos.1]; | |
} | |
grid[pos.0][pos.1] = !grid[pos.0][pos.1]; | |
grid | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment