ArneVogel / listudy

Listudy - chess training server
https://listudy.org
GNU Affero General Public License v3.0
288 stars 44 forks source link

Add a key moves feature similar to Chessable #42

Closed KerfuffleV2 closed 3 years ago

KerfuffleV2 commented 3 years ago

The idea would be to start training at the first point the PGN has variations to avoid having to play the first few basic moves repeatedly.

I made an extremely simple proof of concept version here which appears to work: https://github.com/KerfuffleV2/listudy/tree/key_moves_feature

Since I don't actually know JavaScript and I'm not familiar with the codebase it's likely this isn't a good approach. The meat of it is in the tree_from_pgn.js:annotate_pgn function which adds a move_index value to each move and a first_variation to the head of the game. The toggle is not hooked up to the UI in that branch and currently always set to true.

It's implemented in study.js to just skip through the moves like you do when it's not the student's turn by calling play_move(ai_move(...)) when the toggle is set and there actually is a variation in the current chapter.

The annotated tree seems like it would also make implementing a maximum study depth feature relatively easy.

If I broke any etiquette, please forgive me. I don't contribute to projects on Github often.

ArneVogel commented 3 years ago

This is actually something requested before and something I wanted to add in the future. Currently I am quite busy with university, I will take a look at it when I get some time.

KerfuffleV2 commented 3 years ago

This is actually something requested before and something I wanted to add in the future. Currently I am quite busy with university, I will take a look at it when I get some time.

I went ahead and also added a simple way to limit depth in that branch. Hopefully the code will be useful to you in some way! Please let me know if you have any questions about it or suggestions on the approach I took.

ArneVogel commented 3 years ago

I finally got to integrating this. I changed it a little bit where in key move mode, moves that are not fully trained will not be skipped. Other than that I just added the UI for it and tweaked it a bit to work with the sound.

Thanks for the work!

KerfuffleV2 commented 3 years ago

Excellent, glad my code turned out to be helpful!