Skip to content

Instantly share code, notes, and snippets.

@bemitc
Created December 8, 2021 01:57
Show Gist options
  • Save bemitc/c30cd371214e54439ce09251bb252a2a to your computer and use it in GitHub Desktop.
Save bemitc/c30cd371214e54439ce09251bb252a2a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# simple script to produce a csv to import into anki to incorporate spaced repetition for chessking apps
# this one is for chess tactics for beginners, you just create a table with categories and number of problems in each category
wrong = "\"If you made any incorrect moves, fail card. Otherwise pass. Always fully calculate full variations without moving pieces.\""
tbl = [
["MateIn1.RookCheckmates", 12],
["MateIn1.QueenCheckmates", 18],
["MateIn1.BishopCheckmates", 12],
["MateIn1.KnightCheckmates", 12],
["MateIn1.PawnCheckmates", 6],
["MateIn1.MateIn1", 90],
["WinningMaterial.GainQueen", 203],
["WinningMaterial.GainRook", 83],
["WinningMaterial.GainKnight", 60],
["WinningMaterial.GainBishop", 81],
["Draw", 58],
["MateIn2.DoubleCheck", 30],
["MateIn2.QueenMate", 49],
["MateIn2.RookMate", 36],
["MateIn2.KnightMate", 30],
["MateIn2.BishopMate", 24],
["MateIn2.PawnMate", 12],
["Sacrifice.Queen", 71],
["Sacrifice.Rook", 30],
["Sacrifice.Bishop", 5],
["Sacrifice.Knight", 11],
["HowToProceed", 342]
]
for x in tbl:
for y in range(1, x[1]+1):
print('{}.{},{}'.format(x[0], y, wrong))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment