![]() |
Knight's Tour Generator
Tourneys and the Fast Generation and Obfuscation of Closed Knight's Tours
|
A rail. More...
#include <Rail.h>
Public Member Functions | |
CRail (int src0, int dest0, int src1, int dest1, UINT w) | |
Constructor. More... | |
void | GetEdge0 (int &src, int &dest) |
Get first edge. More... | |
void | GetEdge1 (int &src, int &dest) |
Get second edge. More... | |
Private Member Functions | |
bool | IsKnightMove (int i, int j) |
Knight's move test. More... | |
Private Attributes | |
int | m_nSrc0 = UNUSED |
Index of cell at one end of first edge. | |
int | m_nDest0 = UNUSED |
Index of cell at the other end of first edge. | |
int | m_nSrc1 = UNUSED |
Index of cell at one end of second edge. | |
int | m_nDest1 = UNUSED |
Index of cell at the other end of second edge. | |
int | m_nWidth = 0 |
Width of chessboard. | |
A rail consists of two knight's moves in which the pair of source vertices and the pair of destination vertices are both separated by a knight's move. There are 12 types of rail, shown in the image below (the rail edges are shown in black and the knight's moves between their end points are shown in gray).
CRail::CRail | ( | int | src0, |
int | dest0, | ||
int | src1, | ||
int | dest1, | ||
UINT | w | ||
) |
The rail constructor stores the indexes of the source and destination cells of two knight's moves in which the two source cells are separated by a knight's move and the two destination are separated by a knight's move. If the parameters fail these constraints then all four indices are set to UNUSED.
src0 | Index of cell at source end of first move. |
dest0 | Index of cell at destination end of first move. |
src1 | Index of cell at source end of second move. |
dest1 | Index of cell at the destination end of second move. |
w | Board width. |
void CRail::GetEdge0 | ( | int & | src, |
int & | dest | ||
) |
void CRail::GetEdge1 | ( | int & | src, |
int & | dest | ||
) |
|
private |