sokosol.c
author viric@llimona
Sun, 07 May 2006 13:34:25 +0200
changeset 25 b37843173279
parent 6 bfbca2c0fc70
child 26 95fccfcbd04c
permissions -rw-r--r--
Porting from sokoban/caixes the show_map changes.
Corrects possible sigsegv because of actual_map.
Better separation of sigalarm display / not-signal display.
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "general.h"

#define NBOX(n) ((n)<<2)

/* SOKOBAN Solution Finder
 *
 * Input File Format: XSB
 *
 * XSB Format definition:
 * 	Character matrix of:
 * 		@	MAN
 * 		#	WALL
 * 		$	BOX
 * 		*	BOX over PLATFORM
 * 		+	PLATFORM
 * 		-	CORNER (optional) Where a BOX should not be put
 * 	Everything that cannot be reached by the man or boxes (WALLS) must be
 * 	marked as is: WALLS.
 * 	All lines must be of the same length.
 */







int main(int argn, char **argv)
{
	struct Map Morigin;

	if (argn != 2)
	{
		printf("Usage: %s <mapfile>\n", argv[0]);
		exit(3);
	}
	ReadMap(&Morigin, argv[1]);
	assert(Morigin.NumPlatforms > Morigin.NumBoxesInPlatform);

	init_os();

	return solve_map(Morigin);
}