Skip to content

Instantly share code, notes, and snippets.

@Gaivile
Created July 18, 2016 21:37
Show Gist options
  • Save Gaivile/377be5864ab2123b63cfc5cafe8c6cfb to your computer and use it in GitHub Desktop.
Save Gaivile/377be5864ab2123b63cfc5cafe8c6cfb to your computer and use it in GitHub Desktop.
Init() function for pset3 fifteen
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