summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/wordgame/wordgame.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index 52e2be2..8cf92ef 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -567,49 +567,49 @@ void WordGame::think()
}
ComputerPlayer::ComputerPlayer(Board* b, Rack* r) :
board(b), rack(r), best(new const Tile*[rack_tiles]),
best_blankvalues(new Tile[rack_tiles])
{
best_score = -1;
across=FALSE;
dict=0;
}
ComputerPlayer::~ComputerPlayer()
{
delete [] best;
delete [] best_blankvalues;
}
bool ComputerPlayer::step()
{
const QDawg::Node* root = dict ? Global::dawg("WordGame").root()
: Global::fixedDawg().root();
QPoint d = across ? QPoint(1,0) : QPoint(0,1);
const Tile* tiles[99]; // ### max board size
uchar nletter[4095]; // QDawg only handles 0..4095
- memset(nletter,0,4096);
+ memset(nletter,0,4095);
for (int i=0; i<rack->count(); i++) {
const Tile* r = rack->tileRef(i);
if ( r->isBlank() )
nletter[0]++;
else
nletter[r->text()[0].unicode()]++;
}
Tile blankvalues[99]; // ### max blanks
findBest(current, d, root, 0, nletter, tiles, 0, blankvalues, 0);
if ( ++current.rx() == board->xTiles() ) {
current.rx() = 0;
if ( ++current.ry() == board->yTiles() ) {
if ( across ) {
if ( dict == 1 ) {
if ( best_score >= 0 ) {
rack->arrangeTiles(best,best_n);
rack->setBlanks(best_blankvalues);
board->scoreTurn(best_start, best_n, best_dir);
board->showTurn();
}
return FALSE;
}
dict++;
across = FALSE;