Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Board Class Reference

#include </home/clem/local/src/opie/noncore/games/kpacman/board.h>

Inheritance diagram for Board:

Inheritance graph
[legend]
Collaboration diagram for Board:

Collaboration graph
[legend]
List of all members.

Signals

void clicked (QPoint)
void item (int)
void temporaryScore (int)

Public Member Functions

 Board (int size)
 ~Board ()
void init (Image image, QString levelName=0)
void setup (const uchar *buf)
void set (int pos, Square sq, int m=0)
void reset (int pos, Square sq, int m=0)
int position (Square sq, int m=0)
bool isOut (int pos)
bool isEmpty (int pos)
bool isBrick (int pos)
bool isPrison (int pos)
bool isGate (int pos)
bool isTunnel (int pos)
bool isPoint (int pos)
bool isEnergizer (int pos)
bool isFruit (int pos)
bool isPacman (int pos)
bool isMonster (int pos)
bool isWay (int pos, int dir, Square sq)
bool isJump (int pos, int dir)
int move (int pos, int dir, int steps=1)
int closeup (int pos, int dir, int target)
int x (int pos)
int y (int pos)
int turn (int dir)
int points ()
int energizers ()
int monsters ()
int tunnels ()
 Board (QWidget *parent=0, const char *name=0)
 Board (QPixmap bgshapes, int w, int h, QWidget *parent)
 ~Board ()
void readConfig (Config &)
void writeConfig (Config &)
int xTiles () const
int yTiles () const
bool contains (const QPoint &p) const
const Tiletile (const QPoint &p) const
void setRules (const QString &shapes, const int *effects)
void clear ()
void unsetTile (const QPoint &p)
void setTile (const QPoint &p, const Tile &t)
void setTileState (const QPoint &p, TileItem::State s)
void setCurrentRack (Rack *)
void resetRack ()
void finalizeTurn ()
void showTurn ()
void scoreTurn (const QPoint &at, int n, const QPoint &d)
bool checkTurn ()
int score (QPoint at, const Tile **tiles, int n, const Tile *blankvalue, const QPoint &d, bool ignoredict, QStringList *words) const
int bonussedValue (const QPoint &at, int base, int &all_mult) const
bool isStart (const QPoint &at) const
int turnScore () const
QSize sizeHint () const

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *)
void contentsMousePressEvent (QMouseEvent *)
void contentsMouseMoveEvent (QMouseEvent *)
void contentsMouseReleaseEvent (QMouseEvent *)

Private Member Functions

bool inBounds (int pos)
int idx (const QPoint &p) const
TileItem *& item (const QPoint &p) const
QPoint boardPos (const QPoint &) const
void unshowTurn ()

Private Attributes

int sz
QString map
QString mapName
int prisonEntry
int prisonExit
int pacmanHome
int monsterHome [8]
int fruitHome
int pacmanPosition
int monsterPosition [8]
int fruitPosition
int energizerPosition [8]
int tunnelPosition [8]
int numMonsters
int numPoints
int numEnergizers
int numTunnels
TileItem ** grid
QString rule_shape
const int * rule_effect
int rack_tiles_bonus
Rackcurrent_rack
QPoint dragstart
QPoint shown_at
int shown_n
QPoint shown_step
int turn_score

Constructor & Destructor Documentation

Board::Board int  size  ) 
 

Definition at line 15 of file board.cpp.

References init(), map, mapName, None, and sz.

Board::~Board  )  [inline]
 

Definition at line 44 of file board.h.

Board::Board QWidget *  parent = 0,
const char *  name = 0
 

Definition at line 587 of file oyatzee.cpp.

Board::Board QPixmap  bgshapes,
int  w,
int  h,
QWidget *  parent
 

Definition at line 780 of file wordgame.cpp.

References current_rack, grid, shown_n, TileItem::smallHeight(), and TileItem::smallWidth().

Board::~Board  ) 
 


Member Function Documentation

QPoint Board::boardPos const QPoint &   )  const [private]
 

Definition at line 1154 of file wordgame.cpp.

