Beispiel #1
0
/*
 * Initializes the Befunge program structure.
 * Does not initialize the Befunge code, use bfg_load_code for that
 * Start with a fresh stack,
 * the instruction pointer in the top left,
 * pointing to the right,
 * and in command mode.
 * Returns 1 if successful, else 0.
 */
int bfg_init(struct befunge_program * bf) {
	if(!bfs_init(&bf->stack)) return 0; /* if stack init fails then fail */
	bf->ip.row= 0;
	bf->ip.col= 0;
	dirset(&bf->dir, RIGHT);
	bf->command_mode= 1;
	bf->done= 0;
	return 1;
}
Beispiel #2
0
int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		init();
		bfs_init();
		bisearch();
	}
	return 0;
}