File indexing completed on 2025-03-23 06:53:53
0001 /******************************************************************* 0002 * 0003 * Copyright 2007 Aron Boström <c02ab@efd.lth.se> 0004 * 0005 * Bovo is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2, or (at your option) 0008 * any later version. 0009 * 0010 * Bovo is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with Bovo; see the file COPYING. If not, write to 0017 * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 * 0020 ********************************************************************/ 0021 0022 /** @file move.cc implements Move */ 0023 0024 #include "move.h" 0025 0026 0027 #include "common.h" 0028 0029 /** namespace for game engine */ 0030 namespace bovo { 0031 0032 Move::Move(Player player, int col, int row) 0033 : m_coord(col, row), m_player(player) { 0034 } 0035 0036 Move::Move(Player player, const Coord& coord) 0037 : m_coord(coord), m_player(player) { 0038 } 0039 0040 Move::Move(const Move &m) 0041 = default; 0042 0043 Move::~Move() = default; 0044 0045 Coord Move::coord() const { 0046 return m_coord; 0047 } 0048 0049 Player Move::player() const { 0050 return m_player; 0051 } 0052 0053 bool Move::valid() const { 0054 return m_player != No && m_coord.x() < NUMCOLS && m_coord.y() < NUMCOLS; 0055 } 0056 0057 usi Move::x() const { 0058 return m_coord.x(); 0059 } 0060 0061 usi Move::y() const { 0062 return m_coord.y(); 0063 } 0064 0065 } /* namespace bovo */