Knight's Tour Generator
Tourneys and the Fast Generation and Obfuscation of Closed Knight's Tours
Rail.h
Go to the documentation of this file.
1 
4 // MIT License
5 //
6 // Copyright (c) 2019 Ian Parberry
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 
26 #ifndef __Rail__
27 #define __Rail__
28 
29 #include "Defines.h"
30 
40 
41 class CRail{
42  private:
43  int m_nSrc0 = UNUSED;
44  int m_nDest0 = UNUSED;
45 
46  int m_nSrc1 = UNUSED;
47  int m_nDest1 = UNUSED;
48 
49  int m_nWidth = 0;
50 
51  bool IsKnightMove(int i, int j);
52 
53  public:
54  CRail(int src0, int dest0, int src1, int dest1, UINT w);
55 
56  void GetEdge0(int& src, int& dest);
57  void GetEdge1(int& src, int& dest);
58  }; //CRail
59 
60 #endif
Defines, enumerated types, and typedefs.
int m_nDest0
Index of cell at the other end of first edge.
Definition: Rail.h:44
A rail.
Definition: Rail.h:41
int m_nWidth
Width of chessboard.
Definition: Rail.h:49
void GetEdge0(int &src, int &dest)
Get first edge.
Definition: Rail.cpp:71
unsigned int UINT
Abbreviation for unsigned integer.
Definition: Defines.h:84
bool IsKnightMove(int i, int j)
Knight's move test.
Definition: Rail.cpp:55
void GetEdge1(int &src, int &dest)
Get second edge.
Definition: Rail.cpp:80
int m_nSrc1
Index of cell at one end of second edge.
Definition: Rail.h:46
#define UNUSED
Contents of unused square on the chessboard.
Definition: Defines.h:31
int m_nSrc0
Index of cell at one end of first edge.
Definition: Rail.h:43
int m_nDest1
Index of cell at the other end of second edge.
Definition: Rail.h:47
CRail(int src0, int dest0, int src1, int dest1, UINT w)
Constructor.
Definition: Rail.cpp:45