00001 // cwchessboard -- A C++ chessboard tool set 00002 // 00003 //! @file MoveIterator.inl This file contains the inline definitions of class MoveIterator. 00004 // 00005 // Copyright (C) 2008, by 00006 // 00007 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00008 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00009 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00010 // 00011 // This program is free software: you can redistribute it and/or modify 00012 // it under the terms of the GNU General Public License as published by 00013 // the Free Software Foundation, either version 2 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 00024 namespace cwchess { 00025 00026 inline Type MoveIterator::initial_type(Index const& index) const 00027 { 00028 Piece const& piece(M_chess_position->piece_at(index)); 00029 if (piece != pawn) 00030 return nothing; 00031 return (index.row() == ((piece == white) ? 6 : 1)) ? queen : nothing; 00032 } 00033 00034 inline MoveIterator::MoveIterator(ChessPosition const* chess_position, Index const& index) : 00035 M_chess_position(chess_position), M_targets(chess_position->moves(index)), M_current_move(index, get_first_bitindex(), initial_type(index)) { } 00036 00037 } // namespace cwchess 00038