Help us measure site usage?

With your permission, we use self-hosted analytics to understand page usage. It is optional and does not affect the Service. Learn more.

RubybeginnercliAI generated

Terminal Flashcards

Build a flashcard trainer that runs in the terminal, written in Ruby: load a deck of cards (a question and an answer each) from a file, get asked the cards in random order, type your answer, and see whether you were right, with a score at the end. Cards you get wrong come back more often in the next sessions, and your accuracy per card and per deck is saved, so you can see your progress over time. It's a great first Ruby project: you'll learn classes, reading YAML or CSV files, arrays and hashes, randomness, comparing answers flexibly, saving data to a file, OptionParser, and testing with Minitest.

Estimate
~6h
Steps
5
Completed by
0
Proposed by
codeseed.app

Ruby · YAML · Minitest

Project roadmap

  1. 01

    Define the deck format

    ~1h

    Write README.md with the deck format in YAML (a deck name and cards, each with an id, a question, an answer and optional alternative answers) and the commands (flashcards study DECK, with --limit and --reverse to ask answers and expect questions, and flashcards stats DECK). Write a sample deck with 20 cards. Create a Gemfile with minitest. Done when: README.md and the sample deck are written.

  2. 02

    Load and validate decks

    ~1h

    Create Card and Deck classes, and load a deck with YAML.safe_load_file, checking that every card has an id, a question and an answer, and that ids are unique. Report problems with the card number and stop. Done when: the sample deck loads, and a broken deck reports its problems clearly.

  3. 03

    Run a study session

    ~1.5h

    Shuffle the cards (weighted so cards with low accuracy appear more often), ask each question, read the answer with gets, and compare it ignoring case, extra spaces and punctuation, also accepting alternative answers. Show correct or wrong with the right answer, and a score at the end. Let the user type :q to stop early. Done when: a full session runs and gives a correct score.

  4. 04

    Save progress

    ~1h

    Save each card's attempts and correct answers in a progress file (JSON) next to the deck, after every answer, so nothing is lost if the session stops. Add the stats command showing the deck's overall accuracy, the 5 hardest cards, and the number of sessions. Done when: progress is kept between sessions, and stats shows it correctly.

  5. 05

    Test it

    ~1.5h

    Write Minitest tests: loading valid and broken decks, answer comparison (case, spaces, punctuation and alternatives), the weighted shuffle favoring hard cards over many runs (with a seeded random generator), and saving and loading progress. Done when: the tests pass.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~6h · 5 steps

Tech stack

RubyYAMLMinitest