The Pedigree Project
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
user
applications
chess
Move.h
1
/*
2
*
3
* Copyright (c) 2008-2014, Pedigree Developers
4
*
5
* Please see the CONTRIB file in the root of the source tree for a full
6
* list of contributors.
7
*
8
* Permission to use, copy, modify, and distribute this software for any
9
* purpose with or without fee is hereby granted, provided that the above
10
* copyright notice and this permission notice appear in all copies.
11
*
12
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
*/
20
21
#ifndef MOVE_H
22
#define MOVE_H
23
24
#include <stdio.h>
25
29
class
Move
30
{
31
public
:
32
Move
(
int
sCol,
int
sRow,
int
eCol,
int
eRow) :
33
sCol(sCol), sRow(sRow), eCol(eCol), eRow(eRow)
34
{}
35
36
Move
() :
37
sCol(-1), sRow(-1), eCol(-1), eRow(-1)
38
{}
39
40
~
Move
() {}
41
42
void
rotate180()
43
{
44
sCol = 7-sCol;
45
sRow = 7-sRow;
46
eCol = 7-eCol;
47
eRow = 7-eRow;
48
}
49
50
void
print()
51
{
52
switch
(sCol)
53
{
54
case
0: printf (
"A"
);
break
;
55
case
1: printf (
"B"
);
break
;
56
case
2: printf (
"C"
);
break
;
57
case
3: printf (
"D"
);
break
;
58
case
4: printf (
"E"
);
break
;
59
case
5: printf (
"F"
);
break
;
60
case
6: printf (
"G"
);
break
;
61
case
7: printf (
"H"
);
break
;
62
}
63
printf(
"%d-"
, sRow);
64
65
switch
(eCol)
66
{
67
case
0: printf (
"A"
);
break
;
68
case
1: printf (
"B"
);
break
;
69
case
2: printf (
"C"
);
break
;
70
case
3: printf (
"D"
);
break
;
71
case
4: printf (
"E"
);
break
;
72
case
5: printf (
"F"
);
break
;
73
case
6: printf (
"G"
);
break
;
74
case
7: printf (
"H"
);
break
;
75
}
76
printf(
"%d"
, eRow);
77
}
78
79
bool
invalid()
80
{
81
return
(sCol == (
char
)-1);
82
}
83
84
char
sCol, sRow, eCol, eRow;
85
};
86
87
#endif
Move
Definition:
Move.h:29
Generated on Fri Jan 24 2020 06:46:14 for The Pedigree Project by
1.8.11