Referenced by contentsMouseMoveEvent().

int Board::bonussedValue const QPoint &  at,
int  base,
int &  all_mult
const
 

Definition at line 942 of file wordgame.cpp.

References idx(), mult(), Multiplier, MultiplyAll, rule_effect, and rule_shape.

Referenced by score().

bool Board::checkTurn  ) 
 

Definition at line 962 of file wordgame.cpp.

References Global::addWords(), QValueList< T >::append(), at(), QValueList< T >::begin(), clicked(), Rack::computerized(), contains(), QValueList< T >::count(), Rack::count(), current_rack, d, Global::dawg(), QValueList< T >::end(), FALSE, Global::fixedDawg(), i, l, QString::length(), score(), shown_at, shown_n, shown_step, showTurn(), Rack::tileRef(), tr, TRUE, turn_score, unshowTurn(), v, and warning().

Referenced by WordGame::endTurn().

void Board::clear  ) 
 

Definition at line 829 of file wordgame.cpp.

References grid, and i.

Referenced by readConfig().

void Board::clicked QPoint   )  [signal]
 

Referenced by checkTurn(), mousePressEvent(), and Possibilityboard::Possibilityboard().

int Board::closeup int  pos,
int  dir,
int  target
 

Definition at line 363 of file board.cpp.

References E, N, S, W, x(), and y().

Referenced by Monster::move(), and Fruit::move().

bool Board::contains const QPoint &  p  )  const [inline]
 

Definition at line 183 of file wordgame.h.

Referenced by checkTurn(), contentsMouseMoveEvent(), finalizeTurn(), ComputerPlayer::findBest(), score(), showTurn(), and unshowTurn().

void Board::contentsMouseMoveEvent QMouseEvent *   )  [protected]
 

Definition at line 856 of file wordgame.cpp.

References boardPos(), Rack::computerized(), contains(), current_rack, d, diff(), dragstart, end, i, resetRack(), scoreTurn(), showTurn(), start, t, tile(), unshowTurn(), and Bigint::x.

void Board::contentsMousePressEvent QMouseEvent *   )  [protected]
 

Definition at line 851 of file wordgame.cpp.

References dragstart.

void Board::contentsMouseReleaseEvent QMouseEvent *   )  [protected]
 

Definition at line 1159 of file wordgame.cpp.

References current_rack.

int Board::energizers  ) 
 

Definition at line 409 of file board.cpp.

References numEnergizers.

Referenced by Referee::timerEvent().

void Board::finalizeTurn  ) 
 

Definition at line 897 of file wordgame.cpp.

References at(), contains(), current_rack, TileItem::Firm, TileItem::Floating, i, item(), Rack::remove(), setTileState(), shown_at, shown_n, shown_step, and tile().

Referenced by WordGame::endTurn().

int Board::idx const QPoint &  p  )  const [inline, private]
 

Definition at line 227 of file wordgame.h.

Referenced by bonussedValue(), isStart(), item(), setTile(), and unsetTile().

bool Board::inBounds int  pos  )  [private]
 

Definition at line 125 of file board.cpp.

References FALSE, sz, and TRUE.

Referenced by isBrick(), isEmpty(), isEnergizer(), isFruit(), isGate(), isMonster(), isOut(), isPacman(), isPoint(), isPrison(), isTunnel(), reset(), and set().

void Board::init Image  image,
QString  levelName = 0
 

Definition at line 25 of file board.cpp.

References BoardHeight, BoardWidth, QString::data(), Demo, demo_bits, energizerPosition, QTextStream::eof(), File, QString::fill(), QString::find(), fruitHome, fruitPosition, height, Intro, IO_ReadOnly, QString::isEmpty(), QString::isNull(), QString::length(), Level, map, mapName, monsterHome, monsterPosition, numEnergizers, numMonsters, numPoints, numTunnels, QFile::open(), OUT, pacmanHome, pacmanPosition, printf, prisonEntry, prisonExit, QTextStream::readLine(), QString::replace(), setup(), and tunnelPosition.

Referenced by Board(), Referee::demo(), Referee::intro(), Referee::levelUpPlay(), and Referee::play().

bool Board::isBrick int  pos  ) 
 

Definition at line 230 of file board.cpp.

References at(), brick, FALSE, fixBits, inBounds(), and TRUE.

Referenced by Painter::drawBrick(), Painter::initRoomPixmap(), and isWay().

bool Board::isEmpty int  pos  ) 
 

Definition at line 223 of file board.cpp.

References at(), empty, FALSE, fixBits, inBounds(), and TRUE.

Referenced by isWay().

bool Board::isEnergizer int  pos  ) 
 

Definition at line 265 of file board.cpp.

References at(), energizerBit, FALSE, inBounds(), OUT, and TRUE.

Referenced by Referee::timerEvent().

bool Board::isFruit int  pos  ) 
 

Definition at line 272 of file board.cpp.

References at(), FALSE, fruitBit, inBounds(), OUT, and TRUE.

bool Board::isGate int  pos  ) 
 

Definition at line 244 of file board.cpp.

References at(), FALSE, fixBits, gate, inBounds(), and TRUE.

Referenced by Painter::drawPrison(), Painter::initRoomPixmap(), and isWay().

bool Board::isJump int  pos,
int  dir
 

Definition at line 318 of file board.cpp.

References BoardWidth, E, FALSE, N, NE, NW, S, SE, SW, sz, W, and x().

Referenced by Fruit::move().

bool Board::isMonster int  pos  ) 
 

Definition at line 286 of file board.cpp.

References at(), FALSE, inBounds(), monsterBits, OUT, and TRUE.

Referenced by Referee::introPlay(), and Referee::timerEvent().

bool Board::isOut int  pos  ) 
 

Definition at line 216 of file board.cpp.

References at(), FALSE, inBounds(), OUT, and TRUE.

Referenced by Painter::drawBrick(), and isWay().

bool Board::isPacman int  pos  ) 
 

Definition at line 279 of file board.cpp.

References at(), FALSE, inBounds(), OUT, pacmanBit, and TRUE.

bool Board::isPoint int  pos  ) 
 

Definition at line 258 of file board.cpp.

References at(), FALSE, inBounds(), OUT, pointBit, and TRUE.

Referenced by Painter::initRoomPixmap(), and Referee::timerEvent().

bool Board::isPrison int  pos  ) 
 

Definition at line 237 of file board.cpp.

References at(), FALSE, fixBits, inBounds(), prison, and TRUE.

Referenced by Painter::drawPrison(), Painter::initRoomPixmap(), and isWay().

bool Board::isStart const QPoint &  at  )  const
 

Definition at line 955 of file wordgame.cpp.

References idx(), rule_effect, rule_shape, and Start.

Referenced by score().

bool Board::isTunnel int  pos  ) 
 

Definition at line 251 of file board.cpp.

References at(), FALSE, fixBits, inBounds(), TRUE, and tunnel.

Referenced by isWay(), and Fruit::move().

bool Board::isWay int  pos,
int  dir,
Square  sq
 

Definition at line 293 of file board.cpp.

References brick, E, empty, FALSE, gate, isBrick(), isEmpty(), isGate(), isOut(), isPrison(), isTunnel(), move(), N, out, OUT, prison, S, TRUE, tunnel, and W.

Referenced by Pacman::move(), Monster::move(), Fruit::move(), and Pacman::setDirection().

TileItem*& Board::item const QPoint &  p  )  const [inline, private]
 

Definition at line 229 of file wordgame.h.

References grid, and idx().

void Board::item int   )  [signal]
 

Referenced by finalizeTurn(), setTile(), setTileState(), Possibilityboard::slotClicked(), tile(), unsetTile(), and unshowTurn().

int Board::monsters  ) 
 

Definition at line 414 of file board.cpp.

References numMonsters.

void Board::mousePressEvent QMouseEvent *   )  [protected, virtual]
 

Definition at line 591 of file oyatzee.cpp.

References clicked().

