-rw-r--r-- | noncore/games/wordgame/wordgame.cpp | 2 |
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 | |||
@@ -559,65 +559,65 @@ void WordGame::think() | |||
559 | delete cpu; | 559 | delete cpu; |
560 | cpu = 0; | 560 | cpu = 0; |
561 | aiheart->stop(); | 561 | aiheart->stop(); |
562 | if ( board->turnScore() < 0 ) | 562 | if ( board->turnScore() < 0 ) |
563 | passTurn(); | 563 | passTurn(); |
564 | else | 564 | else |
565 | endTurn(); | 565 | endTurn(); |
566 | } | 566 | } |
567 | } | 567 | } |
568 | 568 | ||
569 | ComputerPlayer::ComputerPlayer(Board* b, Rack* r) : | 569 | ComputerPlayer::ComputerPlayer(Board* b, Rack* r) : |
570 | board(b), rack(r), best(new const Tile*[rack_tiles]), | 570 | board(b), rack(r), best(new const Tile*[rack_tiles]), |
571 | best_blankvalues(new Tile[rack_tiles]) | 571 | best_blankvalues(new Tile[rack_tiles]) |
572 | { | 572 | { |
573 | best_score = -1; | 573 | best_score = -1; |
574 | across=FALSE; | 574 | across=FALSE; |
575 | dict=0; | 575 | dict=0; |
576 | } | 576 | } |
577 | 577 | ||
578 | ComputerPlayer::~ComputerPlayer() | 578 | ComputerPlayer::~ComputerPlayer() |
579 | { | 579 | { |
580 | delete [] best; | 580 | delete [] best; |
581 | delete [] best_blankvalues; | 581 | delete [] best_blankvalues; |
582 | } | 582 | } |
583 | 583 | ||
584 | bool ComputerPlayer::step() | 584 | bool ComputerPlayer::step() |
585 | { | 585 | { |
586 | const QDawg::Node* root = dict ? Global::dawg("WordGame").root() | 586 | const QDawg::Node* root = dict ? Global::dawg("WordGame").root() |
587 | : Global::fixedDawg().root(); | 587 | : Global::fixedDawg().root(); |
588 | QPoint d = across ? QPoint(1,0) : QPoint(0,1); | 588 | QPoint d = across ? QPoint(1,0) : QPoint(0,1); |
589 | const Tile* tiles[99]; // ### max board size | 589 | const Tile* tiles[99]; // ### max board size |
590 | uchar nletter[4095]; // QDawg only handles 0..4095 | 590 | uchar nletter[4095]; // QDawg only handles 0..4095 |
591 | memset(nletter,0,4096); | 591 | memset(nletter,0,4095); |
592 | for (int i=0; i<rack->count(); i++) { | 592 | for (int i=0; i<rack->count(); i++) { |
593 | const Tile* r = rack->tileRef(i); | 593 | const Tile* r = rack->tileRef(i); |
594 | if ( r->isBlank() ) | 594 | if ( r->isBlank() ) |
595 | nletter[0]++; | 595 | nletter[0]++; |
596 | else | 596 | else |
597 | nletter[r->text()[0].unicode()]++; | 597 | nletter[r->text()[0].unicode()]++; |
598 | } | 598 | } |
599 | Tile blankvalues[99]; // ### max blanks | 599 | Tile blankvalues[99]; // ### max blanks |
600 | findBest(current, d, root, 0, nletter, tiles, 0, blankvalues, 0); | 600 | findBest(current, d, root, 0, nletter, tiles, 0, blankvalues, 0); |
601 | if ( ++current.rx() == board->xTiles() ) { | 601 | if ( ++current.rx() == board->xTiles() ) { |
602 | current.rx() = 0; | 602 | current.rx() = 0; |
603 | if ( ++current.ry() == board->yTiles() ) { | 603 | if ( ++current.ry() == board->yTiles() ) { |
604 | if ( across ) { | 604 | if ( across ) { |
605 | if ( dict == 1 ) { | 605 | if ( dict == 1 ) { |
606 | if ( best_score >= 0 ) { | 606 | if ( best_score >= 0 ) { |
607 | rack->arrangeTiles(best,best_n); | 607 | rack->arrangeTiles(best,best_n); |
608 | rack->setBlanks(best_blankvalues); | 608 | rack->setBlanks(best_blankvalues); |
609 | board->scoreTurn(best_start, best_n, best_dir); | 609 | board->scoreTurn(best_start, best_n, best_dir); |
610 | board->showTurn(); | 610 | board->showTurn(); |
611 | } | 611 | } |
612 | return FALSE; | 612 | return FALSE; |
613 | } | 613 | } |
614 | dict++; | 614 | dict++; |
615 | across = FALSE; | 615 | across = FALSE; |
616 | current = QPoint(0,0); | 616 | current = QPoint(0,0); |
617 | } else { | 617 | } else { |
618 | across = TRUE; | 618 | across = TRUE; |
619 | current = QPoint(0,0); | 619 | current = QPoint(0,0); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | } | 622 | } |
623 | return TRUE; | 623 | return TRUE; |