;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: To understand recursion you must first understand recursion ;;; ;;; Description: ;;; ;helpers, I thought these would be given uwu (define (cadr lst) (car (cdr lst))) (define (cddr lst) (cdr (cdr lst))) (define delta 0.0475);21 partitions ; a workable coordinate system: (define (tx x) (- (* x +1) 940)) ;big monitor (define (ty y) (+ (* y -1) 540)) ;goto in realistic coordinate system (define (tgt x y) (goto (tx x) (ty y)) ) ;easy control over color palette (define black "#353A07") (define yellow "#EEC13B") (define red "#D5532B") (define pink "#EE8060") (define white "#F7BE8B") (define green "#507E4F") (define (c start cx1 cy1 cx2 cy2 ex ey) (define (helper ix iy cx1 cy1 cx2 cy2 ex ey u); u goes from 0 to 1, increments of delta (if (< u 1) (begin (tgt (+ (* ix (expt (- 1 u) 3)) (* 3 u (expt (- 1 u) 2) cx1) (* 3 (expt u 2) (- 1 u) cx2) (* (expt u 3) ex) ) (+ (* iy (expt (- 1 u) 3)) (* 3 u (expt (- 1 u) 2) cy1) (* 3 (expt u 2) (- 1 u) cy2) (* (expt u 3) ey) ) ) (helper ix iy cx1 cy1 cx2 cy2 ex ey (+ u delta)) ) ) ) (pu) (tgt (car start) (car (cdr start))) (pd) (helper (car start) (car (cdr start)) cx1 cy1 cx2 cy2 ex ey 0) (tgt ex ey) (pu) (list ex ey) ) ;transform an element: (eval elem) -> (eval (map_elem elem shift-x shift-y scale-x scaley)) (define (map_elem elem sx sy mx my) (if (equal? (car elem) 'list) (cons 'list (map_point (cdr elem) sx sy mx my)) (begin (cons 'c (cons (map_elem (cadr elem) sx sy mx my) (map_cap (cddr elem) sx sy mx my))); map control and point ) ) ) (define (map_point point sx sy mx my) (list (+ sx (* mx (car point))) (+ sy (* my (cadr point)))) ) (define (map_cap points sx sy mx my) (define c1 (map_point points sx sy mx my)) (define c2 (map_point (cddr points) sx sy mx my)) (define e (map_point (cddr (cddr points)) sx sy mx my)) (list (car c1) (cadr c1) (car c2) (cadr c2) (car e) (cadr e)) ) (define (draw) (define (d_r_pikachu sx sy mx my y) (if (> y -1) (begin (d_pikachu sx sy mx my) (define nexty (+ 1040.427 (/ -1040.427 (+ 1 (expt (/ y 1.254462) 1.545491))))) (define nextm (* 1.566 (/ (- 1070 nexty) 1070) )) (d_r_pikachu (* 1900 (- 1 (/ nextm 1.566))) nexty nextm nextm (- y 1) ) ) ) ) (d_bg) (d_r_pikachu 0 0 1.566 1.566 20) (d_pikachu 0 0 1.566 1.566) (exitonclick) ) (define (d_bg) (pu) (color green) (tgt -100 0) (pd) (begin_fill) (tgt -100 1080) (tgt 1920 1080) (tgt 1920 0) (tgt -100 0) (end_fill) (pu) ) ;drawing (define (d_pikachu sx sy mx my) ;outline (color black) (begin_fill) (eval (map_elem p-outline sx sy mx my)) (end_fill) ;yellow inside (color yellow) (begin_fill) (eval (map_elem p-yellow sx sy mx my)) (end_fill) ;black parts of face (color black) (begin_fill) (eval (map_elem eye-left sx sy mx my)) (end_fill) (begin_fill) (eval (map_elem eye-right sx sy mx my)) (end_fill) (begin_fill) (eval (map_elem nose sx sy mx my)) (end_fill) (begin_fill) (eval (map_elem mouth sx sy mx my)) (end_fill) (color white) (begin_fill) (eval (map_elem pupil-right sx sy mx my)) (end_fill) (begin_fill) (eval (map_elem pupil-left sx sy mx my)) (end_fill) (color red) (begin_fill) (eval (map_elem cheek-left sx sy mx my)) (end_fill) (begin_fill) (eval (map_elem cheek-right sx sy mx my)) (end_fill) (color pink) (begin_fill) (eval (map_elem tongue sx sy mx my)) (end_fill) ) ;paths to draw (define p-outline '(c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (list 351.05150690000005 744.8052847) 344.1225498 736.3561141 343.8443823 728.0593217 335.3154736 711.6570852) 328.7769117 699.0825543999999 324.5260248 695.5392380000001 320.9165657 686.8517488) 317.3071079 678.1642596 312.5769448 668.5626663 309.6195072 649.8102937000001) 305.78087370000003 625.4704808 309.2593409 625.2926161 312.45035989999997 601.0610256) 315.2364198 582.6522092 315.6885221 582.5775112 320.9165657 564.0239892) 329.68404780000003 532.9095487 328.7051452 532.7387976 335.3154736 501.3314528) 341.6688869 471.1447833 340.3267786 471.0011333 346.8440491 440.8359606) 351.240536 420.48683570000003 359.0255899 419.71962510000003 357.1429884 400.30285890000005) 356.0932449 389.47601299999997 350.9326284 389.374093 340.9793591 380.3487377) 322.6273761 363.7076561 316.7929709 354.92578391 303.67933660000006 336.15983398000003) 240.4849144 280.81288713 142.92952738 146.93405711 157.9676159 61.518380399999984) 157.9676159 62.01684979999999 376.74392950000004 225.4984691504 378.6480343 225.1441071957) 415.8276911 251.80393833 414.240824 253.23871817 466.8899192 295.20737178) 473.47710240000004 305.19093719 489.0069765 314.91883719000003 496.44177399999995 314.76089421) 541.0509347 313.81322788 551.5941518 305.89336996 597.974088 303.91588718) 656.3016130999999 301.42899992 655.9661052 310.09109765 713.9710301 308.01804147) 724.2321641 307.65131563 727.5915903 303.98919392 737.5891636 302.16533058) 755.996654 298.80724091 753.3812906 296.85507368000003 769.4820246 290.20005271) 812.5721405 272.38933368 815.6926540000001 265.99784793 858.3309562000001 246.65631975) 882.0221250000001 235.909564861 885.5454175000001 233.691290608 909.6019344 225.0000000000003) 945.609558 201.89933747999999 1100.6217894000001 138.08781438 1113.6150619 138.08781438) 1076.0418431 257.45794591 1029.408611 273.84675016 970.4414469 325.10410267) 954.1386201 337.16344581 949.7059659 338.73111542000004 933.976924 352.97412147) 901.0272644 382.8107895 900.1378824000001 382.3885794 867.9032332 406.6943336) 858.7840257 410.8836382 853.1953907000001 412.7844735 850.0751879000001 419.5647821) 850.0751879000001 430.5606332 858.6254491000001 433.724503 861.3197303 445.487553) 869.6507789999999 475.0129905 870.3943946 469.0443369 876.5620184 492.9755975) 883.4573575 519.7304984 881.8842769 519.9343917000001 887.4456561000001 546.8598773) 896.6708487 572.1833053 897.9623220000001 571.9897054 905.3279413 595.9472767) 911.8438897000001 617.1411923000001 910.9957307 617.2858563 915.7768940999999 638.7223077) 920.8700263000001 661.5574759000001 921.1398569 661.5447151000001 925.0765325000001 684.4905172000001) 930.2398725 714.5862036000001 933.976924 728.5955873 933.976924 744.8052847) 682.3645799000001 744.8052847 351.05150690000005 747.2503819 351.05150690000005 744.8052847) ) (define p-yellow '(c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (c (list 220.2938955 211.79349249) 226.0506894 225.0319800172 234.796221 241.88151734 235.41874940000002 244.53311589999998) 236.0412778 247.18471433 247.9982124 260.15236474 253.6627843 268.19073105) 259.32735490000005 276.22909723 261.6949006 280.08500435 271.5929082 292.86341012) 279.7019039 303.33218779000003 287.02848159999996 308.16476255 294.7124124 318.13048351) 323.2453714 355.13647916 322.4832464 360.46362020000004 333.21447470000004 370.2528373) 348.11929580000003 383.84927860000005 357.5769492 394.0332472 359.3757124 397.2721049) 361.2151825 400.5842579 363.2241479 404.87940720000006 365.9478559 404.8780773) 367.3327797 404.8774 372.4614773 398.6804963 378.8154587 393.68812710000003) 385.16944010000003 388.6957579 392.9722689 384.4131042 394.929064 385.0015557) 396.9010132 386.4309941 388.2109903 394.3595225 382.29399870000003 398.3405528) 377.9774878 402.5755446 367.4528594 410.0748936 365.9478559 409.3550004) 359.4668619 418.3009621 355.248852 450.4336224 343.3304585 491.339997) 331.4120663 532.2463716 326.8985508 547.4068728 323.1790961 562.8971918) 308.94362939999996 622.1832575999999 310.39154210000004 625.4693066 310.1772449 634.6391166000001) 310.1772449 634.6391166000001 311.8300259 651.0069681 313.84134040000004 660.7420792) 315.8526549 670.4771916 329.00252280000007 691.9142267 329.00252280000007 691.9142267) 329.00252280000007 691.9142267 338.0317963 703.3533739 343.3304585 713.0385871) 348.629122 722.7238003 354.3293568 743.4452855 354.3293568 743.4452855) 354.3293568 743.4452855 681.3319106 743.0881131 844.7987245 743.4452855) 922.451501 744.7055835 920.3292029 746.3159338 920.3292029 746.3159338) 920.3292029 746.3159338 926.6958086000001 747.7068623 925.6928417 741.3123625) 924.6898748 734.917864 922.7711034 707.2455674 920.3292029 695.1750947) 916.4861273 676.1785223 913.2303735 658.9992667 913.2303735 658.9992667) 913.2303735 658.9992667 909.0757984 647.1844819 904.9556525 634.6391166000001) 900.8355079000002 622.09375 895.4310335 607.7094905 894.0469547 600.8232384) 890.7113211 584.2273500000001 881.4007198 551.5167604000001 881.4007198 551.5167604000001) 881.4007198 551.5167604000001 876.3483088 539.0020360999999 875.1937255 529.5049615) 874.0391409 520.0078869 869.3503945 494.9311794 869.3503945 494.9311794) 869.3503945 494.9311794 865.8638829000001 472.8298066 862.4398454 463.8891008) 859.0158079 454.948395 851.6277636000001 430.59441730000003 851.6277636000001 430.59441730000003) 851.6277636000001 430.59441730000003 849.2727096 425.4646277 847.6301661000001 424.4423012) 845.6073609 421.6924697 845.5587786000001 422.5077543 841.8864684000001 419.34388190000004) 836.6863904 414.4162189 829.4488471000001 411.6235147 831.7087944000001 409.3550004) 833.288622 406.5708151 839.6076659000001 412.058288 845.3394166 418.7088709) 847.7988216000001 421.76791000000003 845.9306618 419.5656424 847.9272824 422.4744457) 851.1767819 419.9070289 846.4682625 420.0075761 853.1892768 414.9299828) 859.9884315 409.3468468 867.5922966 405.4005005 871.4271835000001 402.5928047) 880.5013603000001 395.949182 882.5769104 395.949182 889.3738304000001 389.0160012) 921.7457388000001 362.4958114 945.3918106 341.57968656 945.3918106 341.57968656) 945.3918106 341.57968656 949.6683569 339.22481390999997 956.6213614000001 333.26308983) 963.5743646 327.30136562 966.2296562 324.27799007 966.2296562 324.27799007) 966.2296562 324.27799007 1009.2641373 258.92002896 1023.0979937000001 234.90165978) 1036.9318488 210.88329073 1045.1649958 186.33751844 1047.2795212 170.95148895) 1030.0585356 170.95148895 982.9107349000001 196.57260694 972.5571384000001 200.47538478) 962.2035419 204.37816275 913.2303735 226.1904841237 913.2303735 226.1904841237) 913.2303735 226.1904841237 853.8761747000001 251.77555448 824.4731244000001 266.03566255) 795.0700740999999 280.29577062 789.1210336000001 285.47468501000003 789.1210336000001 285.47468501000003) 789.1210336000001 285.47468501000003 778.0593531000001 290.34222249000004 772.7414288000001 292.86341012) 767.4235058 295.38459775 749.0570161 302.29933857000003 749.0570161 302.29933857000003) 749.0570161 302.29933857000003 736.481171 306.5014522 730.6742985000001 307.39232998) 727.8225535 307.82983848000003 722.818132 308.67826918000003 718.4631619 309.42849853) 713.9503146000001 310.20592544 710.1348614 310.87790181 710.1348614 310.87790181) 710.1348614 310.87790181 703.3205461 311.30554773 693.0471414 311.26075779) 688.6772784999999 311.24170603 683.6815683 311.13717719 678.3182259 310.87790181) 660.3458390000001 310.00907827000003 637.9830219 307.39232998 620.9341017 307.39232998) 586.936217 307.39232998 567.8307917 309.42849853 567.8307917 309.42849853) 567.8307917 309.42849853 557.8362539 311.4182381 545.1657948 313.04977684) 532.4953344 314.68131545 530.7348601 315.43509614 517.7737977 316.81768878) 504.8127366 318.20028142 487.0738999 318.13048351 487.0738999 318.13048351) 487.0738999 318.13048351 461.62951469999996 296.38575505 444.2714246 281.62501711) 426.9133358 266.86427917 434.8679721 273.36549948 428.3361104 268.19073105) 408.8430784 252.74767043 371.0224605 226.1904841237 371.0224605 226.1904841237) 371.0224605 226.1904841237 248.4996393 140.95758383999998 220.2938955 123.32838108) 210.7172518 147.12272828 215.3688754 191.62626034 220.2938955 211.79349249) ) (define eye-left '(c (c (c (c (c (c (list 428.4098451 470.56437589999996) 428.4098451 500.4293071 430.9288447 511.54060730000003 471.0079773 514.3718253) 476.55103299999996 514.7633905 481.9509314 506.81822730000005 482.28361570000004 501.21678080000004) 483.81243910000006 475.4757668 485.4702615 464.810533 467.28936630000004 455.67045659999997) 459.57856840000005 451.7940087 450.8324635 454.51508809999996 444.34815710000004 456.5059705) 444.34815710000004 456.5059705 443.36575100000005 456.6106699 436.25607049999996 461.107548) 429.14639 465.6044248 428.4098451 470.56437589999996 428.4098451 470.56437589999996) ) (define eye-right '(c (c (c (c (c (c (c (list 686.6521918000001 467.0224778) 685.2402228 480.856979 681.8024872 494.8771059 689.616561 501.0732595) 709.607896 516.9253451 725.8510346 523.6520131 741.9389090000001 502.6710167) 747.9031751000001 494.8927215 744.3433513 464.5555796 733.2614063999999 457.5272986) 725.6982612 452.7306769 714.927626 445.4763324 704.0962886000001 451.04469) 704.0962886000001 451.04469 695.6462431 457.2966851 695.0702157 457.5272986) 694.8687664 457.60794930000003 690.950439 461.6282474 690.6846241000001 461.92040810000003) 690.4188105000001 462.2125675 686.6521918000001 467.0224778 686.6521918000001 467.0224778) ) (define nose '(c (c (c (c (c (c (c (list 543.4928846 533.8020244) 541.7918515 535.0286602 540.5548547000001 537.0071497 541.0097897 537.7391121) 541.464726 538.4710745 543.4464733 539.441817 544.4811147 540.2581689) 546.058796 541.5029904 555.2525702 546.4920563000001 561.02229 549.5037975) 568.8512605000001 553.5904476000001 590.0656953 540.2581689 569.1605565 532.4509617) 564.3058911 530.6379440000001 559.4198125 531.0977566 553.9651997000001 531.1904167) 553.9651997000001 531.1904167 550.4767069 531.1773881 547.6891806 531.8682744) 544.901653 532.5591594 543.4928846 533.8020244 543.4928846 533.8020244) ) (define mouth '(c (c (c (c (c (c (c (c (list 530.3825081 624.8174475999999) 529.8357567 642.0518830000001 526.7086002000001 660.0714209 541.2350134000001 674.0873449000001) 554.7779246 687.1543300000001 606.500931 685.9136516000001 616.7158422 677.6582174) 622.5516631 672.9418538 623.8581644 672.8068956 626.2762034000001 665.7037996) 629.1209817 657.3471409000001 629.7930453 640.794341 628.7099204 633.8217454999999) 626.9174921 622.2830235 623.5252162 618.0614178000001 608.730366 609.9951154) 592.4278472999999 601.1068164999999 559.9687647999999 597.7854491 541.2350134000001 608.5676621) 537.0079983999999 611.8666331000001 532.423811 617.5814994 531.4872312 619.4876088) 530.5506514000001 621.3937195000001 530.3825081 624.8174475999999 530.3825081 624.8174475999999) ) (define pupil-right '(c (c (c (c (c (c (c (c (list 694.6410012 480.4894443) 702.7281725 486.6306313 704.5088592000001 485.74652860000003 709.302669 484.8219452) 714.5669709 480.9252706 718.8114254 471.1940647 715.245229 464.9069631) 713.5099422000001 461.80377469999996 713.1270506000001 459.94486440000003 709.302669 459.5212724) 705.2104757 459.06801830000006 700.9194422 461.5279914 697.9441868 464.37392539999996) 694.8844639 467.300657 696.1858497 465.41279959999997 694.3116943 469.2095367) 694.3116943 469.2095367 693.4639721 470.1573238 692.9705779000001 472.0693261) 692.4771837 473.9813271 692.5120900000001 476.1368493 692.5120900000001 476.4381061) 692.5120900000001 477.1151929 694.6410012 480.4894443 694.6410012 480.4894443) ) (define pupil-left '(c (c (c (c (c (c (list 434.7202401 476.2379724) 436.1525112 488.5859964 463.4134618 493.19209010000003 460.52670130000007 474.65181640000003) 458.64369550000004 462.5581634 447.40152950000004 461.56959789999996 444.15327540000004 463.833024) 444.15327540000004 463.833024 440.10093100000006 465.2371839 437.6947857 467.74649850000003) 435.2886404 470.25581309999995 434.7202401 473.66322490000005 434.7202401 473.9937304) 434.7202401 474.3377858 434.5723794 474.8707182 434.5723794 475.21477230000005) 434.5723794 475.55882640000004 434.7202401 476.2379724 434.7202401 476.2379724) ) (define cheek-left '(c (c (c (c (c (c (list 336.35359769999997 558.3870472) 352.7528013 557.5145587 382.35983070000003 556.7395299 390.7815115 576.0367325) 395.5476807 586.9578024 396.77206620000004 627.8119326 381.7764518 631.7689662) 372.9863562 634.0884912 353.68657440000004 638.4666923 343.6097258 636.1895577) 309.3029624 628.4370246 316.95776539999997 579.3206352 333.8978093 559.5471932) 333.8978093 559.5471932 334.398256 558.9739127 334.970074 558.7035985) 335.541892 558.4332843 336.35359769999997 558.3870472 336.35359769999997 558.3870472) ) (define cheek-right '(c (c (c (c (c (c (c (c (list 760.4864653000001 568.725136) 757.3669203000001 575.7626769 752.7969393 587.5567618 752.6826264 596.6715649) 752.5868593 604.3075244 752.3651209 612.2330380999999 754.7494808000001 619.487822) 763.9661051 647.5308279000001 774.635261 641.7134384 795.6753554000001 641.7134384) 802.5927009000001 641.7134384 809.2698090000001 640.0911450000001 816.1252017 637.6205431000001) 836.6746774000001 630.2147577000001 834.6221633 571.8184873 812.6776212000001 562.5653863) 798.5941817 556.626985 786.0888161 560.8319689 770.9400968 562.5653863) 770.9400968 562.5653863 766.7382848999999 563.12744 765.4595451000001 563.9530427) 764.1808040000001 564.7786454 760.4864653000001 568.725136 760.4864653000001 568.725136) ) (define tongue '(c (c (c (c (c (c (c (c (c (list 554.0211699 623.2350226000001) 529.5714303 647.5699553 549.9474483 690.1872417 596.1384945 681.1908920000001) 622.5945306 676.0382107 626.0490570000001 671.0219215 626.0490570000001 643.0821291) 626.0490570000001 638.6569733000001 626.4530463000001 629.4068778999999 623.6708643000001 626.2249433) 622.3195208000001 621.5839342 619.3368658 620.9697128 613.7167812 616.1497145000001) 611.3118111 615.612236 605.9354011 612.8419672 599.3019652 611.4236165) 595.1686113000001 610.5398297 591.230767 610.9027572 584.0067501999999 611.4236165) 576.7827334000001 611.9444758 570.2751336 613.6324400000001 565.5128956000001 615.2934474000001) 565.5128956000001 615.2934474000001 562.6843985 616.2736565 559.8983282 617.8232682) 557.1122592 619.3728811999999 554.0211699 623.2350226000001 554.0211699 623.2350226000001) ) ;center the paths so that the tip of the ear lies at origin -> makes transforming later easier (define shift-p-x -158) (define shift-p-y -61) (define scale-p-x 1) (define scale-p-y 1) (define p-outline (map_elem p-outline shift-p-x shift-p-y scale-p-x scale-p-y)) (define p-yellow (map_elem p-yellow shift-p-x shift-p-y scale-p-x scale-p-y)) (define eye-left (map_elem eye-left shift-p-x shift-p-y scale-p-x scale-p-y)) (define eye-right (map_elem eye-right shift-p-x shift-p-y scale-p-x scale-p-y)) (define nose (map_elem nose shift-p-x shift-p-y scale-p-x scale-p-y)) (define mouth (map_elem mouth shift-p-x shift-p-y scale-p-x scale-p-y)) (define pupil-right (map_elem pupil-right shift-p-x shift-p-y scale-p-x scale-p-y)) (define pupil-left (map_elem pupil-left shift-p-x shift-p-y scale-p-x scale-p-y)) (define cheek-left (map_elem cheek-left shift-p-x shift-p-y scale-p-x scale-p-y)) (define cheek-right (map_elem cheek-right shift-p-x shift-p-y scale-p-x scale-p-y)) (define tongue (map_elem tongue shift-p-x shift-p-y scale-p-x scale-p-y)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)