Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
lib
search
historyTable.cc
Go to the documentation of this file.
1
/* historyTable.cc
2
*/
3
#include "
osl/search/historyTable.h
"
4
#include <algorithm>
5
#include <functional>
6
#include <iostream>
7
8
void
osl::search::
9
HistoryTable::extractTopN
(
Player
p, vector<OutputEntry>&
out
,
size_t
limit
)
const
10
{
11
out.clear();
12
for
(
size_t
i=0; i<=
Square
(9,9).
uintValue
(); ++i)
13
for
(
size_t
j=
Square
(1,1).
uintValue
(); j<=
Square
(9,9).
uintValue
(); ++j)
14
if
(table[p][i][j].value > 100)
15
out.push_back(
OutputEntry
(i, j, table[p][i][j].value));
16
std::sort(out.begin(), out.end(), std::greater<OutputEntry>());
17
if
(limit < out.size())
18
out.resize(limit);
19
}
20
21
std::ostream&
osl::search::operator<<
(std::ostream& os,
const
HistoryTable::OutputEntry
& e)
22
{
23
os <<
'('
;
24
if
(e.
from_or_ptype
<
PTYPE_SIZE
)
25
os <<
Ptype
(e.
from_or_ptype
);
26
else
27
os << Square::makeDirect(e.
from_or_ptype
);
28
return
os <<
" => "
<< e.
to
<<
" "
<< e.
value
<<
")"
;
29
}
30
31
// ;;; Local Variables:
32
// ;;; mode:c++
33
// ;;; c-basic-offset:2
34
// ;;; End:
Generated on Sun Jul 21 2013 13:37:24 by
1.8.4