Created
July 18, 2016 21:37
-
-
Save Gaivile/377be5864ab2123b63cfc5cafe8c6cfb to your computer and use it in GitHub Desktop.
Init() function for pset3 fifteen
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
void init(void) | |
{ | |
int f = (d * d) - 1; | |
int grid [d][d]; | |
for (int i = 0; i < d; i++) | |
{ | |
for (int j = 0; j < d; j++) | |
{ | |
grid[i][j] = f; | |
f--; | |
if ((f == 2) && (d % 2) != 0)) | |
{ | |
grid[i][j] = 1; | |
f++; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment