// ******************************************************************* // (C) Copyright 2013 Leiden Institute of Advanced Computer Science // Universiteit Leiden // All Rights Reserved // ******************************************************************* // Dou Shou Qi (core) // ******************************************************************* // FILE INFORMATION: // File: core_extensions.h // Author: Jonathan K. Vis // Revision: 1.01a // Date: 2013/04/18 // ******************************************************************* // DESCRIPTION: // ******************************************************************* #if !defined(__core_extensions_h__) #define __core_extensions_h__ #include "../core/move.h" #include "../core/position.h" static inline bool is_stalemate(Position const &position) { Move moves[MAX_MOVES]; return position.generate_moves(moves) == 0; } // is_stalemate static inline bool validate_move(Position const &position, Move &move) { Move moves[MAX_MOVES]; int const count = position.generate_moves(moves); for (int i = 0; i < count; ++i) { if (move == moves[i]) { move = moves[i]; return true; } // if } // for return false; } // validate_move #endif