lakesare / memcode

Spaced-repetition: with real formatting.
http://memcode.com
MIT License
330 stars 71 forks source link

Add multiple valid values for a "Fill in answer" #104

Closed initBasti closed 3 years ago

initBasti commented 3 years ago

Hey,

thank you guys for this wonderful project, I have been using it daily for over a year now. I just have one little question, is it possible to add an optional "alternative answer" field to a fill-in answer? What I mean is a field, where I can declare alternative valid answers that relate to the same field. It's often quite cumbersome having to find out how the exact sequence of characters in that answer was. For example, here is one of my questions: Set the xth bit of Set A : A |= 1<<x , the fat part is the part that needs to be filled in. I would be very happy if I could add alternative answers so that either: "|= 1<<x" or "|=1<<x" or "|= 1 << x" would be valid answers because they essentially have the same meaning. In other cases, a choice of multiple valid words could be helpful as well.

Greetings

lakesare commented 3 years ago

Thank you ❤️

Alternative answers have been requested before, and I think we should implement that. However my go-to solution for this would be to interpret the pipe character in the answer field as the alternative-word-delimiter, like so:

image

That wouldn't go so well with your particular example, and I'm not sure what other easy options we have 🤔 In general when creating programming flashcards I would advise to use free-form Question-Answer flashcards, with code there are indeed too many options of how to answer to something for cloze-deletion cards to be much usable.

image

initBasti commented 3 years ago

The pipe solution looks great and I agree that expecting the flashcard to interpret your syntax is probably way too hard. Thanks for the reply!

lakesare commented 3 years ago

I worry if we implement the pipe solution we'll ruin your flashcards (and maybe someone else's, though I imagine that's rare).

initBasti commented 3 years ago

Well, wouldn't that only ruin flashcards that use a literal '|' within their fill-in answer? For those cases, we would just require a way to escape the symbol like \|. And I would say that at least from my perspective that's not too bad. I guess it would go like this: I review the flashcards and hit a card with a literal '|', I try out the answers but none of them work so I click on reveal or the answer is correct to early, next I notice that the answer is cut off at some point go into edit mode and escape the '|' char. If you warn about that situation, that would be totally fine. Also, could you make a scan for that character in your database? Then you could either place warnings on cards where the functionality is in danger because of that character. Or even more radical as anyone that uses the '|' character in a fill-in answer requires it to be literal currently, couldn't you just replace all occurrences in your database of '|' with '\|'? I think most important for me would just be that when I type the '|' character in a fill-in answer that I am notified that this 'starts' the alternative answer mode.

lakesare commented 3 years ago

Very smart escaping solution, got to stick to it 👍 I'll try to implement alternative answers this week.

lakesare commented 3 years ago

Done, should be deployed in ~15 minutes. As always - refresh the browser cache if changes aren't visible.