Re: Module turtle pour NumWorks
Posté: 28 Oct 2018, 11:24
En tout cas, bien joué pour ce module
En espérant que ça soit merge d’une facon ou d’une autre... ?
En espérant que ça soit merge d’une facon ou d’une autre... ?
News, programmes, tutoriaux, forum sur les calculatrices TI !
https://tiplanet.org/forum/
from turtle import *
def spiral(N_iteration):
N_iteration *= 25
for i in range(N_iteration):
# Change pen color
gray=255-(i*255/N_iteration)
pencolor(int(gray),int(gray*0.75),int(gray*0.25))
# Draw a segment of the spiral
forward(i*0.1)
left(10)
from turtle import *
def koch(N_iteration):
# Save pencil size and set it to 1
prevSize = pensize()
pensize(1)
# Define inner function for recursion
def _koch(n, l):
if n == 1:
forward(l)
else:
_koch(n-1,l/3)
left(60)
_koch(n-1,l/3)
right(120)
_koch(n-1,l/3)
left(60)
_koch(n-1,l/3)
# Call inner function
_koch(N_iteration,140)
# Restore pencil size
pensize(prevSize)
Adriweb a écrit:Joli - tu devrais mettre ces images la aussi sur la PR
Wow, definitely something we need to merge! Thank you very much for this awesome contribution @boricj ! We'll try to review this as soon as possible