A C-based timetable generator that creates conflict-free weekly schedules for N classes using a Backtracking Algorithm (Constraint Satisfaction), wrapped in a beautiful, high-performance, mouse-free Truecolor Text User Interface (TUI).
- Interactive TUI Dashboard: Styled with a 24-bit Truecolor Catppuccin Mocha palette, complete with a navigable settings form and grid-based subject editor.
- Flicker-Free, Zero-Lag Rendering: Uses single-write in-memory buffering (formatting frames in RAM and printing in a single
fputscall) to eliminate input latency. - Generates timetables for multiple classes simultaneously while preventing resource conflicts.
- Supports Theory (single slot) and Lab (double slot) subjects.
- Fixed college timings (8:30 AM to 4:15 PM) including Tea Break (10:20 - 10:40) and Lunch Break (12:30 - 1:30).
- 3 FREE periods randomly placed per class per week.
- No repetition on the same day: Theory subjects appear once per day, and Lab subjects appear as a single consecutive double-slot.
- Database Schema & Text Export: Exports generated schedules to
timetable.txtor writes directly to MySQL database using native command-line connectors.
[UP]/[DOWN]: Move focus between settings fields (Classes, Days, Subjects, MySQL User/Password).[LEFT]/[RIGHT]or Numeric Keys: Increment/decrement or type number values directly.- Text Typing: Enter database username and password (password is safely masked with
*). [Enter]: Navigate to next field, or click[ PROCEED ]to go to the subject editor.
[Arrow Keys]: Navigate cells up, down, left, and right.[Tab]/[Enter]: Commit the cell value and jump focus to the next cell.[Space]: Toggle subject type between Theory and Lab (Labs automatically verify and set even weekly hours).[Delete]: Clear text or numeric values in the focused cell instantly.[Backspace]: Delete character-by-character.[Enter]on[ GENERATE TIMETABLE ]: Validate and launch the solver.
[LEFT]/[RIGHT]: Cycle between different class schedules (e.g., Class 1, Class 2).[S]: Save the weekly schedule totimetable.txt.[M]: Export and import schedules directly into MySQL server.[Esc]: Return to the subject grid editor.
| Time | Slot |
|---|---|
| 08:30 - 09:25 | Period 1 |
| 09:25 - 10:20 | Period 2 |
| 10:20 - 10:40 | TEA BREAK |
| 10:40 - 11:35 | Period 3 |
| 11:35 - 12:30 | Period 4 |
| 12:30 - 01:30 | LUNCH BREAK |
| 01:30 - 02:25 | Period 5 |
| 02:25 - 03:20 | Period 6 |
| 03:20 - 04:15 | Period 7 |
Ensure you have a C compiler like gcc (MinGW) on your path.
gcc main.c -o timetable.exe -std=c99
.\timetable.exegcc test_solver.c -o test_solver.exe
.\test_solver.exeBacktracking with Constraint Satisfaction:
- Pre-places breaks and 3 random FREE periods.
- Tries subject placements in a shuffled order (for scheduling variety).
- Applies constraints: No subject repetition on the same day, consecutive lab session pairs, no theory repetition in consecutive slots.
- Backtracks on dead-ends, retrying with alternative free period placements.
Time Complexity:
The system auto-generates timetable_data.sql and imports it into MySQL timetable_db tables:
config: Generation settings configuration.subjects: Input list of subject names and hour requirements.timetable: Generated timetable matrix with exact timing intervals and categories.
Built as a Design and Analysis of Algorithms mini-project demonstrating practical constraint-satisfaction backtracking.