from turtle import * from kandinsky import fill_rect from time import sleep NB = 8 bic = ['M',186,44,'C',187,54,182,64,176,66,170,67,165,60,164,50,163,40,168,31,174,29,180,27,185,34,186,44,'Z','M',48,160,'C',48,160,68,160,71,160,74,160,85,150,87,136,88,122,85,117,81,117,78,117,62,117,62,117,62,117,48,160,48,160,'Z','M',257,102,'C',257,102,273,102,273,102,273,102,303,35,303,35,303,35,272,35,272,35,272,35,269,47,269,47,269,47,263,30,243,30,223,30,194,53,187,106,180,158,198,190,222,190,246,190,261,176,273,150,273,150,263,132,263,132,263,132,250,172,226,161,215,156,215,113,229,84,243,55,252,58,255,62,258,66,264,73,257,102,'Z','M',15,188,'C',15,188,82,188,90,188,99,188,119,175,121,139,122,124,115,112,111,109,111,109,138,102,138,62,138,43,128,34,120,34,113,34,53,34,53,34,53,34,15,188,15,188,'Z','M',72,90,'C',72,90,88,90,91,90,95,90,106,84,106,71,106,59,100,58,98,58,96,58,83,58,83,58,83,58,72,90,72,90,'Z','M',123,188,'C',123,188,158,188,158,188,158,188,180,69,180,69,180,69,158,69,158,69,158,69,123,188,123,188,'Z'] adidas = ['M',187,142,'C',187,142,200,142,200,142,200,142,200,212,200,212,200,212,187,212,187,212,187,212,187,209,187,209,183,211,178,213,172,213,157,213,145,201,145,186,145,171,157,159,172,159,178,159,183,161,187,164,187,164,187,142,187,142,187,142,187,142,187,142,'Z','M',157,186,'C',157,194,164,201,172,201,181,201,187,194,187,186,187,178,181,171,172,171,164,171,157,178,157,186,'M',206,142,'C',206,142,143,33,143,33,143,33,188,7,188,7,188,7,266,142,266,142,266,142,206,142,206,142,'M',91,80,'C',91,80,136,54,136,54,136,54,187,142,187,142,187,142,140,142,140,142,140,142,140,155,140,155,140,155,127,155,127,155,127,155,127,142,127,142,127,142,91,80,91,80,'M',288,213,'C',274,213,265,206,265,195,265,195,278,195,278,195,278,199,280,203,289,204,295,204,298,200,298,198,297,193,292,193,287,192,281,191,277,190,273,189,269,186,266,182,266,176,266,167,274,159,287,159,301,159,309,166,310,176,310,176,297,176,297,176,296,174,296,169,288,169,283,169,279,170,279,174,279,179,290,179,298,181,307,183,312,188,312,195,312,208,301,213,288,213,'M',127,212,'C',127,212,140,212,140,212,140,212,140,160,140,160,140,160,127,160,127,160,127,160,127,212,127,212,'Z','M',92,213,'C',77,213,65,201,65,186,65,171,77,159,92,159,98,159,103,161,108,164,108,164,108,142,108,142,108,142,120,142,120,142,120,142,120,212,120,212,120,212,108,212,108,212,108,212,108,209,108,209,103,211,98,213,92,213,92,213,92,213,92,213,'Z','M',77,186,'C',77,194,84,201,93,201,101,201,108,194,108,186,108,178,101,171,93,171,84,171,77,178,77,186,'M',38,127,'C',38,127,83,101,83,101,83,101,107,142,107,142,107,142,47,142,47,142,47,142,38,127,38,127,'M',231,213,'C',217,213,205,201,205,186,205,171,217,159,231,159,237,159,242,161,247,164,247,164,247,160,247,160,247,160,260,160,260,160,260,160,260,212,260,212,260,212,247,212,247,212,247,212,247,209,247,209,242,211,237,213,231,213,'Z','M',217,186,'C',217,194,224,201,232,201,240,201,247,194,247,186,247,178,240,171,232,171,224,171,217,178,217,186,'M',18,186,'C',18,194,25,201,33,201,41,201,48,194,48,186,48,178,41,171,33,171,25,171,18,178,18,186,18,186,18,186,18,186,'Z','M',32,213,'C',18,213,5,201,5,186,5,171,18,159,32,159,38,159,43,161,48,164,48,164,48,160,48,160,48,160,61,160,61,160,61,160,61,212,61,212,61,212,48,212,48,212,48,212,48,209,48,209,44,211,38,213,32,213] mcdo = ['M',207,24,'C',227,24,243,108,243,211,243,211,272,211,272,211,272,100,242,9,207,9,186,9,168,37,156,79,144,37,126,9,106,9,70,9,41,100,41,211,41,211,70,211,70,211,70,108,86,24,106,24,126,24,142,101,142,197,142,197,171,197,171,197,171,101,187,24,207,24] tesla = ['M',156,14,'C',177,14,201,17,226,28,229,22,230,19,230,19,203,9,178,5,156,5,134,5,109,9,82,19,82,19,83,23,86,28,111,17,135,14,156,14,156,14,156,14,156,14,'M',116,207,'C',116,207,131,207,131,207,134,206,135,205,136,203,136,203,111,203,111,203,112,205,113,206,116,207,'M',201,215,'C',203,215,204,213,205,211,205,211,186,211,186,211,186,211,186,194,186,194,186,194,182,194,182,194,182,194,182,215,182,215,182,215,201,215,201,215,'M',217,199,'C',217,199,233,199,233,199,235,198,237,196,237,194,237,194,213,194,213,194,213,196,215,198,217,199,'M',152,198,'C',152,198,166,198,166,198,168,198,170,196,171,194,171,194,147,194,147,194,147,194,147,207,147,207,147,207,166,207,166,207,166,207,166,211,166,211,166,211,152,211,152,211,149,212,147,213,146,215,146,215,147,215,147,215,147,215,170,215,170,215,170,215,170,203,170,203,170,203,152,203,152,203,152,203,152,198,152,198,'M',116,199,'C',116,199,131,199,131,199,134,198,135,196,136,194,136,194,111,194,111,194,112,196,113,198,116,199,'M',214,203,'C',214,203,214,215,214,215,214,215,218,215,218,215,218,215,218,207,218,207,218,207,233,207,233,207,233,207,233,215,233,215,233,215,237,215,237,215,237,215,237,203,237,203,237,203,214,203,214,203,'M',116,215,'C',116,215,131,215,131,215,134,215,135,213,136,211,136,211,111,211,111,211,112,213,113,215,116,215,'M',75,194,'C',75,196,77,198,79,199,79,199,85,199,85,199,85,199,86,199,86,199,86,199,86,215,86,215,86,215,90,215,90,215,90,215,90,199,90,199,90,199,90,199,90,199,90,199,97,199,97,199,99,198,101,196,101,194,101,194,101,194,101,194,101,194,75,194,75,194,75,194,75,194,75,194,'M',156,152,'C',156,152,177,36,177,36,196,36,203,38,203,47,203,47,217,42,223,32,197,20,171,19,171,19,171,19,156,38,156,38,156,38,156,38,156,38,156,38,141,19,141,19,141,19,114,20,88,32,95,42,108,47,108,47,109,38,115,36,135,36,135,36,156,152,156,152] puma = ['M',293,10,'C',288,4,280,9,276,11,250,27,246,53,237,69,230,81,219,90,208,91,200,91,192,90,184,86,163,77,152,66,149,64,144,60,102,19,67,17,67,17,63,8,62,8,59,8,57,13,55,14,53,14,50,8,48,8,47,9,45,15,42,18,39,21,36,21,35,24,34,25,34,27,33,28,32,32,27,32,27,36,27,40,31,41,35,44,38,47,38,48,41,50,44,51,48,47,52,49,55,49,58,50,59,53,59,56,59,61,55,60,54,60,48,58,41,59,33,60,24,63,23,72,22,77,29,83,35,81,39,81,37,76,39,73,42,70,59,84,75,84,82,84,87,82,92,77,92,77,93,76,94,76,94,76,95,77,96,77,109,87,118,107,165,108,172,108,179,111,185,116,191,121,194,129,197,137,202,149,210,160,223,173,224,174,234,182,235,183,235,183,236,185,236,186,235,193,234,216,251,217,255,217,254,214,254,212,254,208,253,204,255,200,258,195,249,192,250,180,250,172,242,173,239,166,236,162,234,160,235,156,235,129,229,111,225,107,223,103,221,102,223,101,237,91,240,83,240,83,248,65,255,49,264,42,266,41,271,37,273,36,282,32,287,30,289,27,293,23,296,15,293,10,293,10,293,10,293,10,'Z'] nasa = ['M',294,154,'C',294,154,274,91,274,91,274,90,273,89,273,89,273,88,272,88,271,88,270,88,269,88,268,89,268,89,268,90,268,91,268,91,247,154,247,154,247,154,229,154,229,154,229,154,251,85,251,85,252,81,254,78,256,76,260,73,264,71,271,71,277,71,282,73,285,76,287,78,289,81,290,85,290,85,312,154,312,154,312,154,294,154,294,154,294,154,294,154,294,154,'Z','M',62,134,'C',63,137,64,139,67,139,70,139,71,137,71,134,71,134,71,73,71,73,71,73,89,73,89,73,89,73,89,134,89,134,89,142,88,146,83,151,80,154,74,156,67,156,61,156,56,154,52,151,49,147,47,144,44,134,44,134,34,93,34,93,33,90,31,88,28,88,26,88,24,90,24,93,24,93,24,154,24,154,24,154,7,154,7,154,7,154,7,93,7,93,7,85,8,81,12,76,15,73,21,71,28,71,34,71,40,73,43,76,47,80,48,83,51,93,51,93,62,134,62,134,'Z','M',204,154,'C',216,154,221,152,226,147,231,142,233,137,233,129,233,122,231,116,227,112,222,107,215,105,205,105,205,105,190,105,190,105,185,105,182,104,181,103,179,101,179,100,179,98,179,95,179,93,181,92,182,91,184,90,187,90,187,90,229,90,229,90,229,90,229,73,229,73,229,73,191,73,191,73,179,73,174,75,169,80,164,84,162,90,162,98,162,105,164,111,168,115,173,120,180,122,190,122,190,122,205,122,205,122,210,122,213,123,214,124,216,126,216,127,216,129,216,132,216,134,214,135,213,136,211,137,208,137,208,137,164,137,164,137,164,137,148,85,148,85,146,81,145,78,143,76,139,73,135,71,128,71,121,71,117,73,114,76,112,78,110,81,109,85,109,85,87,154,87,154,87,154,105,154,105,154,105,154,125,91,125,91,125,90,125,89,126,89,126,88,127,88,128,88,129,88,130,88,131,89,131,89,131,90,131,91,131,91,152,154,152,154,152,154,204,154,204,154,204,154,204,154,204,154,'Z'] pepsi = ['M',155,207,'C',195,207,229,183,244,149,243,148,225,142,206,142,176,142,140,154,102,154,83,154,68,149,67,148,82,183,116,207,155,207,155,207,155,207,155,207,'Z','M',162,100,'C',162,100,168,100,168,100,171,100,172,102,172,104,172,107,171,108,167,110,167,110,162,112,162,112,162,112,162,100,162,100,'Z','M',244,89,'C',244,89,231,94,231,94,231,94,231,129,231,129,231,129,244,129,244,129,244,129,244,89,244,89,'Z','M',108,90,'C',108,90,108,129,108,129,108,129,143,129,143,129,143,129,143,120,143,120,143,120,121,120,121,120,121,120,121,114,121,114,121,114,138,114,138,114,138,114,138,105,138,105,138,105,121,105,121,105,121,105,121,100,121,100,121,100,142,100,142,100,142,100,142,90,142,90,142,90,108,90,108,90,'Z','M',155,14,'C',116,14,82,38,67,72,67,72,86,79,105,79,135,79,170,67,209,67,228,67,242,71,244,72,229,38,195,14,155,14,155,14,155,14,155,14,'Z','M',207,89,'C',195,89,189,94,189,102,189,105,190,109,193,110,198,113,202,114,207,115,210,116,213,117,213,119,213,120,212,121,207,121,199,121,197,117,197,117,197,117,186,121,186,121,188,128,200,131,207,131,215,131,220,129,223,126,226,123,227,120,227,117,227,115,226,111,221,109,217,107,210,105,207,105,206,104,202,104,202,102,202,100,204,99,207,99,214,99,215,103,215,103,215,103,226,99,226,99,224,91,215,89,207,89,207,89,207,89,207,89,'Z','M',79,100,'C',79,100,86,100,86,100,88,100,90,102,90,104,90,107,89,108,85,110,85,110,79,112,79,112,79,112,79,100,79,100,'Z','M',155,3,'C',96,3,48,51,48,110,48,170,96,218,155,218,215,218,263,170,263,110,263,51,215,3,155,3,155,3,155,3,155,3,'Z','M',155,7,'C',155,7,155,7,155,7,213,7,259,53,259,110,259,110,259,110,259,110,259,110,259,110,259,110,259,167,213,214,155,214,155,214,155,214,155,214,155,214,155,214,155,214,98,214,52,167,52,110,52,110,52,110,52,110,52,110,52,110,52,110,52,53,98,7,155,7,155,7,155,7,155,7,155,7,155,7,155,7,'Z','M',148,90,'C',148,90,148,129,148,129,148,129,162,129,162,129,162,129,162,122,162,122,167,120,172,118,177,116,186,112,186,107,186,102,186,97,182,90,171,90,171,90,162,90,162,90,162,90,148,90,148,90,'Z','M',66,90,'C',66,90,66,129,66,129,66,129,79,129,79,129,79,129,79,122,79,122,85,120,90,118,94,116,104,112,104,107,104,102,104,97,100,90,89,90,89,90,79,90,79,90,79,90,66,90,66,90,'Z'] vaio = ['M',128,132,'C',133,132,137,128,137,123,137,117,133,113,128,113,123,113,118,117,118,123,118,128,123,132,128,132,'M',243,111,'C',243,91,259,75,279,75,298,75,314,91,314,111,314,130,298,146,279,146,259,146,243,130,243,111,'M',279,134,'C',292,134,302,124,302,111,302,97,292,87,279,87,266,87,256,97,256,111,256,124,266,134,279,134,'M',216,75,'C',211,80,207,85,207,100,207,117,207,144,207,144,207,144,220,144,220,144,220,144,220,99,220,99,220,92,220,89,224,85,224,85,216,75,216,75,'M',189,144,'C',179,144,171,140,164,130,157,120,148,106,143,99,139,92,135,89,127,89,120,89,116,92,111,99,106,106,98,120,91,130,84,140,75,144,66,144,56,144,47,140,40,130,33,120,25,107,20,100,16,94,12,90,4,90,4,90,4,78,4,78,15,78,24,83,31,95,39,106,44,114,49,122,54,129,59,133,66,133,72,133,77,129,82,122,87,114,93,104,100,93,108,82,117,77,127,77,138,77,147,82,154,93,162,104,168,114,173,122,178,129,182,133,189,133,189,133,189,144,189,144] ps = ['M',44,184,'C',23,178,19,165,29,158,38,151,54,146,54,146,54,146,118,123,118,123,118,123,118,149,118,149,118,149,72,165,72,165,63,168,62,173,69,175,75,177,87,176,96,173,96,173,118,165,118,165,118,165,118,189,118,189,116,189,115,189,113,189,91,193,68,191,44,184,44,184,44,184,44,184,'Z','M',295,166,'C',290,172,277,177,277,177,277,177,179,212,179,212,179,212,179,186,179,186,179,186,251,161,251,161,259,158,260,154,254,152,247,149,235,150,227,153,227,153,179,170,179,170,179,170,179,143,179,143,179,143,182,142,182,142,182,142,196,137,215,135,235,133,258,135,277,142,298,149,301,159,295,166,295,166,295,166,295,166,'Z','M',189,122,'C',189,122,189,56,189,56,189,48,187,41,180,39,174,37,171,42,171,50,171,50,171,215,171,215,171,215,126,201,126,201,126,201,126,4,126,4,145,7,173,16,188,21,225,34,238,50,238,86,238,122,216,135,189,122,189,122,189,122,189,122,'Z'] ti = ['M',246,72,'C',246,72,246,46,246,46,246,46,205,46,205,46,205,46,199,72,199,72,199,72,214,72,214,72,214,72,210,96,210,96,210,96,195,96,195,96,195,96,189,122,189,122,189,124,189,125,189,126,187,134,191,134,202,134,202,134,197,159,197,159,197,159,177,159,177,159,159,159,144,159,148,140,148,137,149,134,150,132,150,132,157,96,157,96,157,96,142,96,142,96,142,96,147,72,147,72,147,72,161,72,161,72,161,72,167,46,167,46,167,46,153,46,153,46,153,46,153,6,153,6,153,6,103,6,103,6,103,6,103,86,103,86,103,86,44,86,44,86,45,107,64,110,71,125,75,135,79,153,93,153,103,153,103,140,116,140,130,140,135,165,147,186,156,202,171,213,184,214,195,215,200,211,200,211,197,205,196,199,196,190,196,177,206,164,218,155,234,143,252,138,258,137,258,137,258,95,258,95,258,95,246,89,246,72,'Z','M',178,134,'C',178,134,196,46,196,46,196,46,176,46,176,46,176,46,158,134,158,134,158,134,178,134,178,134,178,134,178,134,178,134,'Z','M',201,18,'C',201,18,181,18,181,18,181,18,177,37,177,37,177,37,197,37,197,37,197,37,201,18,201,18,'Z'] wa = ['M',62,215,'C',68,197,74,179,80,161,40,91,90,12,157,6,220,0,272,45,272,107,273,173,209,228,138,205,132,204,126,198,119,198,110,197,99,203,90,206,80,209,72,213,62,215,'Z','M',121,178,'C',179,213,248,174,254,117,259,65,218,19,162,23,99,27,61,103,100,159,96,168,93,178,90,188,101,185,110,181,121,178,'Z','M',119,96,'C',128,122,167,158,195,159,208,159,224,153,223,134,215,128,206,124,196,120,191,125,187,130,182,134,165,126,152,115,144,98,160,90,150,71,144,58,120,51,114,81,119,96,'Z'] win = ['M',47,36,'C',47,36,133,24,133,24,133,24,133,106,133,106,133,106,47,106,47,106,47,106,47,36,47,36,'Z','M',143,116,'C',143,116,256,116,256,116,256,116,256,215,256,215,256,215,143,199,143,199,143,199,143,116,143,116,'Z','M',143,22,'C',143,22,256,6,256,6,256,6,256,105,256,105,256,105,143,105,143,105,143,105,143,22,143,22,'Z','M',47,115,'C',47,115,133,115,133,115,133,115,133,198,133,198,133,198,47,186,47,186,47,186,47,115,47,115,'Z'] mon = ['M',208,187,'C',209,177,218,169,216,158,218,149,212,140,219,132,213,123,220,114,221,105,220,96,211,89,217,79,216,72,213,62,218,54,219,46,226,39,226,31,224,24,222,14,213,12,204,4,200,20,191,20,186,20,173,29,185,28,192,32,206,28,204,40,206,49,202,58,201,65,203,74,201,83,206,91,205,100,208,109,208,118,209,127,209,137,205,145,209,154,200,161,205,170,205,176,203,187,208,190,208,189,208,188,208,187,'M',158,218,'C',164,211,164,201,166,193,170,183,164,174,164,164,164,155,166,146,165,137,164,128,169,118,172,109,180,101,171,91,172,82,172,73,177,66,174,57,175,48,169,40,174,32,176,26,180,21,185,18,178,14,172,7,164,3,157,6,149,9,142,11,134,13,128,18,120,15,115,15,112,6,107,13,99,17,90,16,82,20,78,20,71,25,79,24,87,24,101,24,101,34,106,40,109,51,105,59,100,69,105,78,108,87,113,96,109,107,113,116,116,125,110,133,109,141,115,149,111,160,116,170,117,180,120,191,123,201,127,204,123,190,123,186,123,176,123,166,124,155,122,146,123,137,126,128,131,120,125,113,125,105,125,100,129,97,130,92,124,83,121,72,122,61,123,57,129,51,123,49,118,37,134,33,130,22,135,17,151,20,150,30,150,37,147,42,153,46,153,55,152,65,154,74,158,82,151,91,157,100,159,108,155,118,153,126,145,135,156,144,153,154,154,163,154,173,155,182,151,190,161,198,158,207,158,211,157,215,157,218,'M',157,218,'C',157,218,158,218,158,218] 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(0) def logo(svg): i = 0 fill_rect(0,0,320,222,(0,0,0)) color('white') pensize(2) showturtle() while i<len(svg): if svg[i] == "M": l = [svg[i+1],svg[i+2]] penup() move(l[0],l[1]) i += 3 sleep(.2) 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() sleep(2) for s in [pepsi,mon,win,wa,ti,ps,vaio,nasa,puma,tesla,mcdo,bic,adidas]: logo(s)