• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

ksquares

aicontroller.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Matthew Williams    <matt@milliams.com>         *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  ***************************************************************************/
00009 
00010 #ifndef AICONTROLLER_H
00011 #define AICONTROLLER_H
00012 
00013 #include <QList>
00014 
00015 namespace KSquares {enum Direction {HORIZONTAL, VERTICAL};}
00016 
00029 class aiController
00030 {
00031     public:
00041         aiController(int newPlayerId, const QList<bool> &newLines, const QList<int> &newSquareOwners, int newWidth, int newHeight);
00050         int chooseLine() const;
00057         QList<int> autoFill(int safeMovesLeft);
00058 
00059     protected:
00063         QList<int> safeMoves() const;
00069         QList<int> chooseLeastDamaging(const QList<int> &choiceList) const;
00076         int countBorderLines(int squareIndex, const QList<bool> &linesList) const;
00082         QList<int> squaresFromLine(int lineIndex) const;
00088         QList<int> linesFromSquare(int squareIndex) const;
00094         KSquares::Direction lineDirection(int lineIndex) const;
00095         
00097         QList<int> squareOwners;
00099         QList<bool> lines;
00101         int playerId;
00103         int width;
00105         int height;
00106 };
00107 
00108 #endif // KSQUARES_H

ksquares

Skip menu "ksquares"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal