1 /*******************************************************************
2 *
3 * Copyright 2007  Aron Boström <c02ab@efd.lth.se>
4 *
5 * Bovo is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * Bovo is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Bovo; see the file COPYING.  If not, write to
17 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 ********************************************************************/
21 
22 /** @file move.cc implements Move */
23 
24 #include "move.h"
25 
26 
27 #include "common.h"
28 
29 /** namespace for game engine */
30 namespace bovo {
31 
Move(Player player,int col,int row)32 Move::Move(Player player, int col, int row)
33   : m_coord(col, row), m_player(player) {
34 }
35 
Move(Player player,const Coord & coord)36 Move::Move(Player player, const Coord& coord)
37   : m_coord(coord), m_player(player) {
38 }
39 
Move(const Move & m)40 Move::Move(const Move &m)
41  : m_coord(m.m_coord), m_player(m.m_player) {
42 }
43 
~Move()44 Move::~Move() {
45 }
46 
coord() const47 Coord Move::coord() const {
48     return m_coord;
49 }
50 
player() const51 Player Move::player() const {
52     return m_player;
53 }
54 
valid() const55 bool Move::valid() const {
56     return m_player != No && m_coord.x() < NUMCOLS && m_coord.y() < NUMCOLS;
57 }
58 
x() const59 usi Move::x() const {
60     return m_coord.x();
61 }
62 
y() const63 usi Move::y() const {
64     return m_coord.y();
65 }
66 
67 } /* namespace bovo */
68