The "Save The Planet" game is a fun and interactive coding challenge where users are tasked with completing a coding problem within a specified deadline. The goal is to reverse a string and return the correct output before time runs out. This project is implemented in Go and includes a set of tests to ensure functionality.
- Task Creation: Create a new task with a name and a deadline.
- Task Completion: Attempt to complete the task by providing the correct output.
- Deadline Enforcement: The task must be completed within the specified time limit.
- Error Handling: Provides feedback for incorrect answers or timeouts.
- Go (version 1.16 or higher) installed on your machine.
- A terminal or command prompt.
-
Clone the repository:
git clone https://github.com/yourusername/savetheplanet.git cd savetheplanet
-
Install dependencies (if any):
go mod tidy
To run the game, execute the following command in your terminal:
go run cmd/main.go
During the game, you will be prompted to complete a coding challenge. The challenge will ask you to reverse a specific string. You will need to type the exact reversed string as your answer. For example:
- Challenge: Write a function in Go to reverse the string
'save_the_planet'
and return it. - Example Input:
save_the_planet
- Expected Output:
tenalp_eht_evas
Make sure to provide your answer within the specified time limit to successfully complete the task.
To ensure everything is working correctly, you can run the tests included in the project. Use the following command:
go test ./internal/planet
This will execute all the test cases defined in planet_code_test.go
and report any failures.
cmd/main.go
: Entry point for the application.internal/planet/planet_code.go
: Contains the main logic for the game, including theSaveThePlanet
struct and methods.internal/planet/planet_code_test.go
: Contains unit tests for the game logic.
Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by coding challenges and interactive learning experiences.