- Blind mode tutorial
lichess.org
Donate

Lichess API - Get Random Game played on lichess

I'm doing a research project where I would like to get a random lichess game for N times to test few hypothesis. It would be quite useful if I can ask for specific elo range, but getting a random game is a good place to start. Unfortunately, I didn't find such an option in the documentation. Downloading the whole lichess games database seems like an overkill. Is this possible?

I'm doing a research project where I would like to get a random lichess game for N times to test few hypothesis. It would be quite useful if I can ask for specific elo range, but getting a random game is a good place to start. Unfortunately, I didn't find such an option in the documentation. Downloading the whole lichess games database seems like an overkill. Is this possible?

Hi, maybe I am bit OT here because I didn't know how Lichess API works nor what you would like to achieve.
But have you considered downloading the whole set of played games (if I remember correctly is partitioned by dates month by month).

You can then import in a DB and have all the flexibility you need

Hi, maybe I am bit OT here because I didn't know how Lichess API works nor what you would like to achieve. But have you considered downloading the whole set of played games (if I remember correctly is partitioned by dates month by month). You can then import in a DB and have all the flexibility you need

That's a total of 136 files and 1.74 TB of memory.

That's a total of 136 files and 1.74 TB of memory.

@MrCrusher said in #3:

That's a total of 136 files and 1.74 TB of memory.

This is more than 1.74 TB of memory, because the files are compressed. And as said in https://database.lichess.org : "Expect uncompressed files to be about 7.1 times larger."

@MrCrusher said in #3: > That's a total of 136 files and 1.74 TB of memory. This is more than 1.74 TB of memory, because the files are compressed. And as said in https://database.lichess.org : "Expect uncompressed files to be about 7.1 times larger."

what's the goal of this? it sounds very unlikely that you would actually need a game picked randomly from the complete dataset, and in many cases that might even be counterproductive.

edit: it also sounds very unlikely that they will implement this, because the usecase sounds extremely specific. looking for alternatives is probably the way to go about it.

what's the goal of this? it sounds very unlikely that you would actually need a game picked randomly from the complete dataset, and in many cases that might even be counterproductive. edit: it also sounds very unlikely that they will implement this, because the usecase sounds extremely specific. looking for alternatives is probably the way to go about it.

There are plenty of reasons to allow this. For example, having a random game of the day feature, analyzing certain habits of players, answering questions such as: "How common is it for beginners to move/lose their queen early?", "What percentages of decisive game end because of a tactical oversight at the level of 1500-1800", and many more.

There are plenty of reasons to allow this. For example, having a random game of the day feature, analyzing certain habits of players, answering questions such as: "How common is it for beginners to move/lose their queen early?", "What percentages of decisive game end because of a tactical oversight at the level of 1500-1800", and many more.

@MrCrusher said in #6:

having a random game of the day feature

for that, wouldn't you want the game to be of that day? also, terrible idea, because most random chess games aren't interesting to look at.

analyzing certain habits of players, answering questions such as: "How common is it for beginners to move/lose their queen early?", "What percentages of decisive game end because of a tactical oversight at the level of 1500-1800", and many more.

there's way better ways to answer these questions than sampling random games via an api though. way better.

but yeah, feel free to argue this to the devs. don't say i didn't warn you.

@MrCrusher said in #6: > having a random game of the day feature for that, wouldn't you want the game to be of that day? also, terrible idea, because most random chess games aren't interesting to look at. > analyzing certain habits of players, answering questions such as: "How common is it for beginners to move/lose their queen early?", "What percentages of decisive game end because of a tactical oversight at the level of 1500-1800", and many more. there's way better ways to answer these questions than sampling random games via an api though. way better. but yeah, feel free to argue this to the devs. don't say i didn't warn you.

I'm just saying the whole functionality of getting a random game/s is not available. If it does exist, then you can add a parameter that gets a random game played on a certain date, or given a range of ELO.

I want to do a large random sample of games, played by players from a certain range of ELO and gather information on them to get to a statistical conculsion. I just asked to see if there's a way to use lichess api to get the games, I'm not asking for an evaluation of my methodology.

I'm just saying the whole functionality of getting a random game/s is not available. If it does exist, then you can add a parameter that gets a random game played on a certain date, or given a range of ELO. I want to do a large random sample of games, played by players from a certain range of ELO and gather information on them to get to a statistical conculsion. I just asked to see if there's a way to use lichess api to get the games, I'm not asking for an evaluation of my methodology.

@MrCrusher said in #8:

I want to do a large random sample of games, played by players from a certain range of ELO and gather information on them to get to a statistical conculsion [...] I'm not asking for an evaluation of my methodology.

you may not be asking for it, but i will still give an evaluation.
sampling from the full database for this would be a bad idea, because elo ranges have definitely not been stable for the timeframe covered in the database. e.g. 2000-2200 blitz rating in 2012 does not have the same meaning as 2000-2200 blitz rating in 2024.
to answer any questions like this, you would probably be better off to just sample from the last month.

this by the way was what i meant when initially i wrote that sampling from the complete database might be counterproductive.

I just asked to see if there's a way to use lichess api to get the games

there is not.

ELO

by the way, elo is not an acronym. elo in the "elo rating system" is the last name of arpad elo. so unless you write everyone's last name in all caps, you should only capitalize the first letter of elo.

@MrCrusher said in #8: > I want to do a large random sample of games, played by players from a certain range of ELO and gather information on them to get to a statistical conculsion [...] I'm not asking for an evaluation of my methodology. you may not be asking for it, but i will still give an evaluation. sampling from the full database for this would be a bad idea, because elo ranges have definitely not been stable for the timeframe covered in the database. e.g. 2000-2200 blitz rating in 2012 does not have the same meaning as 2000-2200 blitz rating in 2024. to answer any questions like this, you would probably be better off to just sample from the last month. this by the way was what i meant when initially i wrote that sampling from the complete database might be counterproductive. > I just asked to see if there's a way to use lichess api to get the games there is not. > ELO by the way, elo is not an acronym. elo in the "elo rating system" is the last name of arpad elo. so unless you write everyone's last name in all caps, you should only capitalize the first letter of elo.

This topic has been archived and can no longer be replied to.