Skip to content

CODE-URV/challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code URV — C Challenges

A growing collection of small, fix-and-improve C challenges for CODE URV partners. Each challenge includes a buggy starter program and one or more reference solutions. You’re invited to submit your own solutions via pull request.


Getting started

Dependencies

  • gcc (or any C11-compatible compiler)
  • make (for the provided Makefiles)
  • gdb (optional, for debugging)

Build & run (generic)

# from a challenge solution folder, e.g.:
cd challenges/01_ScapeRoom/solutions/solution_exhaustive

# build (via Makefile)
make

# run
make run    # or: ./app

# debug (rebuilds with -g -O0 and launches gdb)
make debug

If you prefer not to use make, you can compile and run directly:

gcc -std=c11 -Wall -Wextra -Wpedantic *.c -o app
./app

Repository layout

.
├── README.md
└── challenges/
    └── 01_ScapeRoom/
        ├── original/                 # original buggy source (for the challenge)
        └── solutions/
            ├── solution_naive/       # minimal changes to pass the challenge
            └── solution_exhaustive/  # robust version with safer I/O, etc.

🧩 Challenges

01 — ScapeRoom

A small “escape room” style program with intentional bugs around input handling and branching. The goal is to fix format specifiers, reading logic, and switch-case conditions to produce a correct personalized greeting.

Original assignment (OnlineGDB):

Part Path Notes
Challenge (original) challenges/01_ScapeRoom/original/ Buggy code. Focus: safer input (fgets vs. scanf), buffer sizes, and correct switch cases.
Solution: naive challenges/01_ScapeRoom/solutions/solution_naive/ Minimal edits to make it work while keeping the original spirit.
Solution: exhaustive challenges/01_ScapeRoom/solutions/solution_exhaustive/ Defensive I/O helpers, boundary checks, and clearer structure suitable for teaching best practices. online solution in onlineGDB

Contributing

Contributions are welcome! You can add:

  • New solutions to existing challenges (different styles, trade-offs, or teaching angles).
  • New challenges (small, self-contained programs with purposeful bugs).

How to contribute

  1. Fork the repository.

  2. Create a branch for your change: git checkout -b feat/my-solution-01

  3. Place your work under the appropriate folder:

    • New solution: challenges/<NN_Name>/solutions/<your_solution_name>/
    • New challenge: challenges/<NN_Name>/ with original/ and an initial solutions/ subfolder
  4. Include a short README.md inside your solution with:

    • Build/run instructions (make, gcc, gdb usage if relevant)
    • What you fixed/changed and why
    • Any caveats or discussion points
  5. Open a Pull Request. In the PR description, link the challenge and summarize your approach.

Guidelines

  • Prefer C11, -Wall -Wextra -Wpedantic.
  • Avoid unsafe I/O; if you use scanf, limit widths and justify the choice.
  • Keep code clear and commented where it teaches a lesson (inputs, buffers, error paths).
  • If you change behavior for portability (e.g., locales, Unicode), note it in your solution’s README.md.

Roadmap (coming soon)

  • 02 — TBD: input parsing and validation
  • 03 — TBD: string manipulation and boundary checks
  • 04 — TBD: modularization with headers and multiple source files

Have an idea for a challenge? Open an issue or draft PR with a short description and an example of the intentional bug(s).


License

This project is free software. Unless stated otherwise in subfolders, all content is licensed under the GNU General Public License v3.0 (GPL-3.0). If you need a different license for your submission, include a LICENSE file in your solution folder and mention it in your solution’s README.md.

About

Programa ScapeRoom que conté errors intencionats. L'objectiu de l'usuari és arreglar el codi per tal que funcioni bé. Aquest repositori guarda possibles solucions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors