bestroute.h File Reference

File containing the interface of bestroute module. More...

#include <stdio.h>
#include <malloc.h>
#include <assert.h>
#include "define.h"
#include "object.h"

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

unsigned int bestroute (unsigned int *doorsRow, unsigned int *doorsCol, unsigned int numOfDoor, unsigned int *doorId)
 Function that calculate the best route from the start point and each door of the schema, and selects the shortest of theese.
bool bestroute_check_in_data (const unsigned int *doorsRow, const unsigned int *doorsCol, unsigned int numOfDoor)
 Check the input data given to bestroute function.
unsigned int schema_round_search (unsigned int *vectRow, unsigned int *vectCol, long int *vectParent)
 Implements a circular serach in a estabilished order ( LEFT - DOWN - RIGHT - UP ) looking for available cells, saving the results in given vectors.
unsigned int reverse_route_length (unsigned int *vectRow, unsigned int *vectCol, long int *vectParent, long int doorIndex)
 Starting from a point (doorIndex), follow the 'route' to the main parent.


Detailed Description

File containing the interface of bestroute module.

Definition in file bestroute.h.


Function Documentation

unsigned int bestroute ( unsigned int *  doorsRow,
unsigned int *  doorsCol,
unsigned int  numOfDoor,
unsigned int *  doorId 
)

Function that calculate the best route from the start point and each door of the schema, and selects the shortest of theese.

It uses an algorithm that analize the boxes iteratively, evalueting each box (step of the route), looking for the cheaper neighbour in a estabilished order ( LEFT - DOWN - RIGHT - UP ).

Returns:
Best route value (unsigned int).
Parameters:
doorsRow Number of row of the doors
doorsCol Number of column of the doors
numOfDoor Number of doors
doorId Nearest door to the start point

Definition at line 9 of file bestroute.c.

References bestroute_check_in_data(), D1, D2, D4, schemaProp::numCol, schemaProp::numRow, reverse_route_length(), schema_round_search(), schemaData, schemaProp::startCol, and schemaProp::startRow.

Referenced by newgame().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bestroute_check_in_data ( const unsigned int *  doorsRow,
const unsigned int *  doorsCol,
unsigned int  numOfDoor 
)

Check the input data given to bestroute function.

Returns:
true if all controls are ok.

Definition at line 91 of file bestroute.c.

References D1, MAXC, MAXR, MINC, MINR, schemaProp::numCol, schemaProp::numRow, schemaData, schemaProp::startCol, and schemaProp::startRow.

Referenced by bestroute().

Here is the caller graph for this function:

unsigned int reverse_route_length ( unsigned int *  vectRow,
unsigned int *  vectCol,
long int *  vectParent,
long int  doorIndex 
)

Starting from a point (doorIndex), follow the 'route' to the main parent.

Returns:
the number of steps (or route length)

Definition at line 306 of file bestroute.c.

References D1, and D2.

Referenced by bestroute().

Here is the caller graph for this function:

unsigned int schema_round_search ( unsigned int *  vectRow,
unsigned int *  vectCol,
long int *  vectParent 
)

Implements a circular serach in a estabilished order ( LEFT - DOWN - RIGHT - UP ) looking for available cells, saving the results in given vectors.

Returns:
the number of connected nodes (or vectors length)

Definition at line 194 of file bestroute.c.

References D1, D3, D5, schemaProp::gameMap, isaccessible(), schemaProp::numCol, schemaProp::numRow, and schemaData.

Referenced by bestroute().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Fri Apr 2 18:27:36 2010 for SMLabyrinth by  doxygen 1.5.8