int Board::move int  pos,
int  dir,
int  steps = 1
 

Definition at line 332 of file board.cpp.

References BoardWidth, E, N, NE, NW, S, SE, SW, sz, turn(), W, and x().

Referenced by Painter::drawBrick(), Painter::drawPrison(), isWay(), Pacman::move(), Monster::move(), and Fruit::move().

int Board::points  ) 
 

Definition at line 404 of file board.cpp.

References numPoints.

Referenced by Referee::timerEvent().

int Board::position Square  sq,
int  m = 0
 

Definition at line 199 of file board.cpp.

References energizer, energizerPosition, fruit, fruitHome, fruithome, fruitPosition, monster, monsterHome, monsterhome, monsterPosition, OUT, pacman, pacmanHome, pacmanhome, pacmanPosition, prisonEntry, prisonentry, prisonExit, prisonexit, tunnel, and tunnelPosition.

Referenced by Referee::initFruit(), Referee::initPacman(), Referee::killedPlay(), Monster::Monster(), Monster::move(), Fruit::move(), Referee::paintEvent(), Referee::play(), Referee::ready(), Referee::repaintFigures(), and Fruit::setMovement().

void Board::readConfig Config  ) 
 

Definition at line 813 of file wordgame.cpp.

References QValueList< T >::begin(), clear(), QValueList< T >::end(), i, p, Config::readListEntry(), setTile(), and t.

Referenced by WordGame::readConfig().

void Board::reset int  pos,
Square  sq,
int  m = 0
 

Definition at line 175 of file board.cpp.

References at(), empty, energizer, energizerBit, energizerPosition, FALSE, fruit, fruitBit, fruitPosition, inBounds(), monster, monsterBit, monsterPosition, numEnergizers, numPoints, OUT, out, pacman, pacmanBit, pacmanPosition, Point, pointBit, TRUE, and varBits.

Referenced by Pacman::move(), Monster::move(), Pacman::setPosition(), Monster::setPosition(), Fruit::setPosition(), Energizer::setPosition(), and Referee::timerEvent().

void Board::resetRack  ) 
 

Definition at line 845 of file wordgame.cpp.

References unshowTurn().

Referenced by contentsMouseMoveEvent(), and WordGame::resetTurn().

int Board::score QPoint  at,
const Tile **  tiles,
int  n,
const Tile blankvalue,
const QPoint &  d,
bool  ignoredict,
QStringList words
const
 

Definition at line 1058 of file wordgame.cpp.

References QString::append(), bonussedValue(), contains(), Global::dawg(), FALSE, Global::fixedDawg(), i, isStart(), QString::length(), QString::prepend(), rack_tiles, rack_tiles_bonus, t, Tile::text(), tile(), and TRUE.

Referenced by checkTurn(), ComputerPlayer::noteChoice(), and scoreTurn().

void Board::scoreTurn const QPoint &  at,
int  n,
const QPoint &  d
 

Definition at line 1043 of file wordgame.cpp.

References Rack::count(), current_rack, FALSE, i, score(), shown_at, shown_n, shown_step, temporaryScore(), Rack::tileRef(), turn_score, and unshowTurn().

Referenced by contentsMouseMoveEvent(), and ComputerPlayer::step().

void Board::set int  pos,
Square  sq,
int  m = 0
 

Definition at line 130 of file board.cpp.

References at(), empty, energizer, energizerBit, energizerPosition, fruit, fruitBit, fruitHome, fruithome, fruitPosition, inBounds(), monster, monsterBit, monsterHome, monsterhome, monsterPosition, numEnergizers, numMonsters, numPoints, numTunnels, OUT, out, pacman, pacmanBit, pacmanHome, pacmanhome, pacmanPosition, Point, pointBit, prisonEntry, prisonentry, prisonExit, prisonexit, tunnel, and tunnelPosition.

Referenced by Referee::introPlay(), Pacman::move(), Monster::move(), Pacman::setPosition(), Monster::setPosition(), Fruit::setPosition(), Energizer::setPosition(), and setup().

