1/* ****************************************************************************
2 This file is part of the game 'KJumpingCube'
3
4 Copyright (C) 1998-2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
5 Copyright (C) 2012 by Ian Wadham <iandw.au@gmail.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21**************************************************************************** */
22#ifndef AI_NEWTON_H
23#define AI_NEWTON_H
24
25#include "ai_base.h"
26
27/**
28* Class AI_Newton computes the priority of moving a cube and the value of the
29* resulting position. It assists the main AI class.
30*
31* @short The Newton AI algorithms
32*/
33class AI_Newton : public AI_Base
34{
35public:
36 QString whoami() { return QString ("Newton"); } // IDW test.
37
38 /**
39 * The Newton AI constructor.
40 */
41 AI_Newton();
42
43 /**
44 * Assess the priority of playing a cube at a particular position. The
45 * highest priority cubes are used by the AI_Main class for look-ahead moves
46 * and calculating the values of the positions reached. The cube to be
47 * assessed has to be neutral or owned by the player who is to move.
48 *
49 * @param index The index-position of the cube to be assessed
50 * @param player The player who is to move
51 * @param neighbors The index-positions of the cube's neighbors (array),
52 * where a value of -1 means no neighbor on that side
53 * @param owners The current owners of the cubes in the box (array)
54 * @param values The current point values of the cubes in the box (array)
55 * @param maxValues The maximum point values of the cubes in the box (array)
56 *
57 * @return The priority of a move (always > 0): moves with priority
58 * 1 are best and those with priority >= HighValue (999) are
59 * worst but may be forced (e.g. when defeat is imminent).
60 */
61 int assessCube (const int index, const Player player,
62 const int neighbors [4], const Player owners[],
63 const int values[], const int maxValues[]) const;
64};
65
66#endif // AI_NEWTON_H
67