30 |
#include "debug.h" |
#include "debug.h" |
31 |
|
|
32 |
|
|
33 |
struct less_points : public binary_function<const Round&, |
struct less_points : public std::binary_function < const Round&, const Round&, bool > |
|
const Round&, bool> |
|
34 |
{ |
{ |
35 |
bool operator()(const Round &r1, const Round &r2) |
bool operator()(const Round &r1, const Round &r2) |
36 |
{ |
{ |
42 |
|
|
43 |
const Round & Results::get(int i) const |
const Round & Results::get(int i) const |
44 |
{ |
{ |
45 |
ASSERT(0 <= i && i < size(), |
ASSERT(0 <= i && i < size(), "Results index out of bounds"); |
|
"Results index out of bounds"); |
|
46 |
return m_rounds[i]; |
return m_rounds[i]; |
47 |
} |
} |
48 |
|
|
49 |
|
|
50 |
void Results::search(const Dictionary &iDic, Board &iBoard, |
void Results::search(const Dictionary iDic, Board &iBoard, |
51 |
const Rack &iRack, int iTurn) |
const Rack &iRack, int iTurn) |
52 |
{ |
{ |
53 |
clear(); |
clear(); |
54 |
|
|
55 |
if (iTurn == 0) |
if (iTurn == 0) |
56 |
|
{ |
57 |
iBoard.searchFirst(iDic, iRack, *this); |
iBoard.searchFirst(iDic, iRack, *this); |
58 |
|
} |
59 |
else |
else |
60 |
|
{ |
61 |
iBoard.search(iDic, iRack, *this); |
iBoard.search(iDic, iRack, *this); |
62 |
|
} |
63 |
} |
} |
64 |
|
|
65 |
|
|
66 |
void Results::sort() |
void Results::sort_by_points() |
67 |
{ |
{ |
68 |
less_points lp; |
less_points lp; |
69 |
std::sort(m_rounds.begin(), m_rounds.end(), lp); |
std::sort(m_rounds.begin(), m_rounds.end(), lp); |