• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest May 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import graphics as gr
2.
3. window = gr.GraphWin("Russian game", 600, 600)
4. alf = 0.2
5.
6.
7. def fract_rectangle(A, B, C, D, deep):
8.     if deep < 1:
9.         return
10.     for M, N in (A, B), (B, C), (C, D), (D, A):
11.         gr.Line(gr.Point(*M), gr.Point(*N).draw(window))
12.     A1 = (A[0] * (1 - alf) + B[0] * alf, A[1] * (1 - alf) + B[1] * alf)
13.     B1 = (B[0] * (1 - alf) + C[0] * alf, B[1] * (1 - alf) + C[1] * alf)
14.     C1 = (C[0] * (1 - alf) + D[0] * alf, C[1] * (1 - alf) + D[1] * alf)
15.     D1 = (D[0] * (1 - alf) + A[0] * alf, D[1] * (1 - alf) + A[1] * alf)
16.     fract_rectangle(A1, B1, C1, D1, deep - 1)
17.
18.
19. fract_rectangle((100, 100), (500, 100), (500, 500), (100, 500),50)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top