Skip to content

Instantly share code, notes, and snippets.

@itsjohncs
Created March 4, 2021 04:41
Show Gist options
  • Save itsjohncs/ccc20acf60557c7c3241a627b272fed4 to your computer and use it in GitHub Desktop.
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.
#!/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