Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Koffi Gantchou
AP
Commits
fc1f0269
Commit
fc1f0269
authored
5 months ago
by
Koffi Gantchou
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
5d1b0717
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
fractals.py
+153
-0
153 additions, 0 deletions
fractals.py
with
153 additions
and
0 deletions
fractals.py
0 → 100644
+
153
−
0
View file @
fc1f0269
from
turtle
import
*
def
zig_zag
():
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
left
(
45
)
for
_
in
range
(
5
):
forward
(
50
)
right
(
90
)
forward
(
50
)
left
(
90
)
# à l'ordre n+1 la longueur de segment de chaque portion a l'ordre n est de nouveau
#divisé par trois en reproduisant 4 fois le meme shema
def
von_koch
(
l
:
float
,
n
:
int
):
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
if
n
==
0
:
return
forward
(
l
)
elif
n
==
1
:
forward
(
l
/
3
)
left
(
60
)
forward
(
l
/
3
)
right
(
120
)
forward
(
l
/
3
)
left
(
60
)
forward
(
l
/
3
)
else
:
von_koch
(
l
/
3
,
n
-
1
)
left
(
60
)
von_koch
(
l
/
3
,
n
-
1
)
right
(
120
)
von_koch
(
l
/
3
,
n
-
1
)
left
(
60
)
von_koch
(
l
/
3
,
n
-
1
)
def
von_koch_amelioree
(
l
:
float
,
n
:
int
):
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
speed
(
70
)
von_koch
(
l
,
n
)
right
(
120
)
von_koch
(
l
,
n
)
right
(
120
)
von_koch
(
l
,
n
)
right
(
120
)
def
cesaro
(
l
:
float
,
n
:
int
):
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
speed
(
70
)
if
n
==
0
:
return
forward
(
l
)
elif
n
==
1
:
forward
(
2
*
l
/
5
)
left
(
85
)
forward
(
2
*
l
/
5
)
right
(
170
)
forward
(
2
*
l
/
5
)
left
(
85
)
forward
(
2
*
l
/
5
)
else
:
cesaro
(
2
*
l
/
5
,
n
-
1
)
left
(
85
)
cesaro
(
2
*
l
/
5
,
n
-
1
)
right
(
170
)
cesaro
(
2
*
l
/
5
,
n
-
1
)
left
(
85
)
cesaro
(
2
*
l
/
5
,
n
-
1
)
def
carre_cesaro
(
l
:
float
,
n
:
int
):
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
speed
(
80
)
left
(
90
)
cesaro
(
l
,
4
)
left
(
90
)
cesaro
(
l
,
4
)
left
(
90
)
cesaro
(
l
,
4
)
left
(
90
)
cesaro
(
l
,
4
)
def
sierpinski
(
l
:
float
,
n
:
int
):
"""
à_remplacer_par_ce_que_fait_la_fonction
Précondition :
Exemple(s) :
$$$
"""
if
n
==
0
:
forward
(
l
)
left
(
120
)
forward
(
l
)
left
(
120
)
forward
(
l
)
left
(
120
)
else
:
speed
(
50
)
sierpinski
(
l
/
2
,
n
-
1
)
penup
()
forward
((
l
/
(
2
**
n
))
*
(
2
**
(
n
-
1
)
-
1
))
left
(
120
)
forward
(
l
/
2
)
pendown
()
sierpinski
(
l
/
2
,
n
-
1
)
penup
()
forward
((
l
/
(
2
**
n
))
*
(
2
**
(
n
-
1
)
-
1
))
right
(
120
)
forward
(
l
/
2
)
pendown
()
right
(
120
)
sierpinski
(
l
/
2
,
n
-
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment