Découvrez ma chaine YouTube (Python, JavaScript, calculatrices…)
from kandinsky import * from math import * def choix(k): if k == 0: return [261,286,267,282,271,247,299,239,292,253,264,297,248,284,240,293,250,294,234,294,239,287,264,240,299,233,298,259,288,261,242,274,242,288,237,298,232,300,229,297,258,143,260,293,237,286,242,122,242,298,239,278,243,290,254,290,233,300,224,302,225,298,234,298,227,299,228,135,116,237,281,269,153,268,248,296,232,306,232,295,243,299,234,267,154,268,155,269,285,252,266,154,14,153,273,245,299,230,303,224,305,231,125,241,121,108,87,101,84,97,80,99,78,103,76,105,226,300,225,300,226,301,225,120,245,273,295,264,288,232,118,234,286,266,151,271,152,17,160,16,163,16,155,264,237,123,245,259,245,119,245,291,240,125,109,85,114,236,297,240,276,240,123,226,307,231,124,245,287,257,298,238,284,267,157,14,155,12,151,17,163,26,166,27,171,29,65,52,69,50,63,50,60,305,220,17,221,301,235,296,253,126,315,43,316,45,62,293,241,298,235,291,260,148,261,296,248,125,231,303,222,304,223,304,113,305,224,20,158,90,150,264,145,211,348,211,349,211,4,194,332,190,342,205,343,205,342,207,359,186,97,84,116,244,299,255,283,179,95,166,25,166,22,161,17,218,96,188,328,141,320,143,320,142,323,146,91,166,24,159,275,287,242,125,243,292,229,299,226,99,124,239,298,233,290,40,65,40,67,55,299,219,19,153,17,220,304,114,124,231,301,226,298,237,114,305,58,288,251,285,247,118,245,122,313,127,106,233,111,307,121,245,112,307,119,243,125,237,125,232,124,315,133,226,302,223,98,219,328,149,17,158,23,159,23,169,280,234,292,245,114,244,123,231,299,286,237,294,226,303,228,134,226,28,171,280,263,291,228,299,231,294,244,116,248,290,259,292,237,101,244,262,25,169,97,169,28,173,92,179,284,263,140,320,139,319,138,319,139,90,124,240,297,250,260,146,321,131,320,136,89,127,104,129,318,45,316,42,316,137,310,51,76,52,279,257,274,161,19,218,331,195,335,195,347,194,333,225,307,222,17,223,303,226,98,231,290,248,271,150,17,259,122,109,236,288,243,119,308,222,18,158,275,232,303,220,14,221,305,113,304,110,245,283,273,237,38,62,288,187,356,206,357,189,330,188,340,202,338,216] if k == 1: return [350,215,353,181,92,78,48,71,86,127,277,239,124,259,123,249,239,121,239,296,240,291,243,114,90,143,9,147,8,145,208,331,221,21,164,90,165,29,170,98,232,297,232,35,233,351,200,341,200,338,203,339,198,339,205,357,187,3,192,333,190,291,244,284,255,293,240,122,234,98,229,301,112,95,175,32,175,33,183,356,189,3,197,348,194,313,243,122,231,300,235,300,58,283,249,283,176,95,153,22,163,17,164,88,129,322,206,323,207,328,147,11,152,88,102,252,276,125,315,45,319,127,107,97,236,295,237,299,222,302,224,331,208,347,197,336,199,341,222,309,65,294,241,124,238,290,61,306,61,291,241,120,243,282,121,312,133,229,125,239,106,237,111,124,93,189,0,151,1,186,340,203,355,147,9,145,320,206,321,143,358,190,345,192,5,194,308,63,78,288,189,357,183,24,169,25,156,24,158,24,166,84,129,320,208,328,216,41,68,83,73,289,244,100,171,89,166,16,218,330,189,345,170,100,238,292,58,287,34,232,301,231,37,231,296,227,125,90,138,316,245,286,263,276,265,26,164,26,183,287,237,296,234,124,280,247,270,37,213,318,42,71,316,243,291,237,124,275,123,252,291,113,239,109,284,180,28,181,336,197,320,209,329,210,328,221,303,231,302,226,101,78,46,261,275,165,26,157,27,167,97,177,89,145,321,215,350,214,317,243,233,301,115,271,37,230,301,228,300,234,297,235,36,67,311,123,238,110,305,217,304,221,32,235,294,242,110,307,224,326,138,314,204,345,195,2,196,3,210,146,211,332,192,34,185,32,230,299,237,98,222,307,110,75,52,82,49,80,290,79,46,85,129,325,129,324,208,330,206,359,143,8,144,320,218,333,192,2,187,340,207,356,149,91,181,339,200,336,194,319,74,321,199,336,214,319,242,295,255,277,247,290,260,117,234,39,217,306,221,300,61,290,257,280,251,278,104,73,320,132,312,50,243,296,239,285,248,116,305,214,30,181,27,166,87,127,318,241,123,92,166,13,158,16,246,256,118,131,321,147,6,163,29,173,93,51,41,217,326,211,324,200,337,230,240,294,232,296,64,48,61,301,222,301,116,271,115,261,86,162,4,190,1,208,312,64,312,120,237,117] if k == 2: return [244,283,107,245,292,62,32,232,37,228,298,57,244,109,74,55,104,265,287,72,289,76,291,245,98,230,98,244,108,178,86,266,26,182,24,160,91,129,83,46,184,32,219,304,222,326,216,11,146,356,196,356,182,111,304,58,193,335,192,3,196,5,152,93,112,303,112,249,268,86,32,172,91,41,214,318,47,182,359,145,329,187,357,149,259,85,170,280,106,281,244,124,252,286,296,238,122,95,109,95,168,27,266,113,303,229,339,222,49,311,48,239,118,239,32,82,243,294,231,111,249,100,244,289,242,263,22,172,342,191,357,194,59,307,217,332,210,318,74,286,246,96,153,88,261,20,168,81,52,268,99,240,310,67,53,240,296,231,31,184,24,82,166,20,152,10,142,325,219,318,77,52,278,67,296,67,39,216,351,201,341,223,326,208,329,221,309,48,234,99,216,309,51,88,256,123,310,203,343,172,10,145,333,217,302,221,314,135,77,152,101,186,357,199,351,198,334,155,88,166,109,251,110,124,235,124,233,294,236,125,242,293,243,118,280,290,243,38,94,49,182,33,232,121,305,219,333,144,6,167,85,45,318,253,282,123,265,276,118,271,117,302,229,35,232,302,232,326,147,7,169,23,89,34,182,336,215,319,75,291,251,77,321,178,352,234,96,239,295,229,110,306,112,308,87,256,116,303,218,336,200,311,67,284,251,74,58,282,103,223,321,138,310,200,351,181,84,307,161,94,27,160,21,173,189,59,42,291,247,112,239,290,261,280,255,123,292,234,295,233,125,106,36,211,325,207,300,237,251,291,248,325,141,358,184,355,221,325,224,307,58,289,255,122,238,72,42,317,71,52,240,79,321,73,291,109,238,109,289,301,58,286,247,5,190,357,151,79,128,91,223,329,188,50,310,199,6,162,306,319,233,74,316,73,153,85,309,220,44,316,44,293,234,97,36,236,296,229,303,117,241,295,240,78,50,107,284,294,65,315,42,60,271,63,308,61,230,307,113,124,224,299,225,299,223,301,207,77,291,111,244,85,32,102,277,255,81,169,22,250,98,226,358,180,320,223,318,68,299,58,281,90,119,135,78,255,100,128,100,269,259,18,221,105,282,255,112,302,79,288,74,315,223,101,242,270,121,234,244,230] if k == 3: return [31,183,49,279,266,288,244,292,77,169,95,235,69,234,49,263,87,306,214,28,215,329,220,302,235,125,249,122,132,321,213,324,203,342,184,46,185,46,238,313,121,277,261,97,229,296,209,147,356,136,319,221,35,190,173,85,266,90,50,295,60,294,83,129,80,46,82,261,89,25,168,296,225,326,128,87,25,158,14,247,121,238,316,220,93,313,168,79,161,93,36,244,291,236,111,266,107,244,56,242,57,187,343,207,344,170,6,195,355,193,311,50,266,122,251,284,246,99,38,215,13,221,329,184,37,100,232,36,109,290,56,105,303,217,16,146,333,222,312,66,52,129,81,323,79,29,162,311,120,130,323,220,47,234,5,162,25,160,29,183,359,147,81,165,19,144,321,127,109,124,229,37,106,244,130,79,169,6,235,110,224,313,249,288,241,122,292,235,315,40,215,335,198,341,226,305,176,17,247,286,261,82,129,323,82,165,25,77,48,185,358,189,175,80,242,109,35,238,296,230,309,229,32,231,304,218,332,221,315,68,284,259,105,39,64,291,253,117,271,34,109,180,353,178,22,253,102,36,239,293,62,42,217,336,198,111,308,165,22,167,74,291,112,296,162,26,155,73,299,56,244,37,179,323,223,312,95,313,211,346,213,351,190,331,189,173,15,218,45,195,56,125,55,73,321,212,2,213,321,78,321,223,299,248,278,100,245,293,236,285,253,99,220,301,205,326,210,332,126,238,123,233,119,244,107,275,90,214,38,97,150,331,206,26,184,57,296,65,202,343,190,359,183,338,196,108,30,182,48,79,252,283,299,112,243,293,225,296,236,300,236,122,247,284,257,272,259,283,114,32,284,67,283,253,119,252,108,305,235,122,243,79,291,76,286,243,121,133,227,239,294,229,34,238,126,243,82,264,86,247,291,68,316,218,42,61,308,214,302,60,199,318,223,313,220,326,124,227,134,313,135,228,296,284,244,94,51,63,319,223,35,229,312,70,288,70,234,95,265,114,255,82,30,178,314,132,57,193,308,85,168,91,258,116,93,235,102,150,20,144,76,50,93,114,302,234,30,266,91,283,95,260,280,265,112,276,121,319,217,333,193,350,187,328,217,352,217,338,132,319,71,205,323,142,11,172,187,345,226,93] if k == 4: return [168,39,214,321,81,264,159,14,168,75,55,187,349,198,350,213,348,213,298,219,341,164,19,168,84,322,130,324,122,312,71,321,79,32,92,124,330,190,350,199,357,196,349,180,339,202,67,143,75,300,62,192,35,112,244,57,137,5,213,335,135,122,280,246,286,301,238,94,183,325,231,295,244,102,129,240,121,241,252,232,312,223,316,79,148,299,210,316,133,314,230,296,223,308,225,305,233,246,81,240,81,166,77,327,78,259,110,30,162,31,217,317,223,45,192,357,184,44,86,163,19,150,83,177,107,282,58,244,79,256,275,252,320,308,86,165,24,91,127,332,215,318,217,298,70,281,252,121,236,350,177,283,105,281,91,281,121,237,289,81,246,34,86,260,88,127,61,264,84,243,120,108,281,122,255,120,267,121,246,293,246,125,331,218,305,61,293,67,40,238,294,102,236,4,189,58,305,85,251,125,113,306,55,75,286,235,113,292,233,302,78,40,102,255,46,254,122,229,3,161,89,77,293,113,249,103,224,314,221,331,210,333,218,353,140,6,213,28,98,243,41,317,305,317,141,17,148,91,311,242,224,32,105,267,101,50,201,60,296,242,112,259,294,69,293,69,321,252,22,104,279,261,153,18,259,79,290,62,273,263,107,243,37,84,242,117,281,65,314,43,192,335,201,343,193,43,222,308,88,265,50,183,51,180,88,269,61,296,125,97,269,63,48,151,11,150,270,34,111,101,255,312,112,309,46,65,276,71,233,313,225,99,238,293,228,307,126,241,291,71,153,77,173,32,114,241,227,296,63,296,224,29,206,86,256,279,293,159,89,260,90,145,8,236,116,298,58,68,283,247,283,120,254,116,257,112,273,104,221,45,233,127,108,240,286,58,280,105,301,236,123,235,112,258,28,79,254,75,321,76,290,247,134,311,168,301,102,343,203,352,174,184,27,204,341,203,66,276,87,31,182,45,218,322,223,314,229,93,158,68,274,112,313,132,318,220,92,256,244,34,225,332,217,78,213,325,229,241,293,46,260,116,307,84,45,183,28,108,278,93,224,125,46,318,192,173,190,7,236,114,282,298,223,296,126,303,59,303,110,92,280,101,267,118,38,228,305,133,336,132,61,315,224,316,203,288,270,98,35,244] if k == 5: return [286,33,235,313,74,293,63,32,85,165,39,101,263,103,283,248,127,238,108,96,288,71,290,63,199,7,147,208,145,6,91,51,294,227,42,290,238,79,244,99,224,308,82,325,138,311,88,350,233,75,290,252,281,62,283,94,284,95,154,270,83,145,19,251,106,246,122,248,234,291,79,174,319,200,339,187,276,70,80,166,80,303,153,42,286,95,108,186,172,186,0,183,44,221,326,129,334,174,32,116,215,99,226,296,55,72,239,301,60,186,55,159,267,100,340,221,298,56,240,10,170,76,65,207,292,231,72,318,46,75,209,344,207,75,50,180,354,136,249,116,281,102,249,263,112,279,252,143,44,223,327,129,303,235,317,217,14,175,332,151,301,114,256,56,183,324,125,48,36,90,127,241,312,51,102,247,86,299,66,293,233,120,259,317,231,106,252,287,250,99,342,187,177,37,109,350,117,276,129,295,113,288,242,115,252,72,299,60,308,111,300,166,313,229,135,69,315,202,345,229,304,107,305,84,295,231,32,161,275,120,236,246,12,158,13,105,91,77,250,120,251,99,272,65,299,241,114,231,318,218,352,178,29,164,89,256,119,240,250,41,180,351,195,351,184,63,283,295,227,308,89,255,145,62,264,274,61,213,319,45,260,270,122,224,122,235,310,43,225,244,104,263,84,251,96,282,75,253,74,292,236,71,276,241,127,55,242,120,288,233,39,238,286,265,82,328,84,247,288,79,19,149,96,285,244,127,86,325,203,340,187,351,193,34,235,98,259,112,32,191,352,179,304,60,297,58,82,46,183,279,254,284,245,124,328,223,310,193,354,178,304,70,233,342,189,329,216,313,40,105,259,249,82,323,185,352,216,317,196,44,231,26,203,336,176,37,50,115,251,14,95,40,239,111,241,126,247,99,230,323,131,317,47,96,315,67,279,265,81,49,150,38,213,337,221,123,228,35,240,288,300,216,327,226,42,175,189,56,70,286,245,120,229,307,214,42,98,236,93,115,27,241,286,119,354,147,358,209,145,206,358,143,285,251,78,343,105,190,333,147,326,223,307,160,54,294,46,150,328,211,146,255,115,35,173,277,288,248,228,292,248,89,148,48,308,229,245,84,246,124,331,230,318,79,48,82,95,162,2,189] for k in range(6): fils = choix(k) x1, y1 = 160 + 130 * cos(fils[0] * pi / 180),110 - 130 * sin(fils[0] * pi / 180) for (i,v) in enumerate(fils[:-1]): x2, y2 = 160 + 130 * cos(fils[i+1] * pi / 180),110 - 130 * sin(fils[i+1] * pi / 180) for n in range(131): x = int(x1 + (x2 - x1) * n / 130) y = int(y1 + (y2 - y1) * n / 130) c1 = get_pixel(x,y)[0] c2 = (max(0,c1 - 20),) * 3 set_pixel(x,y,c2) x1, y1 = x2, y2