sokosol.c
author viric@llimona
Sun, 07 May 2006 13:32:51 +0200
changeset 23 e5d0f7cba122
parent 6 bfbca2c0fc70
child 26 95fccfcbd04c
permissions -rw-r--r--
Corrected some regexps (limiting ^$)
viric@6
     1
#include <assert.h>
viric@0
     2
#include <stdio.h>
viric@0
     3
#include <string.h>
viric@0
     4
#include <stdlib.h>
viric@4
     5
#include "general.h"
viric@0
     6
viric@0
     7
#define NBOX(n) ((n)<<2)
viric@0
     8
viric@0
     9
/* SOKOBAN Solution Finder
viric@0
    10
 *
viric@0
    11
 * Input File Format: XSB
viric@0
    12
 *
viric@0
    13
 * XSB Format definition:
viric@0
    14
 * 	Character matrix of:
viric@0
    15
 * 		@	MAN
viric@0
    16
 * 		#	WALL
viric@0
    17
 * 		$	BOX
viric@0
    18
 * 		*	BOX over PLATFORM
viric@0
    19
 * 		+	PLATFORM
viric@4
    20
 * 		-	CORNER (optional) Where a BOX should not be put
viric@0
    21
 * 	Everything that cannot be reached by the man or boxes (WALLS) must be
viric@0
    22
 * 	marked as is: WALLS.
viric@0
    23
 * 	All lines must be of the same length.
viric@0
    24
 */
viric@0
    25
viric@0
    26
viric@0
    27
viric@0
    28
viric@0
    29
viric@0
    30
viric@0
    31
viric@0
    32
int main(int argn, char **argv)
viric@0
    33
{
viric@0
    34
	struct Map Morigin;
viric@0
    35
viric@0
    36
	if (argn != 2)
viric@0
    37
	{
viric@0
    38
		printf("Usage: %s <mapfile>\n", argv[0]);
viric@0
    39
		exit(3);
viric@0
    40
	}
viric@0
    41
	ReadMap(&Morigin, argv[1]);
viric@6
    42
	assert(Morigin.NumPlatforms > Morigin.NumBoxesInPlatform);
viric@0
    43
viric@6
    44
	init_os();
viric@0
    45
viric@6
    46
	return solve_map(Morigin);
viric@0
    47
}