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

kblackbox

kbbballsonboard.h

Go to the documentation of this file.
00001 //
00002 // KBlackBox
00003 //
00004 // A simple game inspired by an emacs module
00005 //
00006 /***************************************************************************
00007  *   Copyright (c) 1999-2000, Robert Cimrman                               *
00008  *   cimrman3@students.zcu.cz                                              *
00009  *                                                                         *
00010  *   Copyright (c) 2007, Nicolas Roffet                                    *
00011  *   nicolas-kde@roffet.com                                                *
00012  *                                                                         *
00013  *                                                                         *
00014  *   This program is free software; you can redistribute it and/or modify  *
00015  *   it under the terms of the GNU General Public License as published by  *
00016  *   the Free Software Foundation; either version 2 of the License, or     *
00017  *   (at your option) any later version.                                   *
00018  *                                                                         *
00019  *   This program is distributed in the hope that it will be useful,       *
00020  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00021  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00022  *   GNU General Public License for more details.                          *
00023  *                                                                         *
00024  *   You should have received a copy of the GNU General Public License     *
00025  *   along with this program; if not, write to the                         *
00026  *   Free Software Foundation, Inc.,                                       *
00027  *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA               *
00028  ***************************************************************************/
00029 
00030 
00031 
00032 #ifndef KBBBALLSONBOARD_H
00033 #define KBBBALLSONBOARD_H
00034 
00035 
00036 #include <QList>
00037 #include <QObject>
00038 
00039 
00040 class KBBGameDoc;
00041 
00042 
00043 
00044 #define DIM_X 0
00045 #define DIM_Y 1
00046 #define DIM_MAX 2
00047 
00048 
00049 
00062 class KBBBallsOnBoard : public QObject
00063 {
00064     Q_OBJECT
00065 
00066     public:
00070         KBBBallsOnBoard(KBBGameDoc* parent, const int columns, const int rows);
00071 
00072 
00081         int absolutePositionToBorderPosition(int position[DIM_MAX]);
00082         
00090         int absolutePositionToBoxPosition(int position[DIM_MAX]);
00091         
00098         void add(int boxPosition);
00099         
00107         void borderPositionToAbsolutePosition(int borderPosition, int position[DIM_MAX]);
00108         
00109         const int columns();
00110         
00116         bool contains(int boxPosition);
00117         
00121         int count();
00122         
00129         void newBoard(const int columns, const int rows);
00130         
00137         int numberOfBallsNotIn(KBBBallsOnBoard* otherBoard);
00138         
00144         int oppositeBorderPosition(int borderPosition);
00145         
00146         int oppositeBorderPositionWithPoints(const int borderPosition, QList<int> &points);
00147         
00153         void ray(const int borderPosition, QList<int> &points);
00154 
00161         void remove(int boxPosition);
00162         
00163         const int rows();
00164 
00165 
00166     signals:
00167         void changes();
00168 
00169 
00170     private:
00177         void getOutgoingPosition( int position[DIM_MAX], int incomingDirection[DIM_MAX], QList<int> &points );
00178         
00184         bool positionInTheBox( int position[DIM_MAX] );
00185         
00186         
00187         QList<int> m_balls;
00188         int m_columns;
00189         int m_rows;
00190 };
00191 
00192 #endif // KBBBALLSONBOARD_H

kblackbox

Skip menu "kblackbox"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

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