File indexing completed on 2024-04-28 04:04:38
0001 /* 0002 This file is part of the game 'KTron' 0003 0004 SPDX-FileCopyrightText: 1998-2000 Matthias Kiefer <matthias.kiefer@gmx.de> 0005 SPDX-FileCopyrightText: 2005 Benjamin C. Meyer <ben at meyerhome dot net> 0006 SPDX-FileCopyrightText: 2008-2009 Stas Verberkt <legolas at legolasweb dot nl> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 0010 */ 0011 0012 #ifndef INTELLIGENCE_H 0013 #define INTELLIGENCE_H 0014 0015 #include <math.h> 0016 #include <QRandomGenerator> 0017 0018 class Tron; 0019 0020 /** 0021 * @short This class holds the intelligent opponent algorithm 0022 */ 0023 class Intelligence 0024 { 0025 public: 0026 Intelligence(); 0027 void think(int playerNumber); 0028 void referenceTron(Tron *t); 0029 0030 private: 0031 /** retrieves the opponentSkill */ 0032 int opponentSkill(); 0033 /** changeDirection helper for think(playerNr) */ 0034 void changeDirection(int playerNr,int dis_right,int dis_left); 0035 0036 Tron *m_tron; 0037 /** The random sequence generator **/ 0038 QRandomGenerator m_random; 0039 /** determines level of computerplayer */ 0040 int m_lookForward; 0041 }; 0042 0043 #endif // INTELLIGENCE_H 0044