#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 () |
cmpe150 summer2009 project 3.
A program that utilizes wavefront algorithm for pathplanning
Name: Mehmet Caliskan
Student no: 2005123123
Section: 08
E-Mail: mehmet.caliskan@boun.edu.tr
Compiler used: Online Compiler
| #define HEIGHT 20 |
maximum height of the grid world
| #define WIDTH 20 |
maximum width of the grid world
| 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.
| 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 |
| 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.
| 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.
| int max | ( | int | a, | |
| int | b | |||
| ) |
function which gives the maximum of two integers.
| a | first number | |
| b | second number |
| int min | ( | int | a, | |
| int | b | |||
| ) |
function which gives the minimum of two integers.
| a | first number | |
| b | second number |
| void printGrid | ( | int | grid[HEIGHT][WIDTH], | |
| int | height, | |||
| int | width | |||
| ) |
function which prints the grid contents on screen
| 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
| 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
| grid | grid world to use wavefront | |
| height | height of the grid | |
| width | width of the grid |
1.6.1