int main(int argc, char *argv[])
{

	player_maze maze;
	SDL_on_off SDL_indicator = SDL_off; 
	possible_impossible solveable_indicator;
	int maze_dims[NUM_DIMENSIONS];
	int entrance_coords[NUM_DIMENSIONS];
	SDL_Simplewin sw;

	clear_screen();

	check_command_line_args(argc, argv, &SDL_indicator, maze, maze_dims, &sw);

	find_entrance(maze, maze_dims, entrance_coords, &sw, SDL_indicator);

	solveable_indicator = solve_maze(maze, maze_dims, entrance_coords[row], entrance_coords[col], &sw, entrance_coords);

	end_action(maze, maze_dims, solveable_indicator, &sw, SDL_indicator);

	if(SDL_indicator == SDL_on){
		// Clear up graphics subsystems
   		atexit(SDL_Quit);
	}

	return(solveable_indicator);

}
Example #2
0
void print_directions( char * * maze , int w, int h )
{
	int entrance;
	int currentLocation[2];
			
	//		FIND ENTRANCE AND EXIT POSITION
	entrance = find_entrance ( maze, w );
	setLocation ( currentLocation, 0, entrance );
	traverse( maze, currentLocation, 'S', w, h, 'S' );						// TRAVERSE!!
	//		PRINT DIRECTIONS
	
}
Example #3
0
// <-> spawn()
// only if refcount is 1, really delete it
bool zz_manager::kill (zz_node * node)
{
	assert(node);

	if (!children.empty()) { // replace _current to the first child
		_current = *(children.begin());
	}

	zz_node * parent_node = node->get_parent();

	unsigned long node_ref_count = node->get_refcount();

	if (node_ref_count != 1) { // if still refered by someone, then just call release().
		//ZZ_LOG("manager: %s killed (%s::%s)\n", this->get_name(), node->get_node_type()->type_name, node->get_name());
		if (find_entrance(node)) {
			// if it is in the entrance line, flush it first. 
			// if we don not flush entrance, we get the mangled node that will be deleted by other object's releasing still in entrance line not by kill().
			flush_entrance(node);
		}
		node->release();
		return true;	
	}
	
	assert(node_ref_count != 0);

	// Someone is still refering this.
	// First, unlink, pop from delayed queue(include release) it!

	// Not only release, but also kill actually!
	// disconnect all relationship with children.
	child_type * child = (zz_node::child_type *)(&node->get_children());
	child_iterator it(child->begin());
	while (it != child->end()) {
		// CAUTION: do not use "it++" because link_child() affects _it_ !
		node->unlink_child(*it);
		it = child->begin();
	}

	// disconnect from parent
	if (parent_node) {
		parent_node->unlink_child(node);
	}
	
	//ZZ_LOG("manager: %s full-killed (%s::%s)\n", this->get_name(), node->get_node_type()->type_name, node->get_name());

	// do manager's unload()
	unload(node);
	return true;
}