Hello
First to the chess question. I think there are no optimal values for
interesting games. When I look the first time for a new system I am
first interested in commented games. They may be opening surveys, with
short main variation, no rating etc. Next are the games of the stronget
players. When I know a system I am interested in the most recent games.
Basicely what you do is building a complex sorting criteria as there are
many simple ones defined for the database sorting today. So is it a good
idea to have one window in the product where a user can define a sorting
criteria based on simple and more complex elements like yours? The user
can use it to sort bases, the game list or define what are the best
games. And then to have one implementation class, which compares two
games based on a criteria in a efficient way including smart caching
when useful?
Now ro the best games sorting: OK, now I understand. As long as max_size
is small compared to the size of the base, you have a linear search time
and may be able to do this on the fly. If somebody would page down and
down in the initial position it would become slower and slower, but this
is no use case. You map only game properties, which can be mapped
lossless to a number (no player names or other strings). This allows to
reduce comparing games to comparing numbers. So you can live without
caching between calls.
The algorithm needed for the gamelist requires to sort first the whole
db and cache the result in a transposition table. Then any access is
very fast, even scrolling is possible.
So if we want to combine both we need a smart transposition class. It
has a interface to retrieve the first n games based on a smart sorting
cache class, then the next n etc. It again calculates what is needed and
caches results to improve second access.
The price of this will be few hundert Mbytes memory for a 5.000.000
database, but the result would be nice. So is this a problem?
One last note: My experience showed me that in such areas the impact of
the language (e.g. std containers) can be ignored. The algorithm counts.
Gerd
Am 25.02.2011 8:09, schrieb f...@libero.it:
I had in mind something like this:
std::priority_queue<int> order;
uint max_size = start + max_count;
for (uint gnum=0; gnum < base->numGames; gnum++) {
if (base->treeFilter->Get(gnum) == 0) { continue; }
IndexEntry * ie = base->idx->FetchEntry (gnum);
for (uint gnum=0; gnum < base->numGames; gnum++) {
if (filter->Get(gnum) == 0) { continue; }
IndexEntry * ie = FetchEntry (gnum);
int value_sortedby = ie->GetWhiteElo();
order.push(value_sortedby);
if (order.size() > max_size) order.pop();
}
std::vector<int> res(max_count);
for (int i = max_count -1; i >= 0; i--) res[i] = order.pop();
This is a sample shorter version of the algorithm in sc_tree_best.
Writing dedicated code without std containers should be faster.
However i hadn't made any speed test.
For the 'interest' value i need some chess help.
The actual formula is:
interest = avg_elo + bonus_comment - penalty_old - penalty_earlydraw -
penalty_rapid - penalty_blind
and
bonus_comment = 400
penalty_old = 20*each_year_old (max 400)
penalty_earlydraw = -250 if < 30 moves; -100 if < 40 moves
penalty_rapid = -250
penalty_blind = 400
It is a huge improvement versus the old simple avg_elo, but i'm not
really satisfied.
Let me now if you have any suggestion.
Bye,
Fulvio
----Messaggio originale----
Da: gerd.lorsch...@onlinehome.de
Data: 25/02/2011 19.19
A: "Fulvio"<f...@libero.it>
Cc: "Scid Users List"<scid-users@lists.sourceforge.net>
Ogg: Re: Re: AW: [Scid-users] Sorting by variations patch
Hello Fulvio,
it is not that easy if I assume right that you want to have it
starting from the game 20 of the sorted database. Then you need to
sort the whole base first. This takes around 5 to 30 seconds for a
large base. Is the user prepared to wait for this? So we need to
discuss the usecases.
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Scid-users mailing list
Scid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scid-users