Skip to content

catchouli/better_tactics

Repository files navigation

better-tactics

Better Tactics is a Chess tactics trainer that uses the concept of Spaced Repetition to help you master chess tactics. The idea is to help you improve your tactical pattern recognition and gain experience calcualting tactics, by repeating puzzles you've seen previously over time. Puzzles you complete will get queued up for review daily, and puzzles you find hard will be repeated more frequently, while puzzles you find easy will be repeated far less often to make the process more efficient.

Set up

There are three options to get it up and running:

  • Prebuilt binaries (windows only) on the releases page
  • From source, using cargo*: cargo run --release
  • Using Docker, a prebuilt image is available at: catchouli/better-tactics. See docker-compose.yml for an example.

Npm needs to be installed to build the frontend, but it is automatically invoked when building with cargo. If you don't have it, then install Node from: https://nodejs.org/en/download

* Note: For a standalone/portable build use the release build, as it compiles the static assets in, but the debug build references them from the ./assets directory.

Once it says it's serving the site go to e.g. http://localhost:3030 to use the app. The lichess puzzles database will be automatically downloaded and imported in the background the first time you run the application. If you don't let it finish, it'll start over again the next time you run it. The layout also has support for mobile devices; if you change BIND_INTERFACE to 0.0.0.0 (bind on all interfaces, see CONFIG.md and .env), you will also be able to access it from a phone browser over your local network.

Configuration variables can be set using environment variables or a .env file. See the included .env file for an example, and CONFIG.md for information about all available config variables.

How to use

To begin, start by practicing some new tactics puzzles on the Practice page. There, a new puzzle of an appropriate difficulty will be picked, and you'll be given the chance to study the puzzle and then identify and input the forcing line which results in checkmate, wins you material, or gains you some other advantage. After you've played some puzzles, you'll have daily reviews, which you can do on the Review page.

When you complete a puzzle, you'll be given the option to score it by how difficult you found it. The Spaced Repetition algorithm will then queue up the puzzle to be shown again to you in the future, depending on the score you picked.

If you get really stuck on a puzzle, you can click the 'Analyse' link next to the puzzle to be be taken to the Analysis Board on lichess.org, where you can analyse the puzzle using an engine to try and figure out what you're missing.

How it works

When you complete a puzzle, the difficulty score you select will be used to calculate how long it should be until you see the puzzle again, and also to update your rating. The scores are interpreted as follows:

  • 'Again' means that you failed to solve the puzzle on the first and need to review it again in the near future, in which case the Spaced Repetition algorithm will set the puzzle to be 're-learned', and you'll see it again the same day.
  • 'Hard' meaning that you found the solution but that it was quite challenging, in which case you'll see the puzzle again in about the same amount of time since you last saw it.
  • 'Good' is the neutral answer for a successful review, and the one that should be used primarily. After picking it the puzzle's review interval will be increased, and you'll see it less and less frequently over time.
  • 'Easy' indicates you didn't find the puzzle very challenging at all, and is a good hint to the algorithm that you don't need to see it again very soon at all, and will cause its review interval to increase significantly.

The review button for each difficulty shows you the amount of time until you'll see that puzzle again if you pick that difficulty.

The difficulty you select is also used to calculate you a rating, according to the difficulty level of the puzzle, and how difficult you found it. 'Good' reviews will cause your rating to grow slowly over time, while 'Again' or 'Easy' reviews may cause larger swings in your rating. Initially, the algorithm will be very uncertain about your rating, and you may experience large swings, but this allows it to quickly find the right rating level for you as it becomes more and more accurate with each puzzle you complete. The rating algorithm used is Glicko2, a common rating system for online chess and competitive games.

Initial rating

The initial rating is currently 500. Because we use glicko2 ratings, it should increase pretty fast if you press 'easy' on puzzles beyond your current rating, but you may still find it takes a while for your rating to become accurate. A planned feature is some kind of rating wizard to set the initial rating more accurately on a per-user basis.

if you find you need to manually reset your rating or set it to a particular value, you can set it using the debug endpoint /api/user/reset_rating/{desired_rating}, which also resets your rating variance and should allow the app to re-find your rating level at about the given level. (e.g. http://localhost:3030/api/user/reset_rating/1500)

Acknowledgements

Made using Rust, warp, and askama. The Spaced Repetition algorithm used is the SuperMemo 2 Algorithm.

The puzzles are sourced from the lichess puzzles database, which is amazing. Thanks, Thibault and the lichess community!

The chess board is also lichess's open source chessground chess board component, and the legal move detection and uses chess.js.

Warning

This project is pretty functional but still experimental. You might encounter issues that require you to reset (or manually repair) your database. If you have trouble, let me know about it by making an issue, and hopefully I can fix it so it doesn't happen again (and if you send your database to me somehow I can try and repair it for you).

About

Chess tactics trainer with spaced repetition

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors