Knight-Path 1.0.D018
|
#include <solver.h>
Public Types | |
typedef boost::shared_ptr< solver > | pointer |
typedef std::list< position > | list_t |
Public Member Functions | |
virtual | ~solver () |
virtual list_t | solve (const position &from, const position &to)=0 |
Static Public Member Functions | |
static pointer | factory (const char *name) |
static void | list_algorithms (void) |
Protected Member Functions | |
solver () | |
Private Member Functions | |
solver (const solver &rhs) | |
solver & | operator= (const solver &rhs) |
The solver abstract base class is used to represent an unspecified algorithm to solve the knight path problem in as few moves as possible.
typedef std::list<position> solver::list_t |
typedef boost::shared_ptr<solver> solver::pointer |
solver::solver | ( | ) | [protected] |
solver::solver | ( | const solver & | rhs | ) | [private] |
The copy constructor. Do not use.
rhs | The right hand side of the initialization. |
solver::pointer solver::factory | ( | const char * | name | ) | [static] |
The factory class method is used to create new dynamically allocated instances of the named solver class.
name | The name of the solver to be used. |
Definition at line 46 of file factory.cc.
void solver::list_algorithms | ( | void | ) | [static] |
The list_algorithms class method may be used to list the known algorithm names. This allows the user to choose an algorithm name to pass to the "-a" option.
Definition at line 61 of file factory.cc.
The assignment operator. Do not use.
rhs | The right hand side of the assignment. |
The solve method is used to calculate the shortest path a knight piece must take between two given positions on a chess board. There are often several equally short paths, the first one found will be returned.
from | The position at the start of the path. |
to | The position at the end of the path. |
Implemented in solver_brute_force, solver_maze, and solver_taxi.