void Board::setCurrentRack Rack  ) 
 

Definition at line 839 of file wordgame.cpp.

References current_rack, and turn_score.

Referenced by WordGame::readyRack().

void Board::setRules const QString shapes,
const int *  effects
 

Definition at line 1166 of file wordgame.cpp.

References i, rack_tiles_bonus, rule_effect, rule_shape, x(), xTiles(), y(), and yTiles().

Referenced by WordGame::loadRules().

void Board::setTile const QPoint &  p,
const Tile t
 

Definition at line 1187 of file wordgame.cpp.

References FALSE, grid, idx(), item(), and TileItem::setTile().

Referenced by readConfig(), and showTurn().

void Board::setTileState const QPoint &  p,
TileItem::State  s
[inline]
 

Definition at line 196 of file wordgame.h.

References item(), and TileItem::setState().

Referenced by finalizeTurn(), and showTurn().

void Board::setup const uchar buf  ) 
 

Definition at line 103 of file board.cpp.

References BoardHeight, BoardWidth, brick, energizer, fruithome, gate, monsterhome, out, pacmanhome, Point, prison, prisonentry, prisonexit, set(), and tunnel.

Referenced by init().

void Board::showTurn  ) 
 

Definition at line 925 of file wordgame.cpp.

References at(), contains(), current_rack, TileItem::Floating, i, setTile(), setTileState(), shown_at, shown_n, shown_step, t, Rack::tile(), tile(), and unshowTurn().

Referenced by checkTurn(), contentsMouseMoveEvent(), and ComputerPlayer::step().

QSize Board::sizeHint  )  const
 

Definition at line 799 of file wordgame.cpp.

References height, and width.

void Board::temporaryScore int   )  [signal]
 

Referenced by scoreTurn().

const Tile* Board::tile const QPoint &  p  )  const [inline]
 

Definition at line 187 of file wordgame.h.

References item(), and TileItem::tile().

Referenced by contentsMouseMoveEvent(), finalizeTurn(), ComputerPlayer::findBest(), score(), showTurn(), and writeConfig().

int Board::tunnels  ) 
 

Definition at line 419 of file board.cpp.

References numTunnels.

Referenced by Referee::initFruit(), and Fruit::move().

int Board::turn int  dir  ) 
 

Definition at line 389 of file board.cpp.

References E, N, NE, NW, S, SE, SW, and W.

Referenced by Pacman::move(), Monster::move(), Fruit::move(), move(), and Referee::timerEvent().

int Board::turnScore  )  const [inline]
 

Definition at line 214 of file wordgame.h.

References turn_score.

Referenced by WordGame::endTurn(), and WordGame::think().

void Board::unsetTile const QPoint &  p  ) 
 

Definition at line 1181 of file wordgame.cpp.

References grid, idx(), and item().

Referenced by unshowTurn().

void Board::unshowTurn  )  [private]
 

Definition at line 912 of file wordgame.cpp.

References at(), contains(), TileItem::Floating, i, item(), shown_at, shown_n, shown_step, and unsetTile().

Referenced by checkTurn(), contentsMouseMoveEvent(), resetRack(), scoreTurn(), and showTurn().

void Board::writeConfig Config  ) 
 

Definition at line 804 of file wordgame.cpp.

References QValueList< T >::append(), grid, i, t, tile(), and Config::writeEntry().

Referenced by WordGame::writeConfig().

int Board::x int  pos  ) 
 

Definition at line 379 of file board.cpp.

References BoardWidth.

Referenced by closeup(), isJump(), Monster::move(), move(), Painter::point(), and setRules().

int Board::xTiles  )  const [inline]
 

Definition at line 180 of file wordgame.h.

Referenced by setRules(), and ComputerPlayer::step().

int Board::y int  pos  ) 
 

Definition at line 384 of file board.cpp.

References BoardWidth.

Referenced by closeup(), Monster::move(), Painter::point(), and setRules().

int Board::yTiles  )  const [inline]
 

Definition at line 181 of file wordgame.h.

