chess database format

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

DustinYoder
Posts: 21
Joined: Wed Jul 13, 2011 5:20 am

chess database format

Post by DustinYoder »

Is there a chess database stucture that can store legal moves from positions? And positions can be looked up randomly without a hash or index.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: chess database format

Post by sje »

Given a position, it will likely be that generating the moves is much, much faster than looking up the moves.
DustinYoder
Posts: 21
Joined: Wed Jul 13, 2011 5:20 am

Re: chess database format

Post by DustinYoder »

Yes but I would store other data along with each move. Are tablebases pretty much all hash or index driven?
AlvaroBegue
Posts: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: chess database format

Post by AlvaroBegue »

How else would you search quickly for a position, if it's not using a hash or an index?
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: chess database format

Post by Desperado »

DustinYoder wrote:Is there a chess database stucture that can store legal moves from positions? And positions can be looked up randomly without a hash or index.
What are you looking for ? :?

A: position database

- record should be looked up randomly
- record includes: legal moves, and other stuff
- records are independant positions
- ...
B: game database
- record includes game (positions) which can be loaded by random
- ...
C: tree dump
- ...
D: any other search related snapshot
- ....
E: whatever ?!
- ...

can you please give more details how the final task looks like ?
There are of course posibilities to lookup "positions" in a database
without hashing. The question will be, if it makes sense.
All depends on what you want to do (book,egtb,search-snapshot,permanent Hashtables,
or a mix up of these points, OR maybe something completely different :lol: :?: )

Michael
wgarvin
Posts: 838
Joined: Thu Jul 05, 2007 5:03 pm
Location: British Columbia, Canada

Re: chess database format

Post by wgarvin »

Solving chess will require vastly more computational resources and storage than solving checkers did. I don't expect chess to be solved within my lifetime.

http://en.wikipedia.org/wiki/First-move ... ving_chess
wikipedia wrote:It is thus theoretically possible to "solve" chess, determining with certainty whether a perfectly played game should end in a win for White, a draw, or even a win for Black. However, according to Shannon the time frame required puts this possibility beyond the limits of any feasible technology.

...

Recent scientific advances have not significantly changed that assessment. The game of checkers was solved in 2007, but it has roughly the square root of the number of positions in chess. Jonathan Schaeffer, the scientist who led the effort, said a breakthrough such as quantum computing would be needed before solving chess could even be attempted, but he does not rule out the possibility, saying that the one thing he learned from his 16-year effort of solving checkers "is to never underestimate the advances in technology".
AlvaroBegue
Posts: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: chess database format

Post by AlvaroBegue »

Were you trying to reply to a different post?
wgarvin
Posts: 838
Joined: Thu Jul 05, 2007 5:03 pm
Location: British Columbia, Canada

Re: chess database format

Post by wgarvin »

No. Michael asked what he is looking for. From the other thread titled "Solving Chess", I believe that what he is looking for is a technique he can use to try and solve chess.
DustinYoder
Posts: 21
Joined: Wed Jul 13, 2011 5:20 am

Re: chess database format

Post by DustinYoder »

Yes definately option A. I'm trying to find research on available structures like this. So maybe a good chess position db resource.
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: chess database format

Post by Desperado »

Well, the reason because i would like to know more _details_ is, that
i am able to offer a database structure containing games + positions
(containing about 300.000 games,~35-40.000.000 positions,~80MB)

I recently setup a _basic_ structure which looks like this:

Code: Select all

- Header type

   * startposition of game
   * number of moves

- data type
 
   * movelist (game)
with access to positions like (pseudocode):

Code: Select all


void db_randomPos(...)
{
 game    = rnd64() % gamesNb;    db_loadgame(game);
 position = rand() % moveLimit;
 for&#40;int i=0;i<gamelength && i<position;i++)
 &#123;moveDo&#40;pos,undo,game->mve&#91;i&#93;);&#125;
&#125;

There is no high quality code (it s more quick and dirty), but
i only use it within my testframe.
It is easy to load _randomly_ (starting) positions for playouts,
or other _offline_ learning cases i am playing with.

Now, it is trivial work to expand the records with _all_ legal moves for a
position (which will blow up the memory of the database by factor 35-40 at least, i guess).

So after a position is loaded, there _must_ sth. be done with it.
Is it passed to an engine for _normal_ search, or used to wallpaper the living room with
chess positions :-) ?

In any case you need some kind of _engine_ for:

- proof game analyses
- retrograde analyses
- minimax type analyses

if you use your _own_ engine, or an _openSource_ one doesnt matter.
Finally you would need to add a _moveType converter_
(which is a 10 minutes job) to use the database.

Michael