#include <ai_percent.h>
Inheritance diagram for AIPercent:
The computation consists in finding all the N possible rounds for the current rack/board, and sorting the list. The chosen round is the n'th element of the sorted list, such that n/N is closest to the percentage p. A percentage of 0 should always return the best round (i.e. the one with the highest score), while a percentage of 1 should return the worst one. This kind of AI will never change letters (unless it cannot play anything, in which case it just passes without changing letters).
Definition at line 37 of file ai_percent.h.
Public Member Functions | |
AIPercent (int iId, float iPercent) | |
Constructor, taking the percentage (0.0 <= iPercent <= 1.0). | |
virtual | ~AIPercent () |
virtual void | compute (const Dictionary &iDic, Board &iBoard, int turn) |
This method does the actual computation. | |
virtual bool | changesLetters () const |
Return true when the AI wants to change letters instead of playing a word. | |
virtual const Round & | getChosenRound () const |
Return the round played by the AI (if changesLetters() returns false). | |
virtual vector< Tile > | getChangedLetters () const |
Get the letters to change (if changesLetters() returns true). |
|
Constructor, taking the percentage (0.0 <= iPercent <= 1.0).
Definition at line 29 of file ai_percent.cpp. |
|
Definition at line 42 of file ai_percent.h. |
|
Return true when the AI wants to change letters instead of playing a word.
Implements AIPlayer. Definition at line 50 of file ai_percent.cpp. References Results::size(). |
|
This method does the actual computation. It will be called before any of the following methods, so it must prepare everything for them. Implements AIPlayer. Definition at line 40 of file ai_percent.cpp. References Results::clear(), Player::getCurrentRack(), PlayedRack::getRack(), and Results::search(). |
|
Get the letters to change (if changesLetters() returns true).
Implements AIPlayer. Definition at line 63 of file ai_percent.cpp. |
|
Return the round played by the AI (if changesLetters() returns false).
Implements AIPlayer. Definition at line 56 of file ai_percent.cpp. References Results::get(), and Results::size(). |