AIPercent Class Reference

#include <ai_percent.h>

Inheritance diagram for AIPercent:

AIPlayer Player

Detailed Description

This kind of AI is parameterized by a percentage p.

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 RoundgetChosenRound () const
 Return the round played by the AI (if changesLetters() returns false).
virtual vector< TilegetChangedLetters () const
 Get the letters to change (if changesLetters() returns true).


Constructor & Destructor Documentation

AIPercent::AIPercent int  iId,
float  iPercent
 

Constructor, taking the percentage (0.0 <= iPercent <= 1.0).

Definition at line 29 of file ai_percent.cpp.

virtual AIPercent::~AIPercent  )  [inline, virtual]
 

Definition at line 42 of file ai_percent.h.


Member Function Documentation

bool AIPercent::changesLetters  )  const [virtual]
 

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().

void AIPercent::compute const Dictionary iDic,
Board iBoard,
int  turn
[virtual]
 

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().

vector< Tile > AIPercent::getChangedLetters  )  const [virtual]
 

Get the letters to change (if changesLetters() returns true).

Implements AIPlayer.

Definition at line 63 of file ai_percent.cpp.

const Round & AIPercent::getChosenRound  )  const [virtual]
 

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().


The documentation for this class was generated from the following files:
Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5