• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kblackbox

Signals | Public Member Functions | List of all members
KBBBallsOnBoard Class Reference

#include <kbbballsonboard.h>

Inheritance diagram for KBBBallsOnBoard:
Inheritance graph
[legend]

Signals

void changes ()
 

Public Member Functions

 KBBBallsOnBoard (KBBGameDoc *parent, const int columns, const int rows)
 
int absolutePositionToBorderPosition (int position[DIM_MAX])
 
int absolutePositionToBoxPosition (int position[DIM_MAX])
 
void add (int boxPosition)
 
void borderPositionToAbsolutePosition (int borderPosition, int position[DIM_MAX])
 
int columns ()
 
bool contains (int boxPosition)
 
int count ()
 
void newBoard (const int columns, const int rows)
 
int numberOfBallsNotIn (KBBBallsOnBoard *otherBoard)
 
int oppositeBorderPosition (int borderPosition)
 
int oppositeBorderPositionWithPoints (const int borderPosition, QList< int > &points)
 
void ray (const int borderPosition, QList< int > &points)
 
void remove (int boxPosition)
 
int rows ()
 

Detailed Description

Set of balls (or various objects) with positions on the board.

The set of balls manages the position and the number of the balls. The balls can be placed of any kind (placed by the player or the hiden balls to find for instance).

It computes also the trajectory of the laser ray with the given balls.

There are 3 different kinds of coordinates for object positions.

  • The 1st one is the (absolute) position in 2 dimensions between (0,0) and (2 + m_columns + 2, 2 + m_rows + 2). It is used to manage the positions of the graphic elements but also to calculate the laser ray trajectory.
  • The 2nd one is the border position in 1 dimension between 0 and (2 * m_rows + 2 * m_columns -1). Only borders can be managed with this coordinate.
  • The 3rd one is the box position in 1 dimension between 0 and (m_columns*m_rows - 1). It is used to manage the postion of the balls in the black box.

Definition at line 62 of file kbbballsonboard.h.

Constructor & Destructor Documentation

KBBBallsOnBoard::KBBBallsOnBoard ( KBBGameDoc *  parent,
const int  columns,
const int  rows 
)

Constructor.

Definition at line 44 of file kbbballsonboard.cpp.

Member Function Documentation

int KBBBallsOnBoard::absolutePositionToBorderPosition ( int  position[DIM_MAX])

Convert (absolute) position to border position.

Parameters
positionThe (absolute) position to convert.
Returns
The result of the conversion: border position.
See also
borderPositionToAbsolutePosition(int borderPosition, int position[DIM_MAX])
absolutePositionToBorderPosition(int position[DIM_MAX])

Definition at line 56 of file kbbballsonboard.cpp.

int KBBBallsOnBoard::absolutePositionToBoxPosition ( int  position[DIM_MAX])

Convert (absolute) position to box position.

Parameters
positionThe (absolute) position to convert.
Returns
The result of the conversion: box position.
See also
absolutePositionToBorderPosition(int position[DIM_MAX])

Definition at line 72 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::add ( int  boxPosition)

Add a ball on this board.

Parameters
boxPositionThe box position of the ball to add
See also
remove(int boxPosition)

Definition at line 78 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::borderPositionToAbsolutePosition ( int  borderPosition,
int  position[DIM_MAX] 
)

Convert border position to (abosulte) position.

Parameters
borderPositionThe border position to convert.
positionThe result of the conversion: (absolute) position.
See also
borderPositionToAbsolutePosition(int position[DIM_MAX])

Definition at line 85 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::changes ( )
signal
int KBBBallsOnBoard::columns ( )

Definition at line 106 of file kbbballsonboard.cpp.

bool KBBBallsOnBoard::contains ( int  boxPosition)

Check if there is a ball at the given position in the black box.

Parameters
boxPositionBox position to check

Definition at line 112 of file kbbballsonboard.cpp.

int KBBBallsOnBoard::count ( )

Number of balls on this board.

Definition at line 118 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::newBoard ( const int  columns,
const int  rows 
)

Define a new board and remove all balls.

Parameters
columnsNumber of columns
rowsNumber of rows

Definition at line 124 of file kbbballsonboard.cpp.

int KBBBallsOnBoard::numberOfBallsNotIn ( KBBBallsOnBoard *  otherBoard)

Compares 2 boards and return the number of differences.

Parameters
otherBoardOther set of balls in a board
Returns
Number of balls in the set that are not in the other given set

Definition at line 133 of file kbbballsonboard.cpp.

int KBBBallsOnBoard::oppositeBorderPosition ( int  borderPosition)

Compute the opposite border position of the given position.

Parameters
borderPositionThe border position

Definition at line 145 of file kbbballsonboard.cpp.

int KBBBallsOnBoard::oppositeBorderPositionWithPoints ( const int  borderPosition,
QList< int > &  points 
)

Definition at line 151 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::ray ( const int  borderPosition,
QList< int > &  points 
)

Compute the trajectory of a ray with the balls of the set.

Parameters
borderPositionThe border position

Definition at line 180 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::remove ( int  boxPosition)

Remove a ball on this board.

Parameters
boxPositionThe box position of the ball to be removed
See also
add(int boxPosition);

Definition at line 186 of file kbbballsonboard.cpp.

int KBBBallsOnBoard::rows ( )

Definition at line 193 of file kbbballsonboard.cpp.


The documentation for this class was generated from the following files:
  • kbbballsonboard.h
  • kbbballsonboard.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kblackbox

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

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal