Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
lib
square.cc
Go to the documentation of this file.
1
/* square.cc
2
*/
3
#include "
osl/square.h
"
4
#include "
osl/boardTable.h
"
5
#include <boost/static_assert.hpp>
6
#include <iostream>
7
8
BOOST_STATIC_ASSERT
(
sizeof
(
osl::Square
) == 4);
9
10
bool
osl::Square::isOnBoardSlow
()
const
11
{
12
return
(1<=
x
() &&
x
() <=9
13
&& 1<=
y
() &&
y
() <=9);
14
}
15
16
bool
osl::Square::isValid
()
const
17
{
18
return
isPieceStand() || isOnBoard();
19
}
20
21
const
osl::Square
osl::
22
Square::squareForBlackSlow
(
Player
player)
const
23
{
24
if
(player ==
BLACK
)
25
return
*
this
;
26
return
Square
(reverseX(x()),reverseY(y()));
27
}
28
29
30
const
osl::Square
osl::
31
Square::neighbor
(
Player
P,
Direction
D
)
const
32
{
33
return
Board_Table
.
nextSquare
(P, *
this
, D);
34
}
35
36
const
osl::Square
osl::
37
Square::back
(
Player
P,
Direction
D
)
const
38
{
39
return
Board_Table
.
nextSquare
(
alt
(P), *
this
, D);
40
}
41
42
std::ostream&
osl::operator<<
(std::ostream& os,
Square
square)
43
{
44
if
(square.
isPieceStand
())
45
return
os <<
"OFF"
;
46
return
os <<
"Square("
<< square.
x
() << square.
y
() <<
")"
;
47
}
48
49
/* ------------------------------------------------------------------------- */
50
// ;;; Local Variables:
51
// ;;; mode:c++
52
// ;;; c-basic-offset:2
53
// ;;; End:
Generated on Sun Jul 21 2013 13:37:27 by
1.8.4