File indexing completed on 2024-05-19 04:04:53
0001 /* 0002 This file is part of the game 'KJumpingCube' 0003 0004 SPDX-FileCopyrightText: 1998-2000 Matthias Kiefer <matthias.kiefer@gmx.de> 0005 SPDX-FileCopyrightText: 2012 Ian Wadham <iandw.au@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef AI_NEWTON_H 0011 #define AI_NEWTON_H 0012 0013 #include "ai_base.h" 0014 0015 /** 0016 * Class AI_Newton computes the priority of moving a cube and the value of the 0017 * resulting position. It assists the main AI class. 0018 * 0019 * @short The Newton AI algorithms 0020 */ 0021 class AI_Newton : public AI_Base 0022 { 0023 public: 0024 QString whoami() override { return QStringLiteral ("Newton"); } // IDW test. 0025 0026 /** 0027 * The Newton AI constructor. 0028 */ 0029 AI_Newton(); 0030 0031 /** 0032 * Assess the priority of playing a cube at a particular position. The 0033 * highest priority cubes are used by the AI_Main class for look-ahead moves 0034 * and calculating the values of the positions reached. The cube to be 0035 * assessed has to be neutral or owned by the player who is to move. 0036 * 0037 * @param index The index-position of the cube to be assessed 0038 * @param player The player who is to move 0039 * @param neighbors The index-positions of the cube's neighbors (array), 0040 * where a value of -1 means no neighbor on that side 0041 * @param owners The current owners of the cubes in the box (array) 0042 * @param values The current point values of the cubes in the box (array) 0043 * @param maxValues The maximum point values of the cubes in the box (array) 0044 * 0045 * @return The priority of a move (always > 0): moves with priority 0046 * 1 are best and those with priority >= HighValue (999) are 0047 * worst but may be forced (e.g. when defeat is imminent). 0048 */ 0049 int assessCube (const int index, const Player player, 0050 const int neighbors [4], const Player owners[], 0051 const int values[], const int maxValues[]) const override; 0052 }; 0053 0054 #endif // AI_NEWTON_H