Created
March 4, 2021 04:41
-
-
Save itsjohncs/ccc20acf60557c7c3241a627b272fed4 to your computer and use it in GitHub Desktop.
When ran against your chess data export from Lichess, prints out the dates during which you played no games.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import re | |
import datetime | |
played_chess_on = set() | |
with open("/Users/johnsullivan/Downloads/lichess_johncs_2021-03-04.pgn") as f: | |
for line in f: | |
match_obj = re.match(r'^\[Date "([^"]+)"]\s*$', line) | |
if match_obj: | |
played_chess_on.add(match_obj.group(1)) | |
cur_day = datetime.date.today() | |
for i in range(365): | |
cur_day_str = cur_day.strftime("%Y.%m.%d") | |
if cur_day_str not in played_chess_on: | |
print(cur_day_str) | |
cur_day -= datetime.timedelta(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment