kblackbox
kbbballsonboard.cpp
Go to the documentation of this file.
44 KBBBallsOnBoard::KBBBallsOnBoard(KBBGameDoc* parent, const int columns, const int rows) : QObject(parent)
85 void KBBBallsOnBoard::borderPositionToAbsolutePosition(int borderPosition, int position[DIM_MAX])
151 int KBBBallsOnBoard::oppositeBorderPositionWithPoints(const int borderPosition, QList<int> &points) {
204 void KBBBallsOnBoard::getOutgoingPosition( int position[DIM_MAX], int incomingDirection[DIM_MAX], QList<int> &points)
221 if (positionInTheBox(nextPosition) && contains((nextPosition[DIM_X] - 2) + (nextPosition[DIM_Y] - 2) * m_columns)) {
226 } else if (positionInTheBox(nextLeftPosition) && contains((nextLeftPosition[DIM_X] - 2) + (nextLeftPosition[DIM_Y] - 2) * m_columns)) {
231 } else if (positionInTheBox(nextRightPosition) && contains((nextRightPosition[DIM_X] - 2) + (nextRightPosition[DIM_Y] - 2) * m_columns)) {
249 // special case: Deviation entering the black box. Player should see the laser ray entering, even if it's in fact deviated before entering...
258 return !((position[DIM_X] < 2) || (position[DIM_X] > m_columns + 1) || (position[DIM_Y] < 2) || (position[DIM_Y] > m_rows + 1));
void clear()
int absolutePositionToBoxPosition(int position[DIM_MAX])
Convert (absolute) position to box position.
Definition: kbbballsonboard.cpp:72
int oppositeBorderPosition(int borderPosition)
Compute the opposite border position of the given position.
Definition: kbbballsonboard.cpp:145
KBBBallsOnBoard(KBBGameDoc *parent, const int columns, const int rows)
Constructor.
Definition: kbbballsonboard.cpp:44
int count(const T &value) const
void append(const T &value)
int absolutePositionToBorderPosition(int position[DIM_MAX])
Convert (absolute) position to border position.
Definition: kbbballsonboard.cpp:56
int removeAll(const T &value)
static const int HIT_POSITION
When a laser ray enter the black box, it exits on a defined border position, except if the laser ray ...
Definition: kbbgamedoc.h:65
void borderPositionToAbsolutePosition(int borderPosition, int position[DIM_MAX])
Convert border position to (abosulte) position.
Definition: kbbballsonboard.cpp:85
void ray(const int borderPosition, QList< int > &points)
Compute the trajectory of a ray with the balls of the set.
Definition: kbbballsonboard.cpp:180
void changes()
void newBoard(const int columns, const int rows)
Define a new board and remove all balls.
Definition: kbbballsonboard.cpp:124
bool contains(const T &value) const
bool contains(int boxPosition)
Check if there is a ball at the given position in the black box.
Definition: kbbballsonboard.cpp:112
int oppositeBorderPositionWithPoints(const int borderPosition, QList< int > &points)
Definition: kbbballsonboard.cpp:151
int numberOfBallsNotIn(KBBBallsOnBoard *otherBoard)
Compares 2 boards and return the number of differences.
Definition: kbbballsonboard.cpp:133
Set of balls (or various objects) with positions on the board.
Definition: kbbballsonboard.h:62
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.