All pastes #440745 Raw Edit

Stuff

public c v1 · immutable
·published 2007-04-15 08:02 UTC
rendered paste body
int solve(board_t *board){    int x;	int y;			ASSERT(board != NULL);		if (is_solved(board) == 1)		return 1;			for (x = 0; x < 15; x++)	{		if (board->occupied[x] != 0)		{			for (y=0; y < 15; y++)			{				if ((allowed[x][y] != -1) && (board->occupied[y] == 0) &&					(board->occupied[(allowed[x][y])] != 0))				{					board->occupied[y] = 1;					board->occupied[x] = 0;					board->occupied[(allowed[x][y])] = 0;										if (solve(board) == 1)					{						return 1;					}					else /*undo move*/					{						board->occupied[y] = 0;						board->occupied[x] = 1;						board->occupied[allowed[x][y]] = 1;					}				}			}		}	}		return 0;