Skip to content

NTU-CSIE-DSA/guess-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guess Code

A terminal-based interactive application for exploring and guessing code implementations. This project uses the FTXUI library to create a user-friendly terminal interface where users can progressively reveal and understand code implementations of various algorithms.

Project Overview

Guess Code is an educational tool designed to help users learn programming algorithms through an interactive "reveal" approach. The application presents several classic algorithms with their implementations initially hidden. Users can gradually reveal lines of code by clicking on them, encouraging them to think about and predict how the algorithm works before seeing the full implementation.

Features

  • Interactive terminal-based UI powered by FTXUI
  • Multiple algorithm implementations to explore
  • Progressive code revelation with mouse interaction
  • Real-time progress tracking for each algorithm
  • Split-view for larger code files

How to Use

  1. Navigate the problems using the tab menu on the right
  2. Reveal lines of code using one of these methods:
    • Click on hidden (dark) lines of code to reveal them
    • Type line numbers in the input box and press Enter (examples: "5", "1,3,7")
    • Type a range of line numbers (example: "1-10")
    • Type a list of ranges (example: "1-10,20")
    • Type "all" to reveal the entire implementation at once
  3. Track your progress with the progress bar at the bottom
  4. Try to understand the algorithm before revealing all lines
  5. Make sure your terminal is large enough (at least 45 rows and 128 columns) to view the code properly

Building the Project

Prerequisites

  • C++ compiler with C++17 support
  • CMake (version 3.22 or higher)
  • FTXUI library (automatically fetched by CMake)

Build Instructions

mkdir build
cd build
cmake ..
make

After building, run the executable:

./guess-code

Implementation Details

The application is structured around several key components:

  • Problem Loading: Source code files are read from the problems/ directory and stored in memory
  • Interactive UI: FTXUI components create a responsive terminal interface
  • Reveal Mechanism: Mouse events are tracked to determine which lines to reveal
  • Progress Tracking: The application tracks and displays how much of each algorithm has been revealed

License

See the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to submit pull requests or open issues for new features, bug fixes, or additional algorithms to include.

Credits

  • Built using the FTXUI library for terminal user interfaces.
  • Using nlohmann/json for JSON parsing.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors