Classes | Defines | Functions | Variables

path.c File Reference

#include <stdio.h>
#include <stdlib.h>

Classes

struct  Coords
 A set of coordinates. More...

Defines

#define COLS   10
#define ROWS   10
#define START_X   0
#define START_Y   0
#define DELTA_SIZE   8

Functions

int path_iter (int **table, struct Coords table_size, const struct Coords *delta, int delta_size, struct Coords pos, int moves)
 An iteration of the pathfinder algorithm.
int path_find (int **table, struct Coords table_size, const struct Coords *delta, int delta_size, struct Coords pos)
 Finds a path.
int main ()

Variables

struct Coords delta []
 The default set of legal moves.

Detailed Description

Author:
Jonathan Lamothe

Define Documentation

#define COLS   10

The number of columns.

#define DELTA_SIZE   8

The number of legal moves.

#define ROWS   10

The number of rows.

#define START_X   0

The starting x position.

#define START_Y   0

The starting y position.


Function Documentation

int path_find ( int **  table,
struct Coords  table_size,
const struct Coords delta,
int  delta_size,
struct Coords  pos 
)

Finds a path.

Parameters:
table A pointer to the table of values.
table_size Indicates the size of the table.
delta A pointer to the list of legal moves.
delta_size The number of legal moves.
pos The initial position on the table.
Returns:
1 if a path was found; 0 otherwise.
int path_iter ( int **  table,
struct Coords  table_size,
const struct Coords delta,
int  delta_size,
struct Coords  pos,
int  moves 
)

An iteration of the pathfinder algorithm.

Parameters:
table A pointer to the table of values.
table_size Indicates the size of the table.
delta A pointer to the list of legal moves.
delta_size The number of legal moves.
pos The current position on the table.
moves The number of moves successfully completed.
Returns:
1 if a path was found; 0 otherwise.

Variable Documentation

struct Coords delta[]
Initial value:
 {
  { 1, 2 },
  { 2, 1 },
  { -1, 2 },
  { -2, 1 },
  { 1, -2 },
  { 2, -1 },
  { -1, -2 },
  { -2, -1 }
}

The default set of legal moves.

 All Classes Files Functions Variables Defines