nguyenpham / ocgdb

Open Chess Game Database Standard (OCGDB)
MIT License
31 stars 7 forks source link

Request option to search a database for games where one of the players have at least a specified elo. #33

Open Jonathan003 opened 2 years ago

Jonathan003 commented 2 years ago

I would like to specify somehow that only one player have to have an elo rating of minimum 2000 elo, for example. So, games where one player has for example 1400 elo and the other player has 2100 elo would also be included. Is it possible to search an ocgdb database for these games with Banksia?

nguyenpham commented 2 years ago

One of the strongest points of OCGDB is that it creates and works with SQL databases. Those databases can be queried/modified easily by using SQL - the strongest query language for databases. It is very flexible and covers almost all things, far beyond all functions we could implement and provide for users. SQL is quite close to English, not hard to learn, easy to understand and modify.

SQL could run with other programs, not requiring our programs. Below is the screen of the program SQLiteStudio (a freeware) working with our chess database, find and display all games as your request (one player has Elo from 2000).

SQL statement:

SELECT *
FROM Games
WHERE WhiteElo >= 2000 OR BlackElo >= 2000

Result:

SQLiteStudio

The main drawback of using normal SQL programs is that they don’t know about chess and can’t display chessboard or extract PGN. Users may copy the game ID then run OCGDB to extract PGN.

Another solution is to use chess GUIs that integrate OCGDB. Below is a screen from BanksiaGUI (which has been being integrated with OCGDB). After querying, users can click on any line in the table and the GUI will display the appropriate game.

BSG

If anyone is new to SQL, he can ask here. We or anyone who could help will create the SQL query (just a short text of a few lines), which he can copy to his programs and modify as needed (say, change the number of Elo, replace OR by AND…).