Repository navigation
Description
Student: Raj Manoj Patil
Task: R23-T036 · 6 of 10
Repository: https://github.com/S-AI-Projects/TheAlgorithms-Python
Assigned working branch: student/e26b07f0759
Goal
Write an explanation good enough for a classmate to re-implement the algorithm, and improve the file's own documentation. Experiment: triangulate 3 polygons (convex, concave, star-shaped) and draw the triangles with matplotlib.
Steps
- Write work/R23-T036/EXPLAINER.md: the idea, a worked example by hand, and a diagram.
- Add or improve the module docstring with a reference link (CONTRIBUTING.md asks for one) and a one-paragraph summary.
- Carry out the experiment described in the goal and include the result.
- Ask a classmate to re-derive one doctest result from your explainer and record their feedback.
- Make the code change in the repository: maths/ear_clipping_polygon_triangulation.py: module docstring with reference and a worked doctest on a small concave polygon. Re-run the automated check and the repo's own tests afterwards.
- Prepare the PR: on branch R23-T036, commit the code change plus your work/R23-T036/ evidence, put your findings in the PR description and open the PR against the org fork. For a later upstream PR, create a second branch containing only the code change (no work/ folder).
Done when
☐ EXPLAINER.md triangulates a convex, a concave and a star-shaped polygon with matplotlib figures.
☐ maths/ear_clipping_polygon_triangulation.py module docstring gains a reference link and a worked doctest on a small concave polygon (e.g. 5 vertices) checking n − 2 triangles.
☐ Existing 21 doctests pass.
Additional task guidance
Additional curated task guidance
Item:
maths/ear_clipping_polygon_triangulation.py (255 lines; 21 doctests)
Task type:
Explain the algorithm
Code change (goes into the PR):
maths/ear_clipping_polygon_triangulation.py: module docstring with reference and a worked doctest on a small concave polygon.
Automated check:
uv run pytest maths/ear_clipping_polygon_triangulation.py
Prerequisites:
Linux/WSL2/Codespaces with uv (https://docs.astral.sh/uv/getting-started/installation/); run uv sync --group=test once – it installs the Python version CI uses (.python-version = 3.15t) and the test dependencies, about 1–2 GB
Upstream PR rules:
Follow CONTRIBUTING.md: type hints on every parameter/return, doctests for valid and erroneous input, snake_case file names, no duplicate of an existing implementation, no hand edits to DIRECTORY.md. CI (pytest with doctests, ruff) must pass – bots close PRs without tests or type hints. Keep work/ (benchmarks, notes, property tests) out of the upstream branch; put results in the PR description.
Source (pinned):
https://github.com/TheAlgorithms/Python/blob/574d100b7181956e9c8384552fd078165e4cc326/maths/ear_clipping_polygon_triangulation.py
Change:
No change recorded
PR destination:
Preserved pilot guidance
Submission checklist
- Complete this task and its checks.
- Add the required evidence and link your pull request here.
- Select this S-AI-Projects fork as the PR base repository.
- Request instructor review.
Keep this PR focused on this task. Do not submit assignment PRs to the upstream repository.
Activity