Referenced by setRules(), and ComputerPlayer::step().


Member Data Documentation

Rack* Board::current_rack [private]
 

Definition at line 235 of file wordgame.h.

Referenced by Board(), checkTurn(), contentsMouseMoveEvent(), contentsMouseReleaseEvent(), finalizeTurn(), scoreTurn(), setCurrentRack(), and showTurn().

QPoint Board::dragstart [private]
 

Definition at line 237 of file wordgame.h.

Referenced by contentsMouseMoveEvent(), and contentsMousePressEvent().

int Board::energizerPosition[8] [private]
 

Definition at line 93 of file board.h.

Referenced by init(), position(), reset(), and set().

int Board::fruitHome [private]
 

Definition at line 88 of file board.h.

Referenced by init(), position(), and set().

int Board::fruitPosition [private]
 

Definition at line 92 of file board.h.

Referenced by init(), position(), reset(), and set().

TileItem** Board::grid [private]
 

Definition at line 231 of file wordgame.h.

Referenced by Board(), clear(), item(), setTile(), unsetTile(), and writeConfig().

QString Board::map [private]
 

Definition at line 81 of file board.h.

Referenced by Board(), and init().

QString Board::mapName [private]
 

Definition at line 82 of file board.h.

Referenced by Board(), and init().

int Board::monsterHome[8] [private]
 

Definition at line 87 of file board.h.

Referenced by init(), position(), and set().

int Board::monsterPosition[8] [private]
 

Definition at line 91 of file board.h.

Referenced by init(), position(), reset(), and set().

int Board::numEnergizers [private]
 

Definition at line 98 of file board.h.

Referenced by energizers(), init(), reset(), and set().

int Board::numMonsters [private]
 

Definition at line 96 of file board.h.

Referenced by init(), monsters(), and set().

int Board::numPoints [private]
 

Definition at line 97 of file board.h.

Referenced by init(), points(), reset(), and set().

int Board::numTunnels [private]
 

Definition at line 99 of file board.h.

Referenced by init(), set(), and tunnels().

int Board::pacmanHome [private]
 

Definition at line 86 of file board.h.

Referenced by init(), position(), and set().

int Board::pacmanPosition [private]
 

Definition at line 90 of file board.h.

Referenced by init(), position(), reset(), and set().

int Board::prisonEntry [private]
 

Definition at line 84 of file board.h.

Referenced by init(), position(), and set().

int Board::prisonExit [private]
 

Definition at line 85 of file board.h.

Referenced by init(), position(), and set().

int Board::rack_tiles_bonus [private]
 

Definition at line 234 of file wordgame.h.

Referenced by score(), and setRules().

const int* Board::rule_effect [private]
 

Definition at line 233 of file wordgame.h.

Referenced by bonussedValue(), isStart(), and setRules().

QString Board::rule_shape [private]
 

Definition at line 232 of file wordgame.h.

Referenced by bonussedValue(), isStart(), and setRules().

QPoint Board::shown_at [private]
 

Definition at line 238 of file wordgame.h.

Referenced by checkTurn(), finalizeTurn(), scoreTurn(), showTurn(), and unshowTurn().

int Board::shown_n [private]
 

Definition at line 239 of file wordgame.h.

Referenced by Board(), checkTurn(), finalizeTurn(), scoreTurn(), showTurn(), and unshowTurn().

QPoint Board::shown_step [private]
 

Definition at line 240 of file wordgame.h.

Referenced by checkTurn(), finalizeTurn(), scoreTurn(), showTurn(), and unshowTurn().

int Board::sz [private]
 

Definition at line 79 of file board.h.

Referenced by Board(), inBounds(), isJump(), and move().

int Board::tunnelPosition[8] [private]
 

Definition at line 94 of file board.h.

Referenced by init(), position(), and set().

int Board::turn_score [private]
 

Definition at line 242 of file wordgame.h.

Referenced by checkTurn(), scoreTurn(), setCurrentRack(), and turnScore().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:27:27 2005 for OPIE by  doxygen 1.4.2