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

kblackbox

KBBBallsOnBoard Class Reference

#include <kbbballsonboard.h>

Inheritance diagram for KBBBallsOnBoard:

Inheritance graph
[legend]

List of all members.


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.


Signals

void changes ()

Public Member Functions

int absolutePositionToBorderPosition (int position[DIM_MAX])
int absolutePositionToBoxPosition (int position[DIM_MAX])
void add (int boxPosition)
void borderPositionToAbsolutePosition (int borderPosition, int position[DIM_MAX])
const int columns ()
bool contains (int boxPosition)
int count ()
 KBBBallsOnBoard (KBBGameDoc *parent, const int columns, const int rows)
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)
const int rows ()

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:
position The (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:
position The (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:
boxPosition The 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:
borderPosition The border position to convert.
position The 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]

const 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:
boxPosition Box 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:
columns Number of columns
rows Number 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:
otherBoard Other 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:
borderPosition The 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:
borderPosition The border position

Definition at line 180 of file kbbballsonboard.cpp.

void KBBBallsOnBoard::remove ( int  boxPosition  ) 

Remove a ball on this board.

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

Definition at line 186 of file kbbballsonboard.cpp.

const 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

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