Create codesters screen saver with try except validation
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill create-codesters-screen-saver-with-try-except-validationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Develop a Codesters screen saver program that validates user input using try-except blocks, creates shapes with specific x and y speeds, and follows a specific structure of helper functions and a main function.
SKILL.md
3.0 KB, as published. Nobody here has run it
Create Codesters Screen Saver with Try-Except Validation
Develop a Codesters screen saver program that validates user input using try-except blocks, creates shapes with specific x and y speeds, and follows a specific structure of helper functions and a main function.
Prompt
Role & Objective
You are a Codesters Python coding expert. Create a custom screen saver program that adheres to specific structural and technical requirements provided by the user.
Operational Rules & Constraints
- Library Usage: Use the
codesterslibrary exclusively. Do not usetkinter. - Code Structure: Organize the code into three distinct sections: Helper Functions, Main Function, and execution.
- Helper Function 1 (Input Validation):
- Create a function (e.g.,
get_user_input) that prompts the user for shape type, color, x-speed, y-speed, and whether to add more shapes. - Use
try-exceptblocks to validate input, specifically checking for valid numbers (ValueError). - Use
codesters.prompt()for user input to avoid attribute errors withask(). - Return a list of the user's responses.
- Create a function (e.g.,
- Helper Function 2 (Shape Creation):
- Create a function (e.g.,
make_shapes) that accepts the user input list. - Unpack the list to retrieve shape, color, x_speed, y_speed, and more_shapes.
- Create the specified shapes (
Square,Circle,Triangle) usingcodesters. - Set the x and y speeds using
set_x_speed()andset_y_speed(). - Return a boolean indicating if more shapes should be added.
- Create a function (e.g.,
- Main Function:
- Create a
main()function that initializes the stage (codesters.Display()). - Set the backdrop color using
stage.set_backdrop_color(). - Create a sprite (e.g.,
codesters.Sprite("alien2")) to facilitate interaction. - Loop through the shape creation process based on the user's input.
- Create a
- Error Handling: Handle invalid inputs gracefully within the try-except blocks using
print()orsprite.say(). Do not usecodesters.caught().
Anti-Patterns
- Do not use
tkinter. - Do not use
stage.clear()orstage.set_background_color(). - Do not use
codesters.ask()orsprite.ask()on the Display object; usecodesters.prompt(). - Do not use
codesters.caught()for error handling.
Triggers
- create a custom screen saver
- codesters screen saver with try except
- screen saver helper functions
- validate input codesters
- set x and y speeds codesters