strangerthings.py

Created by schraf

Created on July 07, 2022

9.07 KB

Des jeux pour la NUMWORKS sur ma chaine Youtube : Rubika, solitaire, Mission missile, démineur, carré magique, TRON, défis de blanche…


from turtle import *
from kandinsky import fill_rect

NB = 10

svg0 = ['M', 71, 40, 'C', 73, 42, 72, 48, 74, 49, 74, 44, 73, 38, 73, 33, 73, 28, 72, 23, 72, 18, 69, 22, 66, 20, 63, 20, 56, 20, 49, 20, 43, 20, 41, 18, 40, 19, 40, 23, 39, 31, 39, 40, 38, 49, 40, 49, 40, 42, 41, 39, 43, 34, 46, 30, 49, 30, 51, 33, 49, 38, 50, 42, 50, 61, 50, 79, 50, 98, 50, 104, 46, 104, 45, 108, 46, 110, 48, 108, 49, 109, 55, 109, 61, 109, 67, 109, 68, 103, 63, 105, 63, 100, 62, 95, 62, 88, 62, 82, 62, 65, 62, 48, 62, 30, 66, 30, 69, 34, 71, 40, 71, 40, 71, 40, 71, 40, 'Z']
svg1 = ['M', 162, 109, 'C', 160, 102, 157, 95, 159, 87, 159, 70, 159, 53, 159, 36, 165, 54, 173, 72, 179, 91, 182, 97, 176, 106, 178, 108, 181, 107, 186, 110, 188, 107, 184, 101, 185, 90, 185, 81, 185, 64, 185, 47, 185, 30, 188, 26, 189, 17, 184, 20, 182, 20, 179, 20, 177, 20, 178, 26, 182, 30, 180, 37, 180, 43, 180, 48, 180, 54, 177, 45, 173, 37, 171, 27, 175, 20, 170, 19, 167, 20, 162, 20, 156, 20, 151, 20, 152, 26, 155, 33, 154, 40, 154, 60, 154, 79, 153, 99, 151, 109, 149, 93, 149, 88, 146, 68, 143, 48, 140, 27, 144, 20, 138, 20, 135, 20, 131, 20, 128, 20, 124, 20, 127, 30, 123, 40, 122, 50, 119, 66, 116, 82, 113, 98, 110, 92, 111, 82, 108, 76, 107, 69, 103, 62, 103, 57, 108, 52, 113, 39, 110, 28, 107, 18, 100, 20, 95, 20, 88, 20, 81, 20, 74, 20, 75, 26, 78, 32, 77, 39, 77, 59, 77, 80, 77, 100, 74, 103, 72, 111, 77, 108, 82, 108, 87, 108, 92, 108, 90, 102, 87, 96, 89, 87, 89, 82, 87, 70, 91, 68, 95, 77, 96, 88, 99, 98, 99, 103, 95, 110, 100, 109, 107, 109, 115, 109, 122, 109, 121, 103, 118, 97, 121, 90, 121, 82, 123, 69, 128, 77, 133, 81, 138, 90, 136, 100, 135, 104, 132, 111, 137, 109, 145, 109, 153, 109, 162, 109, 162, 109, 162, 109, 162, 109, 'Z', 'M', 95, 52, 'C', 93, 57, 87, 62, 89, 51, 89, 44, 87, 30, 93, 30, 99, 29, 99, 43, 96, 50, 96, 50, 96, 50, 96, 50, 96, 50, 95, 52, 95, 52, 'Z', 'M', 132, 66, 'C', 128, 63, 124, 61, 127, 52, 128, 49, 129, 34, 130, 40, 131, 49, 132, 59, 134, 68, 133, 67, 132, 67, 132, 66, 132, 66, 132, 66, 132, 66, 'Z']
svg2 = ['M', 259, 109, 'C', 261, 110, 263, 110, 263, 106, 264, 96, 266, 86, 267, 77, 265, 74, 265, 83, 264, 85, 261, 94, 256, 101, 250, 100, 247, 100, 245, 96, 245, 91, 245, 84, 245, 77, 245, 70, 245, 66, 245, 62, 245, 58, 248, 58, 251, 57, 254, 61, 256, 64, 256, 70, 257, 72, 259, 70, 257, 65, 258, 62, 257, 54, 256, 46, 256, 38, 253, 40, 255, 48, 252, 48, 249, 49, 247, 48, 245, 49, 245, 46, 245, 42, 245, 39, 245, 35, 246, 30, 248, 29, 251, 28, 254, 29, 257, 33, 260, 36, 262, 43, 263, 49, 264, 51, 265, 45, 264, 44, 263, 35, 262, 27, 261, 18, 257, 21, 252, 20, 247, 20, 241, 20, 235, 20, 230, 20, 229, 25, 234, 24, 232, 30, 233, 42, 233, 54, 233, 66, 233, 77, 233, 89, 232, 100, 232, 104, 228, 106, 230, 109, 232, 109, 235, 109, 237, 109, 245, 109, 252, 109, 259, 109, 259, 109, 259, 109, 259, 109, 'Z']
svg3 = ['M', 226, 69, 'C', 225, 65, 227, 61, 228, 59, 230, 57, 229, 55, 227, 55, 222, 56, 216, 55, 211, 55, 211, 60, 215, 62, 214, 68, 214, 77, 215, 86, 214, 95, 212, 101, 208, 101, 205, 98, 200, 92, 198, 80, 197, 69, 197, 57, 198, 43, 202, 34, 205, 28, 210, 28, 214, 31, 218, 34, 220, 42, 222, 49, 223, 47, 223, 41, 222, 37, 222, 31, 222, 24, 221, 18, 220, 23, 216, 22, 214, 20, 207, 17, 198, 17, 192, 26, 190, 30, 187, 35, 187, 41, 187, 55, 187, 69, 187, 84, 189, 97, 196, 108, 204, 108, 212, 110, 220, 109, 228, 109, 230, 110, 227, 104, 227, 103, 225, 99, 226, 93, 226, 89, 226, 82, 226, 76, 226, 69, 'Z']
svg4 = ['M', 2, 129, 'C', 12, 131, 21, 136, 30, 130, 37, 126, 42, 115, 43, 102, 45, 89, 43, 73, 36, 66, 30, 59, 21, 58, 15, 49, 13, 43, 14, 35, 17, 31, 20, 28, 23, 26, 26, 29, 30, 30, 32, 38, 35, 42, 38, 45, 37, 35, 37, 32, 38, 28, 39, 20, 38, 19, 34, 23, 30, 18, 26, 16, 24, 15, 21, 15, 18, 15, 11, 16, 4, 23, 1, 36, -2, 51, 1, 72, 9, 80, 14, 85, 20, 85, 26, 92, 30, 96, 30, 109, 26, 115, 22, 123, 15, 121, 11, 116, 8, 113, 6, 109, 5, 104, 5, 100, 2, 91, 1, 99, 1, 104, 1, 109, 0, 114, 0, 120, 0, 126, 0, 132, 1, 131, 2, 129, 2, 129, 'Z']
svg5 = ['M', 306, 81, 'C', 296, 63, 315, 55, 312, 36, 310, 11, 294, 21, 285, 19, 279, 22, 268, 14, 266, 23, 272, 38, 268, 59, 269, 77, 268, 95, 271, 116, 266, 130, 272, 133, 281, 135, 288, 130, 282, 117, 283, 95, 286, 82, 292, 90, 297, 111, 297, 126, 292, 138, 306, 131, 310, 132, 313, 132, 316, 132, 320, 132, 313, 118, 312, 96, 306, 81, 'Z', 'M', 293, 59, 'C', 289, 70, 281, 68, 284, 54, 280, 39, 291, 20, 296, 39, 297, 46, 295, 54, 293, 59, 'Z']
svg6 = ['M', 84, 125, 'C', 81, 129, 76, 126, 73, 127, 67, 127, 61, 127, 55, 127, 52, 123, 52, 131, 52, 135, 52, 139, 51, 142, 51, 146, 50, 149, 49, 155, 51, 155, 53, 149, 54, 142, 57, 139, 59, 135, 62, 137, 62, 141, 63, 145, 62, 148, 62, 152, 62, 170, 62, 188, 62, 207, 61, 210, 59, 211, 58, 215, 59, 217, 62, 215, 63, 216, 68, 216, 74, 216, 79, 216, 79, 211, 75, 211, 74, 206, 74, 200, 74, 194, 74, 189, 74, 172, 74, 155, 74, 138, 77, 136, 79, 139, 81, 142, 83, 146, 84, 149, 85, 154, 87, 156, 86, 148, 86, 146, 85, 139, 84, 132, 84, 125, 'Z']
svg7 = ['M', 110, 134, 'C', 114, 135, 113, 146, 113, 152, 112, 156, 109, 153, 107, 154, 105, 154, 103, 154, 101, 154, 101, 146, 101, 137, 105, 132, 103, 129, 100, 131, 98, 131, 94, 131, 90, 131, 86, 131, 87, 136, 91, 139, 89, 146, 89, 166, 89, 186, 89, 206, 88, 212, 84, 219, 90, 217, 95, 217, 100, 217, 105, 217, 104, 211, 100, 209, 101, 201, 101, 189, 101, 176, 101, 163, 105, 163, 109, 163, 113, 163, 113, 178, 113, 193, 113, 209, 111, 212, 108, 218, 112, 217, 118, 217, 123, 217, 128, 217, 128, 212, 124, 209, 125, 202, 125, 182, 125, 161, 125, 140, 127, 136, 131, 129, 126, 131, 120, 131, 115, 131, 110, 131, 110, 131, 110, 132, 110, 132, 110, 132, 110, 134, 110, 134, 110, 134, 110, 134, 110, 134, 'Z']
svg8 = ['M', 131, 134, 'C', 133, 134, 134, 138, 134, 142, 134, 152, 134, 162, 134, 172, 134, 184, 134, 196, 134, 207, 134, 211, 132, 213, 131, 214, 130, 216, 131, 217, 132, 217, 138, 217, 144, 217, 150, 217, 150, 215, 150, 213, 148, 213, 146, 210, 147, 205, 146, 201, 146, 183, 146, 164, 146, 145, 146, 142, 146, 137, 148, 135, 150, 135, 150, 132, 150, 131, 143, 131, 137, 131, 131, 131, 131, 132, 131, 133, 131, 134, 131, 134, 131, 134, 131, 134, 'Z']
svg9 = ['M', 187, 211, 'C', 186, 201, 187, 190, 186, 180, 186, 167, 186, 153, 187, 140, 187, 137, 192, 130, 187, 131, 184, 132, 179, 129, 178, 133, 183, 138, 181, 148, 181, 157, 181, 160, 182, 167, 180, 161, 178, 152, 170, 143, 174, 133, 173, 129, 170, 132, 169, 131, 163, 131, 157, 131, 152, 131, 153, 136, 156, 140, 155, 147, 155, 167, 155, 187, 154, 208, 154, 212, 149, 218, 154, 217, 157, 217, 160, 217, 163, 217, 162, 212, 159, 208, 160, 201, 160, 183, 160, 165, 160, 147, 166, 164, 173, 181, 180, 198, 182, 205, 180, 212, 178, 216, 179, 219, 182, 217, 184, 217, 186, 217, 188, 217, 190, 217, 191, 213, 187, 214, 187, 211, 187, 211, 187, 211, 187, 211, 'Z']
svg10 = ['M', 259, 166, 'C', 255, 161, 248, 161, 245, 153, 243, 141, 251, 135, 255, 141, 259, 144, 260, 153, 262, 156, 263, 150, 262, 142, 262, 135, 262, 130, 262, 127, 259, 131, 255, 132, 251, 126, 247, 128, 239, 129, 231, 143, 232, 160, 233, 169, 237, 177, 241, 180, 246, 184, 253, 184, 254, 195, 254, 205, 248, 211, 243, 208, 237, 205, 233, 195, 232, 184, 229, 180, 231, 193, 231, 196, 231, 203, 232, 210, 232, 217, 236, 214, 240, 219, 244, 219, 253, 221, 263, 214, 266, 199, 268, 187, 266, 170, 259, 166, 'Z']
svg11 = ['M', 228, 210, 'C', 227, 203, 228, 195, 227, 187, 227, 182, 227, 177, 228, 172, 228, 169, 232, 167, 230, 164, 226, 164, 222, 164, 217, 164, 216, 164, 214, 164, 212, 164, 212, 169, 217, 168, 216, 174, 216, 183, 216, 193, 216, 203, 215, 209, 210, 210, 208, 207, 203, 202, 201, 192, 200, 182, 198, 169, 199, 155, 203, 144, 206, 137, 211, 136, 214, 139, 219, 141, 222, 149, 224, 158, 226, 155, 224, 150, 224, 147, 224, 140, 224, 133, 223, 126, 222, 131, 218, 130, 216, 129, 209, 125, 201, 126, 194, 134, 192, 138, 190, 142, 189, 148, 188, 153, 189, 157, 189, 162, 189, 172, 189, 182, 189, 192, 191, 205, 198, 216, 205, 217, 213, 218, 221, 217, 228, 218, 229, 217, 231, 218, 230, 216, 230, 213, 228, 213, 228, 210, 228, 210, 228, 210, 228, 210, 'Z']
svg12 = ['M', 0, 145, 'C', 15, 145, 31, 145, 46, 145, 46, 148, 46, 150, 46, 153, 31, 153, 15, 153, 0, 153, 0, 150, 0, 148, 0, 145, 'Z']
svg13 = ['M', 265, 145, 'C', 283, 145, 301, 145, 320, 145, 320, 148, 320, 150, 320, 153, 301, 153, 283, 153, 265, 153, 265, 150, 265, 148, 265, 145, 'Z']
svg14 = ['M', 0, 0, 'C', 104, 0, 208, 0, 313, 0, 314, 13, 303, 5, 298, 7, 199, 7, 99, 7, 0, 7, 0, 4, 0, 2, 0, 0, 'Z']

def move(x,y): 
  goto(x-160,110-y)

def coord(a,b,c,d,t):
  return a*(1-t)**3+3*b*t*(1-t)**2+3*c*t*t*(1-t)+d*t**3

def bezier(l):
  pendown()
  t = 0
  for i in range(NB+1):
    x = coord(l[0],l[2],l[4],l[6],t)
    y = coord(l[1],l[3],l[5],l[7],t)
    move(x,y)
    t += 1/NB

speed(7)
pensize(3)
fill_rect(0,0,320,222,(0,0,0))
a = 0
color(255, 0, 0)
while a < 15:
    svg = eval('svg'+str(a))
    a += 1
    i = 0
    while i<len(svg):
        if svg[i] == "M":
            l = [svg[i+1],svg[i+2]]
            penup()
            move(l[0], l[1])
            i += 3
        elif svg[i] == "Z" or svg[i] == "C": i += 1
        else:  
            for j in range(6): l.append(svg[i+j])
            bezier(l)
            l = [svg[i+4],svg[i+5]]
            i += 6
hideturtle()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.