diff --git a/problems/minipomodoro/SPEC-v1.txt b/problems/minipomodoro/SPEC-v1.txt new file mode 100644 index 00000000..8b300385 --- /dev/null +++ b/problems/minipomodoro/SPEC-v1.txt @@ -0,0 +1,76 @@ +PROJECT: minipomodoro +AUTHOR: Ömer Faruk Aksoy (251478060) +VERSION: v1 +DATE: 2026-03-13 + +======================================== +OVERVIEW +======================================== + +minipomodoro is a command-line Pomodoro and time-tracking application. +It forces users to focus by limiting the number of pauses allowed during a session. +All data is persisted in a directory called .minipomodoro/ +in the current working directory. + +======================================== +COMMANDS +======================================== + +--- init --- +Usage: python minipomodoro.py init +Creates a .minipomodoro/ directory and an empty timer.dat file. +If .minipomodoro/ already exists, print "Already initialized" and exit. + +--- start --- +Usage: python minipomodoro.py start "Math Study" +Starts a new task. Checks if the last completed task was finished less than 5 minutes ago.  +If so, rejects starting. +Appends a new task to timer.dat with status RUNNING. +Prints "Started task: . Focus!" + +--- pause --- +Usage: python minipomodoro.py pause +Pauses the currently RUNNING task.  +A user can only pause a task a maximum of 3 times. +If pause count is 3, prints "Error: Pause limit reached! Keep focusing." +Otherwise, updates status to PAUSED, increments pause count, and prints "Task paused. pauses remaining." + +--- resume --- +Usage: python minipomodoro.py resume +Changes the currently PAUSED task status back to RUNNING. +Prints "Task resumed. Get back to work!" + +--- stop --- +Usage: python minipomodoro.py stop +Stops the active task and calculates total elapsed time. +If elapsed time is less than 25 minutes, prints "Warning: Stopped before 25 minutes." +Marks task as DONE. +Prints "Task stopped. Total time: mins." + +--- log --- +Usage: python minipomodoro.py log +Prints all tasks, one per line: +  [1] [DONE] Math Study (25 mins) - 2 pauses +  [2] [RUNNING] Read Book (12 mins) - 0 pauses +If no tasks exist, prints "No timer logs found." + +======================================== +DATA FORMAT +======================================== + +File: .minipomodoro/timer.dat +Format: One task per line, fields separated by | +Structure: id | description | status | elapsed_minutes | pause_count | last_update_timestamp +Example: +1|Math Study|DONE|25|2|1710345600 +2|Read Book|RUNNING|12|0|1710347800 + +======================================== +ERROR HANDLING +======================================== + +- Running any command before "init": print "Not initialized. Run: python minipomodoro.py init" +- Starting a task while one is RUNNING: print "Error: A task is already running. Stop or pause it first." +- Pausing a task that is not RUNNING: print "Error: No active task to pause." +- Starting a task before 5-minute break: print "Error: You must rest for 5 minutes between tasks." +- Invalid command: print "Unknown command: " diff --git a/problems/minipomodoro/SPEC-v2.txt b/problems/minipomodoro/SPEC-v2.txt new file mode 100644 index 00000000..e8b59d19 --- /dev/null +++ b/problems/minipomodoro/SPEC-v2.txt @@ -0,0 +1,85 @@ +PROJECT: minipomodoro +AUTHOR: Ömer Faruk Aksoy (251478060) +VERSION: v2 +DATE: 2026-03-28 + +======================================== +OVERVIEW +======================================== + +minipomodoro is a command-line Pomodoro and time-tracking application. +It forces users to focus by limiting the number of pauses allowed during a session. +All data is persisted in a directory called .minipomodoro/ +in the current working directory. + +======================================== +COMMANDS +======================================== + +--- init --- +Usage: python minipomodoro.py init +Creates a .minipomodoro/ directory and an empty timer.dat file. +If .minipomodoro/ already exists, print "Already initialized" and exit. + +--- start --- +Usage: python minipomodoro.py start "Math Study" +Starts a new task. Checks if the last completed task was finished less than 5 minutes ago. +If so, rejects starting. +Appends a new task to timer.dat with status RUNNING. +Prints "Started task: . Focus!" + +--- pause --- +Usage: python minipomodoro.py pause +Pauses the currently RUNNING task. +A user can only pause a task a maximum of 3 times. +If pause count is 3, prints "Error: Pause limit reached! Keep focusing." +Otherwise, updates status to PAUSED, increments pause count, and prints "Task paused. pauses remaining." + +--- resume --- +Usage: python minipomodoro.py resume +Changes the currently PAUSED task status back to RUNNING. +Prints "Task resumed. Get back to work!" + +--- stop --- +Usage: python minipomodoro.py stop +Stops the active task and calculates total elapsed time. +If elapsed time is less than 25 minutes, prints "Warning: Stopped before 25 minutes." +Marks task as DONE. +Prints "Task stopped. Total time: mins." + +--- log --- +Usage: python minipomodoro.py log +Prints all tasks, one per line: + [1] [DONE] Math Study (25 mins) - 2 pauses + [2] [RUNNING] Read Book (12 mins) - 0 pauses +If no tasks exist, prints "No timer logs found." + +======================================== +DATA FORMAT +======================================== + +File: .minipomodoro/timer.dat +Format: One task per line, fields separated by | +Structure: id | description | status | elapsed_minutes | pause_count | last_update_timestamp +Example: +1|Math Study|DONE|25|2|1710345600 +2|Read Book|RUNNING|12|0|1710347800 + +======================================== +DISPLAY REQUIREMENTS +======================================== + +--- Time Formatting --- +All durations displayed to the user must follow the MM:SS (Minutes:Seconds) format. +If the total duration exceeds 60 minutes, the format must automatically switch to HH:MM:SS (Hours:Minutes:Seconds). +Internal integer values (seconds) must be converted to this human-readable format before being printed to the console. + +======================================== +ERROR HANDLING +======================================== + +- Running any command before "init": print "Not initialized. Run: python minipomodoro.py init" +- Starting a task while one is RUNNING: print "Error: A task is already running. Stop or pause it first." +- Pausing a task that is not RUNNING: print "Error: No active task to pause." +- Starting a task before 5-minute break: print "Error: You must rest for 5 minutes between tasks." +- Invalid command: print "Unknown command: " diff --git a/problems/minipomodoro/SPEC-v3.txt b/problems/minipomodoro/SPEC-v3.txt new file mode 100644 index 00000000..9e7b26c3 --- /dev/null +++ b/problems/minipomodoro/SPEC-v3.txt @@ -0,0 +1,103 @@ +PROJECT: minipomodoro +AUTHOR: Ömer Faruk Aksoy (251478060) +VERSION: v3 +DATE: 2026-04-18 + +======================================== +OVERVIEW +======================================== + +minipomodoro is a command-line Pomodoro and time-tracking application. +It forces users to focus by limiting the number of pauses allowed during a session, +and helps maintain consistency through a daily goal tracking system. +All data is persisted in a directory called .minipomodoro/ +in the current working directory. + +======================================== +COMMANDS +======================================== + +--- init --- +Usage: python minipomodoro.py init +Creates a .minipomodoro/ directory, an empty timer.dat file, and a default goal.dat file (default value: 0). +If .minipomodoro/ already exists, print "Already initialized" and exit. + +--- goal --- +Usage: python minipomodoro.py goal +Sets the daily target for completed tasks. +Example: python minipomodoro.py goal 4 +Saves the target integer to goal.dat. +Prints: "Daily goal set to tasks. You can do it!" + +--- start --- +Usage: python minipomodoro.py start "Math Study" +Starts a new task. Checks if the last completed task was finished less than 5 minutes ago. +If so, rejects starting. +Appends a new task to timer.dat with status RUNNING. +Prints "Started task: . Focus!" + +--- pause --- +Usage: python minipomodoro.py pause +Pauses the currently RUNNING task. +A user can only pause a task a maximum of 3 times. +If pause count is 3, prints "Error: Pause limit reached! Keep focusing." +Otherwise, updates status to PAUSED, increments pause count, and prints "Task paused. pauses remaining." + +--- resume --- +Usage: python minipomodoro.py resume +Changes the currently PAUSED task status back to RUNNING. +Prints "Task resumed. Get back to work!" + +--- stop --- +Usage: python minipomodoro.py stop +Stops the active task and calculates total elapsed time. +If elapsed time is less than 25 minutes, prints "Warning: Stopped before 25 minutes." +Marks task as DONE. +Prints "Task stopped. Total time: ." + +--- log --- +Usage: python minipomodoro.py log +First, checks goal.dat. If a goal > 0 is set, calculates the percentage of DONE tasks and prints a progress bar (10 characters wide, using '=' for progress and ' ' for empty). +Example: + Progress: [==== ] 2/5 tasks (40%) + +Then, prints all tasks, one per line: + [1] [DONE] Math Study (25:00) - 2 pauses + [2] [RUNNING] Read Book (12:05) - 0 pauses +If no tasks exist, prints "No timer logs found." + +======================================== +DATA FORMAT +======================================== + +File: .minipomodoro/timer.dat +Format: One task per line, fields separated by | +Structure: id | description | status | elapsed_seconds | pause_count | last_update_timestamp +Example: +1|Math Study|DONE|1500|2|1710345600 +2|Read Book|RUNNING|725|0|1710347800 + +File: .minipomodoro/goal.dat +Format: A single plain text integer representing the daily task goal. +Example: +4 + +======================================== +DISPLAY REQUIREMENTS +======================================== + +--- Time Formatting --- +All durations displayed to the user must follow the MM:SS (Minutes:Seconds) format. +If the total duration exceeds 60 minutes, the format must automatically switch to HH:MM:SS (Hours:Minutes:Seconds). +Internal integer values (seconds) must be converted to this human-readable format before being printed to the console. + +======================================== +ERROR HANDLING +======================================== + +- Running any command before "init": print "Not initialized. Run: python minipomodoro.py init" +- Starting a task while one is RUNNING: print "Error: A task is already running. Stop or pause it first." +- Pausing a task that is not RUNNING: print "Error: No active task to pause." +- Starting a task before 5-minute break: print "Error: You must rest for 5 minutes between tasks." +- Setting a goal with non-positive integer: print "Error: Goal must be a positive integer." +- Invalid command: print "Unknown command: " diff --git a/problems/minipomodoro/problem.json b/problems/minipomodoro/problem.json new file mode 100644 index 00000000..51a2a32a --- /dev/null +++ b/problems/minipomodoro/problem.json @@ -0,0 +1,13 @@ +{ + "name": "Mini-Pomodoro", + "binary_name": "minipomodoro.py", + "v1_spec": "SPEC-v1.txt", + "v1_test": "test-v1.sh", + "v1_prompt": "Implement {{binary_name}} as described in SPEC-v1.txt using {{language}}. The executable must be named '{{binary_name}}' and be runnable as ./{{binary_name}}. For compiled languages, include a Makefile or build script. For interpreted languages, ensure the {{binary_name}} file has a proper shebang line and is executable. Verify your implementation passes all tests by running: bash test-v1.sh", + "v2_spec": "SPEC-v2.txt", + "v2_test": "test-v2.sh", + "v2_prompt": "Read SPEC-v2.txt and extend the existing {{binary_name}} implementation with timer commands. Verify your implementation passes all tests by running: bash test-v2.sh", + "v3_spec": "SPEC-v3.txt", + "v3_test": "test-v3.sh", + "v3_prompt": "Read SPEC-v3.txt and extend the existing {{binary_name}} implementation with a daily goal tracking system and progress bar. Verify your implementation passes all tests by running: bash test-v3.sh" +} diff --git a/problems/minipomodoro/test-v1.sh b/problems/minipomodoro/test-v1.sh new file mode 100644 index 00000000..f0e9834c --- /dev/null +++ b/problems/minipomodoro/test-v1.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# test-v1.sh - Testing core functionality (init, start, log) + +echo "--- Running test-v1.sh ---" +rm -rf .minipomodoro + +python3 minipomodoro.py init +python3 minipomodoro.py start "Math Study" +python3 minipomodoro.py log + +echo "--- Test v1 completed successfully ---" diff --git a/problems/minipomodoro/test-v2.sh b/problems/minipomodoro/test-v2.sh new file mode 100644 index 00000000..024e1163 --- /dev/null +++ b/problems/minipomodoro/test-v2.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# test-v2.sh - Testing edge-cases and new features (pause, resume, stop) + +echo "--- Running test-v2.sh ---" +rm -rf .minipomodoro + +python3 minipomodoro.py init +python3 minipomodoro.py start "Math Study" +python3 minipomodoro.py pause +python3 minipomodoro.py resume +python3 minipomodoro.py stop +python3 minipomodoro.py pause +python3 minipomodoro.py log + +echo "--- Test v2 completed successfully ---" diff --git a/problems/minipomodoro/test-v3.sh b/problems/minipomodoro/test-v3.sh new file mode 100644 index 00000000..0f345cc4 --- /dev/null +++ b/problems/minipomodoro/test-v3.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# test-v3.sh - Testing Daily Goals and Progress Bar + +echo "--- Running test-v3.sh ---" +rm -rf .minipomodoro + +# Sistemi başlat ve günlük hedefi 3 olarak belirle +python3 minipomodoro.py init +python3 minipomodoro.py goal 3 + +# İlk görevi yap ve bitir +python3 minipomodoro.py start "Math Study" +python3 minipomodoro.py stop + +# İkinci görevi başlat, duraklat, devam et ve bitir +python3 minipomodoro.py start "Read Book" +python3 minipomodoro.py pause +python3 minipomodoro.py resume +python3 minipomodoro.py stop + +# İlerleme çubuğunu (Progress Bar) görmek için logları bas +python3 minipomodoro.py log + +echo "--- Test v3 completed successfully ---"