#include <stddef.h>#include <stdio.h>#include <stdlib.h>Classes | |
| struct | Coords |
| A set of coordinates. More... | |
Defines | |
| #define | COLS 10 |
| The number of columns. | |
| #define | ROWS 10 |
| The number of rows. | |
| #define | START_X 0 |
| The starting X position. | |
| #define | START_Y 0 |
| The starting Y positoin. | |
| #define | ENABLE_CHECK 1 |
| Enables checking for blocked spaces. | |
| #define | DELTA_SIZE 8 |
| The number of legal moves. | |
Functions | |
| int | is_available (const int **table, struct Coords table_size, struct Coords pos) |
| Determines the availability of a postion on the board. | |
| int | is_blocked (const int **table, struct Coords table_size, const struct Coords *delta, int delta_size, struct Coords pos) |
| Determines whether or not a position on the board is boxed in. | |
| int | path_iter (int **table, struct Coords table_size, const struct Coords *delta, int delta_size, struct Coords pos, int moves, int *iter) |
| 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, int *iter) |
| Finds a path. | |
| int | main () |
Variables | |
| struct Coords | delta [] |
| The default set of legal moves. | |
Determines the availability of a postion on the board.
| table | A pointer to the table of values. | |
| table_size | Indicates the size of the table. | |
| pos | The position being checked. |
| int is_blocked | ( | const int ** | table, | |
| struct Coords | table_size, | |||
| const struct Coords * | delta, | |||
| int | delta_size, | |||
| struct Coords | pos | |||
| ) |
Determines whether or not a position on the board is boxed in.
| 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 position being checked. |
| int path_find | ( | int ** | table, | |
| struct Coords | table_size, | |||
| const struct Coords * | delta, | |||
| int | delta_size, | |||
| struct Coords | pos, | |||
| int * | iter | |||
| ) |
Finds a path.
| 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. | |
| iter | A pointer to the iteration count (NULL if not available). |
| int path_iter | ( | int ** | table, | |
| struct Coords | table_size, | |||
| const struct Coords * | delta, | |||
| int | delta_size, | |||
| struct Coords | pos, | |||
| int | moves, | |||
| int * | iter | |||
| ) |
An iteration of the pathfinder algorithm.
| 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. | |
| iter | A pointer to the iteration count (NULL if not available). |
1.7.1