~ntietz/isabella-db

eaae02d2fa33e0eaf8d89c1d426695e1cd1a2889 — Nicholas Tietz-Sokolsky 12 days ago 4c43d2d
Start on design doc around queries
1 files changed, 62 insertions(+), 0 deletions(-)

A docs/0003-query-design.md
A docs/0003-query-design.md => docs/0003-query-design.md +62 -0
@@ 0,0 1,62 @@

This design document is a scratch doc for me as I work through some examples of
queries I want to be able to do and (potentially) some concrete implementation
details.

---

The key question is, what do I want out? Games or positions?
Both!

I want to be able to query for either.

In some situations I want to find all the games, in others I want to find
positions which match some criteria.


# Search examples

## Game searches

Find all games...
- played by Magnus Carlsen
- which contain the main line Giuocco Piano where black wins
- where the Caro-Kann transposes to a French Defense
    (the Caro-Kann can be characterized by one position; the French may have multiple)
- where the King's Gambit ends in less than 30 moves and white wins
- where the King's Gambit ends in less than 30 moves and black wins
- where a Botez Gambit occurs
- which contain a rook-and-pawn endgame
- which contain an opposite-color bishop endgame
- which last over 40 moves and end in a decisive result
- where the lower-rated player won in under 20 moves
- where one player goes down material and then wins
- where one player goes down material and then draws
- which contain a [Greek gift sacrifice](https://en.wikipedia.org/wiki/Greek_gift_sacrifice), successful or not
- which contain a heavy-piece endgame
- which end in threefold repetitions
- which end due to the 50-move rule
- which end with dual bare kings


## Position searches

Find all positions...
- where a rook and queen are skewered
- where a queen is pinned to the king
- where a rook is pinned to the king
- where there is an isolated queen pawn and it's in the first 20 moves of the game
- where the following move in the game is an underpromotion of a pawn
- where the following move in the game is a fork of two pieces


# Reasons to search

I think in general searching will be used for one of a few reasons:
- to find games to study to work on a particular element (via solitaire chess, etc.)
- to find positions to use as puzzles
- to find entertaining/interesting games

I think in general, the key is to focus on *game* search, which may also entail
finding positions which the game contains which match certain criteria.