#include <stdio.h>

Defines

#define HEIGHT   20
#define WIDTH   20

Functions

int max (int a, int b)
int min (int a, int b)
void printGrid (int grid[HEIGHT][WIDTH], int height, int width)
void readGrid (int grid[HEIGHT][WIDTH], int height, int width)
int findSmallestPositiveNeighbour (int grid[HEIGHT][WIDTH], int height, int width, int iCheck, int jCheck, int *miniPtr, int *minjPtr)
void waveFront (int grid[][WIDTH], int height, int width)
void followPath (int grid[][WIDTH], int height, int width)
int main ()

Detailed Description

cmpe150 summer2009 project 3.

A program that utilizes wavefront algorithm for pathplanning

Author:

Name: Mehmet Caliskan

Student no: 2005123123

Section: 08

E-Mail: mehmet.caliskan@boun.edu.tr

Compiler used: Online Compiler


Define Documentation

#define HEIGHT   20

maximum height of the grid world

#define WIDTH   20

maximum width of the grid world


Function Documentation

int findSmallestPositiveNeighbour ( int  grid[HEIGHT][WIDTH],
int  height,
int  width,
int  iCheck,
int  jCheck,
int *  miniPtr,
int *  minjPtr 
)

function which finds the neighbour cell with smallest positivie value.

Parameters:
grid grid world to search
height height of the grid
width width of the grid
iCheck height coordinate of the cell to check neighbours
jCheck width coordinate of the cell to check neighbours
miniPtr the height coordinate of the found neighbour cell is written here
minjPtr the width coordinate of the found neighbour cell is written here
Returns:
1 on success. Returns 0 if no neighbour contains a positive value
void followPath ( int  grid[][WIDTH],
int  height,
int  width 
)

Function that marks the shortest path to target via -1s. Alters the given grid. Must be called after wavefront to work.

Parameters:
grid grid world to use wavefront
height height of the grid
width width of the grid
int main (  ) 

Main function. Reads the grid world size and the grid world contents from the user. Then it deploys wavefront algorithm.

Returns:
0 on success. -1 if grid sizes are invalid
int max ( int  a,
int  b 
)

function which gives the maximum of two integers.

Parameters:
a first number
b second number
Returns:
minimum of a and b
int min ( int  a,
int  b 
)

function which gives the minimum of two integers.

Parameters:
a first number
b second number
Returns:
minimum of a and b
void printGrid ( int  grid[HEIGHT][WIDTH],
int  height,
int  width 
)

function which prints the grid contents on screen

Parameters:
grid grid world to print
height height of the grid
width width of the grid
void readGrid ( int  grid[HEIGHT][WIDTH],
int  height,
int  width 
)

function which reads the grid from the user

Parameters:
grid grid world to read
height height of the grid
width width of the grid
void waveFront ( int  grid[][WIDTH],
int  height,
int  width 
)

Function realizes the wavefront algorithm. Alters the given grid by putting the minimum number of steps required to go from there to

Parameters:
grid grid world to use wavefront
height height of the grid
width width of the grid
 All Files Functions Defines

Generated on Fri Oct 30 13:09:42 2009 by  doxygen 1.6.1