From bf741ec7cd864fd7b213a6661a8d07c4680f4e7c Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Wed, 16 Jun 2021 18:08:40 -0700 Subject: [PATCH 01/38] Update playground link (#20) --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 709e3a9..94756f4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ Racketscript Playground ======================= -Playground -for [RacketScript](https://github.com/vishesh/racketscript). Visit -http://rapture.twistedplane.com:8080 to try. Both server-side and -client-side code is written in RacketScript. +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](COPYING.md) +[![Try Online](https://img.shields.io/badge/try_it-online!-ff9900.svg)]( http://play.racketscript.org:8080/) + +Playground for [RacketScript](https://github.com/vishesh/racketscript). +Both server-side and client-side code is written in RacketScript. Playground uses Github Gist to save and load files. The name of Gist file must be `source.rkt`. From 5c0ad2e32d5b1ea70f7b333720a4bb4c45f29efe Mon Sep 17 00:00:00 2001 From: Stephen Chang Date: Fri, 18 Jun 2021 18:56:03 -0400 Subject: [PATCH 02/38] add archery example (#21) * add archery example * restore archery github link --- examples/archery.rkt | 2095 ++++++++++++++++++++++++++++++++++++++++++ static/index.html | 1 + 2 files changed, 2096 insertions(+) create mode 100644 examples/archery.rkt diff --git a/examples/archery.rkt b/examples/archery.rkt new file mode 100644 index 0000000..89f90d6 --- /dev/null +++ b/examples/archery.rkt @@ -0,0 +1,2095 @@ +#lang racket + +;; NES Archery, by Jake Lawrence +;; https://github.com/jakelawrence24/Revamped-NES-Archery + +(require racketscript/htdp/image + racketscript/htdp/universe) + +;(define WOOT (bitmap/file "WOOT.png")) +;(define WWOOT (bitmap/file "WWOOT.png")) +;(define UWOOT (bitmap/file "UWOOT.png")) +;(define BWOOT (bitmap/file "BWOOT.png")) +;(define SB (bitmap/file "SB.png")) +;(define VSB (bitmap/file "VSB.png")) +;(define ASB (bitmap/file "ASB.png")) +;(define WSB (bitmap/file "WSB.png")) +;(define SSB (bitmap/file "SSB.png")) +;(define ARCHER-S (bitmap/file "ARCHER-S.png")) +;(define ARCHER (bitmap/file "ARCHER.png")) +;(define B-ARCHER-S (bitmap/file "B-ARCHER-S.png")) +;(define B-ARCHER (bitmap/file "B-ARCHER.png")) +;(define BLINKR (bitmap/file "BLINKR.png")) +;(define BLINKL (bitmap/file "BLINKL.png")) +;(define WUP (bitmap/file "WUP.png")) +;(define WDOWN (bitmap/file "WDOWN.png")) +;(define WEVEN (bitmap/file "WEVEN.png")) +;(define HITPOINT (bitmap/file "HITPOINT.png")) +;(define ARROW (bitmap/file "ARROW.png")) +;(define HT1 (bitmap/file "HT1.png")) +;(define HT2 (bitmap/file "HT2.png")) +;(define HT3 (bitmap/file "HT3.png")) +;(define HT4 (bitmap/file "HT4.png")) +;(define HT5 (bitmap/file "HT5.png")) +;(define HT6 (bitmap/file "HT6.png")) +;(define HT7 (bitmap/file "HT7.png")) +;(define SCOREBOARD (bitmap/file "SCOREBOARD.png")) +;(define SB1 (bitmap/file "SB1.png")) +;(define SB2 (bitmap/file "SB2.png")) +;(define CONTINUE (bitmap/file "CONTINUE.png")) +;(define EXIT (bitmap/file "EXIT.png")) +;(define STATS (bitmap/file "STATS.png")) +;(define HOWTO (bitmap/file "HOWTO.png")) +;(define NICE (bitmap/file "NICE.png")) +;(define QUALIFY (bitmap/file "QUALIFY.png")) +;(define NQUALIFYX (bitmap/file "NQUALIFYX.png")) +(define ARCHER (bitmap/url "http://i.imgur.com/PkCMNNn.png")) +(define ARCHER-S (bitmap/url "http://i.imgur.com/ZYwtHWV.png")) +(define ARROW (bitmap/url "http://i.imgur.com/YEOB1RP.png")) +(define ASB (bitmap/url "http://i.imgur.com/2SFORKH.png")) +(define B-ARCHER (bitmap/url "http://i.imgur.com/HV1y9rb.png")) +(define B-ARCHER-S (bitmap/url "http://i.imgur.com/2ME1Jzm.png")) +(define BLINKL (bitmap/url "http://i.imgur.com/Wk6pC5z.png")) +(define BLINKR (bitmap/url "http://i.imgur.com/m39poUR.png")) +(define BWOOT (bitmap/url "http://i.imgur.com/7mtVXF8.png")) +(define CONTINUE (bitmap/url "http://i.imgur.com/KZsZTj7.png")) +(define EXIT (bitmap/url "http://i.imgur.com/suuJYdf.png")) +(define HITPOINT (bitmap/url "http://i.imgur.com/7XrsoH5.png")) +(define HOWTO (bitmap/url "http://i.imgur.com/XLZi9a7.png")) +(define HT1 (bitmap/url "http://i.imgur.com/VEV3RB1.png")) +(define HT2 (bitmap/url "http://i.imgur.com/cqY2u2c.png")) +(define HT3 (bitmap/url "http://i.imgur.com/WlakuBI.png")) +(define HT4 (bitmap/url "http://i.imgur.com/zOYtSOI.png")) +(define HT5 (bitmap/url "http://i.imgur.com/QTOHnw9.png")) +(define HT6 (bitmap/url "http://i.imgur.com/m2LWx57.png")) +(define HT7 (bitmap/url "http://i.imgur.com/frndd5v.png")) +(define NICE (bitmap/url "http://i.imgur.com/chUPaJN.png")) +(define NQUALIFYX (bitmap/url "http://i.imgur.com/9COnA4D.png")) +(define QUALIFY (bitmap/url "http://i.imgur.com/BTHna0n.png")) +(define SB (bitmap/url "http://i.imgur.com/Nkf3QBN.png")) +(define SB1 (bitmap/url "http://i.imgur.com/9qh1LeG.png")) +(define SB2 (bitmap/url "http://i.imgur.com/h9UUJuj.png")) +(define SCOREBOARD (bitmap/url "http://i.imgur.com/Bu5imty.png")) +(define SSB (bitmap/url "http://i.imgur.com/hVv3oqK.png")) +(define STATS (bitmap/url "http://i.imgur.com/yYaNxFo.png")) +(define UWOOT (bitmap/url "http://i.imgur.com/RjvJYu9.png")) +(define VSB (bitmap/url "http://i.imgur.com/JoKhNd9.png")) +(define WDOWN (bitmap/url "http://i.imgur.com/ENK9DfL.png")) +(define WEVEN (bitmap/url "http://i.imgur.com/Zw0U6Pz.png")) +(define WOOT (bitmap/url "http://i.imgur.com/c5YGnGf.png")) +(define WSB (bitmap/url "http://i.imgur.com/N5qjeJF.png")) +(define WUP (bitmap/url "http://i.imgur.com/tKp6Znv.png")) +(define WWOOT (bitmap/url "http://i.imgur.com/3jGLSju.png")) + +(define-struct archer (x y timer)) + +(define ARCHER1(make-archer 105 400 0)) + +#|Template for archer +;archer-func: archer -> ... +;consumes an archer and produces ... +(define (archer-func a-archer) + (make-archer + (archer-x a-archer) + (archer-y a-archer) + (archer-timer a-archer) + ))|# + +(define-struct arrow (x y x-v y-v angle timer bounce-timer score increase?)) + +#|Template for arrow +;arrow-func: arrow -> ... +;consumes an arrow and produces ... +(define (arrow-func a-arrow) + (make-arrow + (arrow-x a-arrow) + (arrow-y a-arrow) + (arrow-x-v a-arrow) + (arrow-y-v a-arrow) + (arrow-angle a-arrow) + (arrrow-timer a-arrow) + (arrow-bounce-timer a-arrow) + (arrow-score a-arrow) + (arrow-increase? a-arrow) + ))|# + +#|Template for list of arrow +;define list-of-arrow-func: list-of-arrow -> ... +;consumes a list-of-arrow and produces ... +(define (list-of-arrow-func a-loa) + (cond + [(empty? a-loa)...] + [(cons? a-loa) + (arrow-func (first a-loa))(list-of-arrow-func (rest a-loa))]))|# + +(define ARROW1 (make-arrow 100 400 20 0 0 75 0 -1 false)) + +(define-struct target (x1 x2 x3 x4 x5 y tx ty dir timer)) + +#|Template for target +;target-func: target -> ... +;consumes a target and produces ... +(define (target-func a-target) + (make-target + (target-x1 a-target) + (target-x2 a-target) + (target-x3 a-target) + (target-x4 a-target) + (target-x5 a-target) + (target-y a-target) + (target-tx a-target) + (target-ty a-target) + (target-dir a-target) + (target-timer a-target)))|# + +(define TARGET1 (make-target 818 823 828 833 838 400 675 252 'up 0)) + +(define-struct blinks (timer on?)) + +#|Template for blinks +;blinks-func: blinks -> ... +;consumes a blinks and produces ... +(define (blinks-func a-blinks) + (make-blinks + (blinks-timer a-blinks) + (blinks-on? a-blinks) + ))|# + +(define BLINKS1(make-blinks 0 true)) + +(define-struct tg(x1 y1 x2 y2 x3 y3 x4 y4 x5 y5 x6 y6 x7 y7)) + +(define TG1 (make-tg 450 100 450 200 450 300 450 400 450 500 450 600 450 700)) + +#|TEMPLATE FOR TG +;tg-func: tg -> ? +;consumes a tg and produces ... +(define(tg-func a-tg) + (make-tg + (tg-x1 a-tg) + (tg-y1 a-tg) + (tg-x2 a-tg) + (tg-y2 a-tg) + (tg-x3 a-tg) + (tg-y3 a-tg) + (tg-x4 a-tg) + (tg-y4 a-tg) + (tg-x5 a-tg) + (tg-y5 a-tg) + (tg-x6 a-tg) + (tg-y6 a-tg) + (tg-x7 a-tg) + (tg-y7 a-tg) + )) +|# + +(define-struct score (t1 t2 t3 2-t1 2-t2 2-t3 try-try try-try-2 record total 2-total hs best-try total-q arrows-shot noc bulls nom p1w p2w)) + +#|Template for score +;score-func: score -> ... +;consumes a score and produces ... +(define (score-func a-score) + (make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +))|# + +(define INITIAL-SCORE (make-score 0 0 0 0 0 0 0 0 3500 0 0 0 0 0 0 0 0 0 0 0)) + +(define-struct world (archer loa target score count try turn atimer blinks wind stopped? r-t increase? cc how-to tg hub? stats? credits? how-to? how-too? 1p? 2p? start? pause? sure? slider-x gcount)) + +#|Template for World +;world-func: world -> ... +;consumes a world and produces ... +(define (world-func a-world) + (make-world + (world-archer a-world) + (world-loa a-world) + (world-target a-world) + (world-score a-world) + (world-count a-world) + (world-try a-world) + (world-turn a-world) + (world-atimer a-world) + (world-blinks a-world) + (world-wind a-world) + (world-stopped? a-world) + (world-r-t a-world) + (world-increase? a-world) + (world-cc a-world) + (world-how-to a-world) + (world-tg a-world) + (world-hub? a-world) + (world-stats? a-world) + (world-credits? a-world) + (world-how-to? a-world) + (world-how-too? a-world) + (world-1p? a-world) + (world-2p? a-world) + (world-start? a-world) + (world-pause? a-world) + (world-sure? a-world) + (world-slider-x a-world) + (world-gcount a-world) + )) +|# + +(define IW (make-world ARCHER1 empty TARGET1 INITIAL-SCORE 9 1 "p1" 0 BLINKS1 0 false (random 2) false 0 1 TG1 true false false false false false false false false false 420 2)) + +;draw-world: world -> scene +;consumes a world and draws it on the scene +(define (draw-world a-world) + (cond + [(game-over? a-world)(draw-game-over a-world (world-score a-world) (empty-scene 900 600))] + [(world-hub? a-world)(draw-hub a-world (empty-scene 900 600))] + [(world-how-to? a-world)(draw-how-to a-world (empty-scene 900 600))] + [(world-how-too? a-world)(draw-how-too a-world (empty-scene 900 600))] + [(world-stats? a-world)(draw-stats a-world (world-score a-world) (empty-scene 900 600))] + [(and(world-pause? a-world)(world-sure? a-world))(draw-sure a-world (empty-scene 900 600))] + [(world-credits? a-world)(draw-credits a-world (empty-scene 900 600))] + [(world-pause? a-world)(draw-pause a-world (empty-scene 900 600))] + [else(draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world (world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world (empty-scene 900 600)))))))))))])) + +;draw-hub: world scene -> scene +;consumes a world and a scene and draws it on the scene +(define (draw-hub a-world a-scene) + (place-image (text "Tutorial" 30 "white")450 370(place-image (text "Credits" 30 "white")450 540(place-image (text "Stats" 30 "white")450 455(place-image (text "2 Player" 30 "white")450 285(place-image (text "1 Player" 30 "white")450 200(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 540(place-image (rectangle 210 70 "solid""white")450 540(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 455(place-image (rectangle 210 70 "solid""white")450 455(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 370(place-image (rectangle 210 70 "solid""white")450 370(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 285(place-image (rectangle 210 70 "solid""white")450 285(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 200(place-image (rectangle 210 70 "solid""white")450 200(place-image WOOT 450 300 a-scene))))))))))))))))) + +;draw-how-to: world scene -> scene +;consumes a world and a scene and draws it on the scene +(define (draw-how-to a-world a-scene) + (place-image + (cond + [(eq?(world-how-to a-world)1)HT1] + [(eq?(world-how-to a-world)2)HT2] + [(eq?(world-how-to a-world)3)HT3] + [(eq?(world-how-to a-world)4)HT4] + [(eq?(world-how-to a-world)5)HT5] + [(eq?(world-how-to a-world)6)HT6] + [(eq?(world-how-to a-world)7)HT7] + )450 300 (place-image (text "X" 35 "white")20 20(place-image (rectangle 310 410 "solid"(make-color 205 71 72))450 300(place-image (rectangle 320 420 "solid""white")450 300(place-image(rotate 90 (triangle 20 "solid""white")) + (cond + [(not(=(world-how-to a-world)1))250] + [else 450])300(place-image(rotate 270 (triangle 20 "solid""white")) + (cond + [(not(=(world-how-to a-world)7))650] + [else 450])300(place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene)))))))))))))))))) + +;draw-how-too: world scene -> scene +;consumes a world and a scene and draws it on the scene +(define (draw-how-too a-world a-scene) + (place-image + (cond + [(eq?(world-how-to a-world)1)HT1] + [(eq?(world-how-to a-world)2)HT2] + [(eq?(world-how-to a-world)3)HT3] + [(eq?(world-how-to a-world)4)HT4] + [(eq?(world-how-to a-world)5)HT5] + [(eq?(world-how-to a-world)6)HT6] + [(eq?(world-how-to a-world)7)HT7] + )450 300(place-image (text "Back" 35 "white")69 37.5(place-image (rectangle 120 50 "solid"(make-color 205 71 72))70 35 (place-image (rectangle 130 60 "solid""white")70 35 (place-image (rectangle 310 410 "solid"(make-color 205 71 72))450 300(place-image (rectangle 320 420 "solid""white")450 300(place-image(rotate 90 (triangle 20 "solid""white")) + (cond + [(not(=(world-how-to a-world)1))250] + [else 450])300(place-image(rotate 270 (triangle 20 "solid""white")) + (cond + [(not(=(world-how-to a-world)7))650] + [else 450])300(cond + [(world-pause? a-world)(place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene)))))))))))] + [else (place-image WWOOT 450 300 a-scene)])))))))))) + +;draw-stats: world score scene -> scene +;consumes a world, a score, and a scene and draws certain aspects of each on the scene +(define (draw-stats a-world a-score a-scene) + (place-image (rectangle 300 30 "solid""black")(+ 148 (world-slider-x a-world))515(place-image(rectangle 2 5 "solid""black")(world-slider-x a-world) 535(place-image (circle 5 "solid""white")(world-slider-x a-world) 535(place-image (rectangle 105 3 "solid""gray")368 535(place-image (text "Back" 35 "white")69 37.5(place-image (rectangle 120 50 "solid"(make-color 203 72 72))70 35 (place-image (rectangle 130 60 "solid""white")70 35(place-image (text (number->string(score-hs a-score))18 "white")250 143.5(place-image (text (number->string(score-best-try a-score))18 "white")230 184(place-image (text (number->string(score-total-q a-score))18 "white")290 225.5(place-image (text (number->string(score-arrows-shot a-score))18 "white")270 267(place-image (text (number->string(score-noc a-score))18 "white")313 308(place-image (text (number->string(score-bulls a-score))18 "white")250 350(place-image (text (number->string(score-nom a-score))18 "white")315 390(place-image (text (number->string(score-p1w a-score))18 "white")275 432(place-image (text (number->string(score-p2w a-score))18 "white")275 473(place-image SCOREBOARD 450 330(cond + [(world-pause? a-world)(place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene)))))))))))] + [else(place-image WWOOT 450 300 a-scene)]) + )))))))))))))))))) + +;draw-credits: world scene -> scene +;consumes a world and a scene and draws it on the scene +(define (draw-credits a-world a-scene) + (place-image (text "Back" 35 "white")69 37.5(place-image SB1 450 330(place-image (rectangle 120 50 "solid"(make-color 203 72 72))70 35 (place-image (rectangle 130 60 "solid""white")70 35(place-image UWOOT 450 50(place-image BWOOT 450 581(place-image (text "Intro to Programming" 45 "white")(tg-x4(world-tg a-world))(tg-y4(world-tg a-world))(place-image (text "Medway Public Schools" 45 "white")(tg-x5(world-tg a-world))(tg-y5(world-tg a-world))(place-image (text "http://www.medwayschools.org/" 40 "white")(tg-x6(world-tg a-world)) (tg-y6(world-tg a-world))(place-image (text "http://www.racket-lang.org/" 40 "white")(tg-x7(world-tg a-world)) (tg-y7(world-tg a-world))(place-image (text "Developed with DrRacket" 45 "white")(tg-x3(world-tg a-world)) (tg-y3(world-tg a-world))(place-image (text "Taught by Mr. Nassiff" 45 "white")(tg-x2(world-tg a-world)) (tg-y2(world-tg a-world))(place-image (text "Made by Jake Lawrence" 45 "white")(tg-x1(world-tg a-world)) (tg-y1(world-tg a-world))(place-image SB2 450 330(place-image WWOOT 450 300 a-scene)))))))))))))))) + +;draw-pause: world scene -> scene +;consumes a world and a scene and draws it on the scene +(define (draw-pause a-world a-scene) + (place-image (text "TUTORIAL" 20 "white")450 264 (place-image (text "STATS" 20 "white")450 344(place-image (text "CONTINUE" 20 "white")450 184(place-image (text "EXIT" 20 "white")450 424(place-image HOWTO 380 264(place-image STATS 380 340(place-image EXIT 380 420(place-image CONTINUE 380 180(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 420(place-image (rectangle 210 70 "solid""white")450 420(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 180(place-image (rectangle 210 70 "solid""white")450 180(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 340(place-image (rectangle 210 70 "solid""white")450 340(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 260(place-image (rectangle 210 70 "solid""white")450 260(place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene)))))))))))))))))))))))))))) + +;draw-sure: world scene -> scene +;consumes a world and a scene and draws it on the scene +(define (draw-sure a-world a-scene) + (place-image (text "Any scores in this game will be lost." 50 "white")450 120(place-image (text "Are you sure you want to quit?" 50 "white")450 50(place-image (rectangle 810 150 "solid" (make-color 205 71 72))450 90(place-image (rectangle 820 160 "solid" "white")450 90(place-image (text "NO" 20 "white")450 360(place-image (text "YES" 20 "white")450 240(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 360(place-image (rectangle 210 70 "solid""white")450 360(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 240(place-image (rectangle 210 70 "solid""white")450 240(place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene)))))))))))))))))))))) + +;draw-game-over: world score scene -> scene +;consumes a world, a score, and a scene and draws a game over screen on the scene +(define (draw-game-over a-world a-score a-scene) + (cond + [(world-2p? a-world)(place-image(cond + [(<(score-total a-score)(score-2-total a-score))(text "Player 2 Wins!"50"white")] + [(>(score-total a-score)(score-2-total a-score))(text "Player 1 Wins!" 50 "white")] + [else(text "'Twas close, but it is a Tie!"50"white")]) + 450 75(place-image(cond + [(<(score-total a-score)(score-2-total a-score))(text "Good Job Player 2!"50"white")] + [(>(score-total a-score)(score-2-total a-score))(text "Good Job Player 1!" 50 "white")] + [else(text "How about a Tiebreaker?" 50 "white")] + )450 150(place-image (text (number->string(world-gcount a-world)) 50 "blue")100 100(place-image (rectangle 700 150 "solid"(make-color 205 71 72))450 112.5(place-image (rectangle 710 160 "solid""white")450 112.5(place-image (text "REMATCH?" 20 "white")450 275(place-image (text "MENU" 20 "white")450 375(place-image(rectangle 200 60 "solid"(make-color 205 71 72))450 275 (place-image (rectangle 210 70 "solid""white")450 275(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 375 (place-image (rectangle 210 70 "solid""white")450 375 (place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene))))))))))))))))))))))] + [(world-1p? a-world)(place-image(cond + [(<(score-try-try a-score)2500)(text "Better luck next time!"50"white")] + [(>=(score-try-try a-score)2500)(text "Congratulations!" 50 "white")]) + 450 75(place-image(cond + [(<(score-try-try a-score)2500)(text "Practice Makes Perfect!"50"white")] + [(>=(score-try-try a-score)2500)(text "You Qualified for the Olympics!" 50 "white")])450 150(place-image (rectangle 700 150 "solid"(make-color 205 71 72))450 112.5(place-image (rectangle 710 160 "solid""white")450 112.5(place-image (text "AGAIN?" 20 "white")450 275(place-image (text "MENU" 20 "white")450 375(place-image(rectangle 200 60 "solid"(make-color 205 71 72))450 275 (place-image (rectangle 210 70 "solid""white")450 275(place-image (rectangle 200 60 "solid"(make-color 205 71 72))450 375 (place-image (rectangle 210 70 "solid""white")450 375 (place-image (rectangle 900 600 "solid"(color 0 0 0 107)) 450 300 (draw-score (world-score a-world) a-world(draw-hitpoints-list (world-target a-world)(world-loa a-world)(draw-wind a-world (draw-archer a-world(world-archer a-world)(draw-blinks-try (world-blinks a-world) a-world(draw-arrow-count a-world(draw-blinks (world-blinks a-world)(draw-target (world-target a-world)(draw-loa (world-loa a-world)(world-target a-world)(draw-backround a-world a-scene)))))))))))))))))))))])) + +;draw-backround: world -> scene +;consumes a world and draws the backround on the scene +(define (draw-backround a-world a-scene) + (place-image (rectangle 5 15 "solid""white")882 22.5(place-image (rectangle 5 15 "solid""white")873 22.5(place-image (rectangle 30 30 "solid"(make-color 205 71 72))877.5 22.5(place-image (rectangle 40 40 "solid""white")877.5 22.5(place-image (text"0"37 "white")(+ 601(* 1 .5))563 (place-image (text "2500" 18 "white") 698 105(place-image SSB 600 550(place-image WSB 350 550(place-image (text "0.00" 38 "white")411.5 266(place-image ASB 350 265(place-image VSB 150 290(place-image SB 450 100(place-image (rectangle 900 10 "solid""black")450 205(place-image (rectangle 7 400 "solid""white")100 400(place-image (rectangle 30 400 "solid""black")825 400(place-image (rectangle 900 200 "solid""aqua")450 100(place-image (rectangle 900 400 "solid""YellowGreen") 450 400 a-scene)))))))))))))))))) + +;draw-target: target -> scene +;consumes a target and draws it on the scene +(define (draw-target a-target a-scene) + (place-image (circle 10 "solid""yellow") (target-tx a-target) (target-ty a-target)(place-image (circle 20 "solid""red") (target-tx a-target) (target-ty a-target)(place-image (circle 32.5 "solid""white") (target-tx a-target) (target-ty a-target)(place-image (circle 45 "solid""blue") (target-tx a-target) (target-ty a-target)(place-image (rectangle 105 105 "solid""gray") (target-tx a-target) (target-ty a-target)(place-image (rectangle 5 20 "solid""yellow")(target-x1 a-target) (target-y a-target)(place-image (rectangle 5 40 "solid""red")(target-x2 a-target) (target-y a-target)(place-image (rectangle 5 65 "solid""white")(target-x3 a-target) (target-y a-target)(place-image (rectangle 5 90 "solid""blue")(target-x4 a-target) (target-y a-target)(place-image (rectangle 5 105 "solid""gray")(target-x5 a-target) (target-y a-target) a-scene))))))))))) + +;draw-hitpoints: target arrow -> scene +;consumes a target and a arrow and draws the hitpoints on the scene +(define (draw-hitpoints a-target a-arrow a-scene) + (cond + [(and (<(target-timer a-target)5)(collision? a-arrow a-target))(place-image HITPOINT (- (target-tx a-target)(-(target-y a-target)(arrow-y a-arrow)))(-(+ (target-ty a-target)52.5) (* 10.5 (arrow-angle a-arrow)))a-scene)] + [else a-scene])) + +;draw-hitpoints-list: target loa -> scene +;consumes a target and a loa and draws the hitpoints on the scene +(define (draw-hitpoints-list a-target a-loa a-scene) + (cond + [(empty? a-loa)a-scene] + [(cons? a-loa) + (draw-hitpoints a-target (first a-loa)(draw-hitpoints-list a-target (rest a-loa)a-scene))])) + +;draw-arrow-count: world scene -> scene +;consumes a world and a scene and draws the arrow count on the scene +(define (draw-arrow-count a-world a-scene) + (cond + [(or(and(world-2p? a-world)(eq? (world-try a-world)7))(and(world-1p? a-world)(eq? (world-try a-world)4)))a-scene] + [(eq? (world-count a-world) 9)(place-image ARROW 151 252 (place-image ARROW 151 262 (place-image ARROW 151 272 (place-image ARROW 151 282(place-image ARROW 151 292(place-image ARROW 151 302(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene)))))))))] + [(eq? (world-count a-world) 8)(place-image ARROW 151 262 (place-image ARROW 151 272 (place-image ARROW 151 282(place-image ARROW 151 292(place-image ARROW 151 302(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene))))))))] + [(eq? (world-count a-world) 7)(place-image ARROW 151 272 (place-image ARROW 151 282(place-image ARROW 151 292(place-image ARROW 151 302(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene)))))))] + [(eq? (world-count a-world) 6)(place-image ARROW 151 282(place-image ARROW 151 292(place-image ARROW 151 302(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene))))))] + [(eq? (world-count a-world) 5)(place-image ARROW 151 292(place-image ARROW 151 302(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene)))))] + [(eq? (world-count a-world) 4)(place-image ARROW 151 302(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene))))] + [(eq? (world-count a-world) 3)(place-image ARROW 151 312(place-image ARROW 151 322(place-image ARROW 151 332 a-scene)))] + [(eq? (world-count a-world) 2)(place-image ARROW 151 322(place-image ARROW 151 332 a-scene))] + [(eq? (world-count a-world) 1)(place-image ARROW 151 332 a-scene)] + [else a-scene])) + +(define (trim x) + (/ (round (* 100 x)) 100)) + +;draw-arrow: arrow target scene -> scene +;consumes a arrow, a target and a scene and draws the arrows on the scene +(define (draw-arrow a-arrow a-target a-scene) + (cond + [(=(arrow-score a-arrow)600)(place-image NICE 640 498(place-image (text (cond + [(=(arrow-angle a-arrow)0)"0.00"] + [(=(arrow-angle a-arrow)4.9)"4.90"] + [(=(arrow-angle a-arrow)5)"5.00"] + [(=(arrow-angle a-arrow)9.9)"9.90"] + [(>=(arrow-angle a-arrow)10)"10.00"] + [else(number->string(trim(arrow-angle a-arrow)))])38 "white")(+ 410(*(string-length(number->string(exact->inexact(arrow-angle a-arrow)))).5)) 266(place-image (rectangle 97 40 "solid""black")412 265(place-image ARROW (arrow-x a-arrow)(arrow-y a-arrow) (cond + [(and (>(arrow-bounce-timer a-arrow)5)(>=(arrow-score a-arrow)0))(place-image (text(number->string(round(arrow-score a-arrow)))37 "white")(+ 601(*(string-length(number->string(arrow-score a-arrow))).5))563 a-scene)] + [else a-scene])))))] + [(or (>(arrow-x a-arrow)920)(collision? a-arrow a-target))(place-image (text (cond + [(=(arrow-angle a-arrow)0)"0.00"] + [(=(arrow-angle a-arrow)5)"5.00"] + [(=(arrow-angle a-arrow)9.9)"9.90"] + [(>=(arrow-angle a-arrow)10)"10.00"] + [else(number->string(trim(arrow-angle a-arrow)))])38 "white")(+ 410(*(string-length(number->string(exact->inexact(arrow-angle a-arrow)))).5)) 266(place-image (rectangle 97 40 "solid""black")412 265(place-image (rectangle 100 10 "solid""black")890 205(place-image (rectangle 100 400 "solid""yellowgreen")890 400(place-image ARROW (arrow-x a-arrow)(arrow-y a-arrow) (cond + [(and (>(arrow-bounce-timer a-arrow)5)(>=(arrow-score a-arrow)0))(place-image (text(number->string(round(arrow-score a-arrow)))37 "white")(+ 601(*(string-length(number->string(arrow-score a-arrow))).5))563 a-scene)] + [else a-scene]))))))] + [(=(arrow-score a-arrow)600)(place-image NICE 450 300(place-image (text (cond + [(=(arrow-angle a-arrow)0)"0.00"] + [(=(arrow-angle a-arrow)4.9)"4.90"] + [(=(arrow-angle a-arrow)5)"5.00"] + [(=(arrow-angle a-arrow)9.9)"9.90"] + [(>=(arrow-angle a-arrow)10)"10.00"] + [else(number->string(trim(arrow-angle a-arrow)))])38 "white")(+ 410(*(string-length(number->string(exact->inexact(arrow-angle a-arrow)))).5)) 266(place-image (rectangle 97 40 "solid""black")412 265(place-image ARROW (arrow-x a-arrow)(arrow-y a-arrow) (cond + [(and (>(arrow-bounce-timer a-arrow)5)(>=(arrow-score a-arrow)0))(place-image (text(number->string(round(arrow-score a-arrow)))37 "white")(+ 601(*(string-length(number->string(arrow-score a-arrow))).5))563 a-scene)] + [else a-scene])))))] + [else(place-image (text (cond + [(=(arrow-angle a-arrow)0)"0.00"] + [(=(arrow-angle a-arrow)4.9)"4.90"] + [(=(arrow-angle a-arrow)5)"5.00"] + [(=(arrow-angle a-arrow)9.9)"9.90"] + [(>=(arrow-angle a-arrow)10)"10.00"] + [else(number->string(trim(arrow-angle a-arrow)))])38 "white")(+ 410(*(string-length(number->string(exact->inexact(arrow-angle a-arrow)))).5)) 266(place-image (rectangle 97 40 "solid""black")412 265(place-image ARROW (arrow-x a-arrow)(arrow-y a-arrow) (cond + [(and (>(arrow-bounce-timer a-arrow)5)(>=(arrow-score a-arrow)0))(place-image (text(number->string(round(arrow-score a-arrow)))37 "white")(+ 601(*(string-length(number->string(arrow-score a-arrow))).5))563 a-scene)] + [else a-scene]))))])) +;draw-arrow-block: arrow scene -> scene +;consumes a arrow and a scene and draws the arrow-block on the scene +(define (draw-arrow-block a-arrow a-scene) + (cond + [(>=(arrow-score a-arrow)0)(place-image (rectangle 74 32 "solid""black")600 560 a-scene)] + [else a-scene])) + +;draw-loa: loa target scene -> scene +;consumes a loa, target, and a scene and drawsw the arrows on the scene +(define (draw-loa a-loa a-target a-scene) + (cond + [(empty? a-loa)a-scene] + [(cons? a-loa) + (draw-arrow (first a-loa)a-target(draw-arrow-block (first a-loa) (draw-loa (rest a-loa) a-target a-scene)))])) + +;draw-blinks: blinks scene -> scene +;consumes a blinks and a scene and draws the blinks on the scene +(define (draw-blinks a-blinks a-scene) + (cond + [(blinks-on? a-blinks)(place-image BLINKR 150 150 a-scene)] + [else a-scene])) + +(define (draw-blinks-try a-blinks a-world a-scene) + (cond + [(and(blinks-on? a-blinks)(or(and(world-2p? a-world)(or (eq?(world-try a-world)2)(eq? (world-try a-world) 1)))(and(world-1p? a-world)(eq? (world-try a-world) 1))))(place-image BLINKL 800 127 a-scene)] + [(and(blinks-on? a-blinks)(or(and(world-2p? a-world)(or (eq?(world-try a-world)3)(eq? (world-try a-world) 4)))(and(world-1p? a-world)(eq? (world-try a-world) 2))))(place-image BLINKL 800 142 a-scene)] + [(and(blinks-on? a-blinks)(or(and(world-2p? a-world)(or (eq?(world-try a-world)5)(eq? (world-try a-world) 6)))(and(world-1p? a-world)(eq? (world-try a-world) 3))))(place-image BLINKL 800 159 a-scene)] + + [else a-scene])) + +;draw-archer: world archer scene -> scene +;consumes a world, an archer, and a scene and draws the archer on the scene +(define (draw-archer a-world a-archer a-scene) + (cond + [(and(or (world-1p? a-world)(and (world-2p? a-world)(or (=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))))(not(eq?(world-atimer a-world)0)))(place-image ARCHER-S (-(archer-x a-archer)3)(archer-y a-archer)a-scene)] + [(or (world-1p? a-world)(and (world-2p? a-world)(or (=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5)))) (place-image ARCHER (archer-x a-archer)(archer-y a-archer) a-scene)] + [(and(or (world-1p? a-world)(and (world-2p? a-world)(or (=(world-try a-world)2)(=(world-try a-world)4)(>=(world-try a-world)6))))(not(eq?(world-atimer a-world)0)))(place-image B-ARCHER-S (-(archer-x a-archer)3)(archer-y a-archer)a-scene)] + [(or (world-1p? a-world)(and (world-2p? a-world)(or (=(world-try a-world)2)(=(world-try a-world)4)(>=(world-try a-world)6)))) (place-image B-ARCHER (archer-x a-archer)(archer-y a-archer) a-scene)] +[else a-scene])) + +;draw-wind: world -> scene +;consumes a world and draws the amount of wind on the scene +(define (draw-wind a-world a-scene) + (cond + [(<(world-wind a-world)0)(place-image WDOWN 385 552(place-image (text (number->string(abs(world-wind a-world))) 35 "white")410 552 a-scene))] + [(eq?(world-wind a-world)0)(place-image WEVEN 385 549(place-image (text (number->string(abs(world-wind a-world))) 35 "white")410 552 a-scene))] + [else(place-image WUP 385 548(place-image (text (number->string(abs(world-wind a-world))) 35 "white")410 552 a-scene))])) + +;draw-score: score world scene -> scene +;consumes a score, a world, and a scene and draws the score on the scene +(define (draw-score a-score a-world a-scene) + (cond + [(world-1p? a-world)(cond + [(>=(world-try a-world)3)(place-image (text (number->string(score-try-try a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t3 a-score))18 "white")(+ 696(*(string-length(number->string(score-t3 a-score))).5)) 162(place-image(text (number->string(score-t2 a-score))18 "white")(+ 696(*(string-length(number->string(score-t2 a-score))).5)) 144(place-image(text (number->string(score-t1 a-score))18 "white")(+ 696(*(string-length(number->string(score-t1 a-score))).5)) 127 a-scene))))))))] + [(>=(world-try a-world)2)(place-image (text (number->string(score-try-try a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t2 a-score))18 "white")(+ 696(*(string-length(number->string(score-t2 a-score))).5)) 144(place-image(text (number->string(score-t1 a-score))18 "white")(+ 696(*(string-length(number->string(score-t1 a-score))).5)) 127 a-scene)))))))] + [(>=(world-try a-world)1)(place-image (text (number->string(score-try-try a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t1 a-score))18 "white")(+ 696(*(string-length(number->string(score-t1 a-score))).5)) 127 a-scene))))))] +)] + [(world-2p? a-world) + (cond + [(=(world-try a-world)1)(place-image(text "1P" 30 "white")73 150(place-image (rectangle 37 30 "solid""black")70 150(place-image (text (number->string(score-try-try a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59 (place-image (text "P2" 14 "white")646 106(place-image (text "P1" 14 "white")595 106(place-image (rectangle 95 2 "solid""white")620.5 115(place-image (rectangle 2 65 "solid""white")620.5 137(place-image(text (number->string(score-2-total a-score))18 "white")290 107(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t1 a-score))18 "white")595 127 a-scene)))))))))))))] + [(=(world-try a-world)2)(place-image(text "2P" 30 "white")73 150(place-image (rectangle 37 30 "solid""black")70 150(place-image (text (number->string(score-try-try-2 a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try-2 a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59 (place-image (text "P2" 14 "white")646 106(place-image (text "P1" 14 "white")595 106(place-image (rectangle 95 2 "solid""white")620.5 115(place-image (text (number->string(score-2-t1 a-score))18 "white")646 127(place-image (rectangle 2 65 "solid""white")620.5 137(place-image(text (number->string(score-2-total a-score))18 "white")290 107(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t1 a-score))18 "white")595 127 a-scene))))))))))))))] + [(=(world-try a-world)3)(place-image(text "1P" 30 "white")73 150(place-image (rectangle 37 30 "solid""black")70 150(place-image (text (number->string(score-try-try a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59 (place-image (text "P2" 14 "white")646 106(place-image (text "P1" 14 "white")595 106(place-image (rectangle 95 2 "solid""white")620.5 115(place-image (text (number->string(score-2-t1 a-score))18 "white")646 127(place-image (rectangle 2 65 "solid""white")620.5 137(place-image(text (number->string(score-t2 a-score))18 "white")595 144 (place-image(text (number->string(score-2-total a-score))18 "white")290 107(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t1 a-score))18 "white")595 127 a-scene)))))))))))))))] + [(=(world-try a-world)4)(place-image(text "2P" 30 "white")73 150(place-image (rectangle 37 30 "solid""black")70 150(place-image (text (number->string(score-try-try-2 a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try-2 a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59 (place-image (text "P2" 14 "white")646 106(place-image (text "P1" 14 "white")595 106(place-image (rectangle 95 2 "solid""white")620.5 115(place-image (text (number->string(score-2-t1 a-score))18 "white")646 127(place-image (rectangle 2 65 "solid""white")620.5 137(place-image(text (number->string(score-2-t2 a-score))18 "white")646 144 (place-image(text (number->string(score-t2 a-score))18 "white")595 144 (place-image(text (number->string(score-2-total a-score))18 "white")290 107(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t1 a-score))18 "white")595 127 a-scene))))))))))))))))] + [(=(world-try a-world)5)(place-image(text "1P" 30 "white")73 150(place-image (rectangle 37 30 "solid""black")70 150(place-image (text (number->string(score-try-try a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59 (place-image (text "P2" 14 "white")646 106(place-image (text "P1" 14 "white")595 106(place-image (rectangle 95 2 "solid""white")620.5 115(place-image (text (number->string(score-2-t1 a-score))18 "white")646 127(place-image (rectangle 2 65 "solid""white")620.5 137(place-image(text (number->string(score-2-t2 a-score))18 "white")646 144 (place-image(text (number->string(score-t3 a-score))18 "white")595 162 (place-image(text (number->string(score-t2 a-score))18 "white")595 144 (place-image(text (number->string(score-2-total a-score))18 "white")290 107(place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t1 a-score))18 "white")595 127 a-scene)))))))))))))))))] + [(>=(world-try a-world)6)(place-image(text "1P" 30 "white")73 150(place-image (rectangle 37 30 "solid""black")70 150(place-image (text (number->string(score-try-try-2 a-score)) 24 "white")290 153(place-image (cond + [(>=(score-try-try-2 a-score)2500)QUALIFY] + [else NQUALIFYX])350 153 (place-image (text (number->string(score-record a-score))24 "white")617 70(place-image (text (number->string (score-hs a-score)) 18 "white")290 59(place-image (text "P2" 14 "white")646 106(place-image (text "P1" 14 "white")595 106(place-image (rectangle 95 2 "solid""white")620.5 115(place-image (rectangle 2 65 "solid""white")620.5 137(place-image(text (number->string(score-2-total a-score))18 "white")290 107(place-image (text (number->string (score-2-t3 a-score)) 18 "white")646 162(place-image (text (number->string (score-2-t2 a-score)) 18 "white")646 144 (place-image(text (number->string(score-2-t1 a-score))18 "white")646 127 (place-image(text (number->string(score-total a-score))18 "white")290 83(place-image(text (number->string(score-t3 a-score))18 "white")595 162 (place-image(text (number->string(score-t2 a-score))18 "white")595 144 (place-image(text (number->string(score-t1 a-score))18 "white")595 127 a-scene))))))))))))))))))])] + [else a-scene])) + +;update-world: world -> world +;consumes a world and updates it accordingly +(define (update-world a-world) + (cond + [(game-over? a-world)(make-world + (world-archer a-world) + (world-loa a-world) + (world-target a-world) + (update-score-game-over(world-score a-world)a-world) + (world-count a-world) + (world-try a-world) + (world-turn a-world) + (world-atimer a-world) + (world-blinks a-world) + (world-wind a-world) + (world-stopped? a-world) + (world-r-t a-world) + (world-increase? a-world) + (world-cc a-world) + (world-how-to a-world) + (world-tg a-world) + (world-hub? a-world) + (world-stats? a-world) + (world-credits? a-world) + (world-how-to? a-world) + (world-how-too? a-world) + (world-1p? a-world) + (world-2p? a-world) + (world-start? a-world) + (world-pause? a-world) + (world-sure? a-world) + (world-slider-x a-world) + (cond + [(=(world-gcount a-world)0)0] + [else(-(world-gcount a-world)1)]) + )] + [(world-credits? a-world)(make-world + (world-archer a-world) + (world-loa a-world) + (world-target a-world) + (world-score a-world) + (world-count a-world) + (world-try a-world) + (world-turn a-world) + (world-atimer a-world) + (world-blinks a-world) + (world-wind a-world) + (world-stopped? a-world) + (world-r-t a-world) + (world-increase? a-world) + (world-cc a-world) + (world-how-to a-world) + (update-tg(world-tg a-world)) + (world-hub? a-world) + (world-stats? a-world) + (world-credits? a-world) + (world-how-to? a-world) + (world-how-too? a-world) + (world-1p? a-world) + (world-2p? a-world) + (world-start? a-world) + (world-pause? a-world) + (world-sure? a-world) + (world-slider-x a-world) + (world-gcount a-world) + )] + [(world-start? a-world) + (make-world + (update-archer(world-archer a-world)) + (update-loa(world-loa a-world)(world-target a-world)a-world) + (update-target(world-target a-world) a-world) + (update-score-list(world-score a-world)(world-loa a-world)a-world) + (cond + [(and (world-1p? a-world)(eq?(world-try a-world)4))0] + [(and (world-2p? a-world)(eq?(world-try a-world)7))0] + [(and(eq? (world-count a-world)0)(eq?(world-atimer a-world)0))9] + [else(world-count a-world)]) + (cond + [(and(eq? (world-count a-world)0)(eq?(world-atimer a-world)0)(or(and (world-2p? a-world)(not(eq?(world-try a-world)7)))(and (world-1p? a-world)(not(eq?(world-try a-world)4)))))(+(world-try a-world)1)] + [else(world-try a-world)]) + (world-turn a-world) + (cond + [(eq? (world-atimer a-world)0)0] + [(and (world-1p? a-world)(eq?(world-try a-world)4))0] + [(and (world-2p? a-world)(eq?(world-try a-world)7))0] + [else(-(world-atimer a-world)1)]) + (update-blinks(world-blinks a-world)) + (cond + [(world-stopped? a-world)(world-wind a-world)] + [else(cond + [(eq? (world-r-t a-world)1)(random 10)] + [(eq? (world-r-t a-world)0)(* -1(random 10))])]) + (cond + [(and(=(world-count a-world)0)(eq?(world-atimer a-world)0))false] + [else(world-stopped? a-world)]) + (random 2) + (world-increase? a-world) + (cond + [(eq?(world-atimer a-world)0)0] + [else (world-cc a-world)]) + (world-how-to a-world) + (world-tg a-world) + (world-hub? a-world) + (world-stats? a-world) + (world-credits? a-world) + (world-how-to? a-world) + (world-how-too? a-world) + (world-1p? a-world) + (world-2p? a-world) + (world-start? a-world) + (world-pause? a-world) + (world-sure? a-world) + (world-slider-x a-world) + (world-gcount a-world) + )] + [else a-world])) + +;update-tg: tg -> tg +;consumes a tg and updates it accordingly +(define(update-tg a-tg) + (make-tg + (tg-x1 a-tg) + (cond + [(<(tg-y1 a-tg)-50)650] + [else(-(tg-y1 a-tg)5)]) + (tg-x2 a-tg) + (cond + [(<(tg-y2 a-tg)-50)650] + [else(-(tg-y2 a-tg)5)]) + (tg-x3 a-tg) + (cond + [(<(tg-y3 a-tg)-50)650] + [else(-(tg-y3 a-tg)5)]) + (tg-x4 a-tg) + (cond + [(<(tg-y4 a-tg)-50)650] + [else(-(tg-y4 a-tg)5)]) + (tg-x5 a-tg) + (cond + [(<(tg-y5 a-tg)-50)650] + [else(-(tg-y5 a-tg)5)]) + (tg-x6 a-tg) + (cond + [(<(tg-y6 a-tg)-50)650] + [else(-(tg-y6 a-tg)5)]) + (tg-x7 a-tg) + (cond + [(<(tg-y7 a-tg)-50)650] + [else(-(tg-y7 a-tg)5)]) + )) + +;update-target: target world -> target +;consumes a target and a world and updates the target accoringly +(define (update-target a-target a-world) + (make-target + (target-x1 a-target) + (target-x2 a-target) + (target-x3 a-target) + (target-x4 a-target) + (target-x5 a-target) + (cond + [(eq? (target-dir a-target)'down)(+(target-y a-target)4)] + [(eq? (target-dir a-target)'up)(-(target-y a-target)4)] + ) + (target-tx a-target) + (target-ty a-target) + (cond + [(<= (target-y a-target)265)'down] + [(>= (target-y a-target)550)'up] + [else(target-dir a-target)]) + (cond + [(eq? (target-timer a-target)10)1] + [else(+(target-timer a-target)1)]) + )) + +;update-score: score arrow world -> score +;consumes a score, an arrow, and a world an updates the score accordingly +(define (update-score a-score a-arrow a-world) + (make-score + (cond + [(and(eq?(arrow-timer a-arrow)1)(world-1p? a-world)(eq?(world-try a-world)1))(+(score-t1 a-score)(arrow-score a-arrow))] + [(and(eq?(arrow-timer a-arrow)1)(world-2p? a-world)(eq?(world-try a-world)1))(+(score-t1 a-score)(arrow-score a-arrow))] + [else (score-t1 a-score)]) + (cond + [(and(eq?(arrow-timer a-arrow)1)(world-1p? a-world)(eq?(world-try a-world)2))(+(score-t2 a-score)(arrow-score a-arrow))] + [(and(eq?(arrow-timer a-arrow)1)(world-2p? a-world)(eq?(world-try a-world)3))(+(score-t2 a-score)(arrow-score a-arrow))] + [else (score-t2 a-score)]) + (cond + [(and(eq?(arrow-timer a-arrow)1)(world-1p? a-world)(eq?(world-try a-world)3))(+(score-t3 a-score)(arrow-score a-arrow))] + [(and(eq?(arrow-timer a-arrow)1)(world-2p? a-world)(eq?(world-try a-world)5))(+(score-t3 a-score)(arrow-score a-arrow))] + [else (score-t3 a-score)]) + (cond + [(and(eq?(arrow-timer a-arrow)1)(world-2p? a-world)(eq?(world-try a-world)2))(+(score-2-t1 a-score)(arrow-score a-arrow))] + [else (score-2-t1 a-score)]) + (cond + [(and(eq?(arrow-timer a-arrow)1)(world-2p? a-world)(eq?(world-try a-world)4))(+(score-2-t2 a-score)(arrow-score a-arrow))] + [else (score-2-t2 a-score)]) + (cond + [(and(eq?(arrow-timer a-arrow)1)(world-2p? a-world)(eq?(world-try a-world)6))(+(score-2-t3 a-score)(arrow-score a-arrow))] + [else (score-2-t3 a-score)]) + (score-try-try a-score) + (score-try-try-2 a-score) + (cond + [(>(score-t1 a-score)(score-record a-score))(score-t1 a-score)] + [(>(score-t2 a-score)(score-record a-score))(score-t2 a-score)] + [(>(score-t3 a-score)(score-record a-score))(score-t3 a-score)] + [else (score-record a-score)]) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (+(score-2-t1 a-score)(score-2-t2 a-score)(score-2-t3 a-score)) + (cond + [(>(score-total a-score)(score-hs a-score))(score-total a-score)] + [(>(score-2-total a-score)(score-hs a-score))(score-2-total a-score)] + [else(score-hs a-score)]) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (cond + [(and (world-2p? a-world)(game-over? a-world)(=(world-gcount a-world)2)(>(score-2-total a-score)(score-total a-score)))40] + [else(score-p2w a-score)]) + )) + +;update-score-game-over: score world -> score +;consumes a score and a world and updates the score accordingly +(define (update-score-game-over a-score a-world) + (make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (cond + [(and (=(world-gcount a-world)1)(or(>=(score-t1 a-score)2500)(>=(score-t2 a-score)2500)(>=(score-t3 a-score)2500)(>=(score-2-t1 a-score)2500)(>=(score-2-t2 a-score)2500)(>=(score-2-t3 a-score)2500)))(+(score-total-q a-score)1)] + [else(score-total-q a-score)]) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (cond + [(and (world-2p? a-world)(=(world-gcount a-world)1)(>(score-total a-score)(score-2-total a-score)))(+(score-p1w a-score)1)] + [else(score-p1w a-score)]) + (cond + [(and (world-2p? a-world)(=(world-gcount a-world)1)(>(score-2-total a-score)(score-total a-score)))(+(score-p2w a-score)1)] + [else(score-p2w a-score)]) + )) + + +;update-score-list: score loa world -> score +;consumes a score, a loa, and a world and updates the score accordingly +(define (update-score-list a-score a-loa a-world) + (cond + [(empty? a-loa)a-score] + [(cons? a-loa) + (cond + [(and(=(world-atimer a-world)7)(> (score-t1 a-score)(score-best-try a-score)))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-t1 a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)] + [(and(=(world-atimer a-world)7)(> (score-t2 a-score)(score-best-try a-score)))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-t2 a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)] + [(and(=(world-atimer a-world)7)(> (score-t3 a-score)(score-best-try a-score)))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-t3 a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)] + + [(and(=(world-atimer a-world)7)(> (score-2-t1 a-score)(score-best-try a-score)))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-t1 a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)] + + [(and(=(world-atimer a-world)7)(> (score-2-t2 a-score)(score-best-try a-score)))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-t2 a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)] + + [(and(=(world-atimer a-world)7)(> (score-2-t3 a-score)(score-best-try a-score)))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-t3 a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)] + [(and(world-1p? a-world)(>(+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score))(score-hs a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))1))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-1p? a-world)(>(score-t1 a-score)(score-record a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-t1 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-1p? a-world)(>(score-t2 a-score)(score-record a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-t2 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-1p? a-world)(>(score-t3 a-score)(score-record a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-t3 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-1p? a-world)(>(score-t1 a-score)(score-try-try a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-t1 a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-1p? a-world)(>(score-t2 a-score)(score-try-try a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-t2 a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-1p? a-world)(>(score-t3 a-score)(score-try-try a-score))(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-t3 a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and(world-1p? a-world)(or(=(world-try a-world)1)(=(world-try a-world)2)(=(world-try a-world)3))(=(arrow-timer(first a-loa))1))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(score-2-t1 a-score)(score-record a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-2-t1 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(score-2-t2 a-score)(score-record a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-2-t2 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(score-2-t3 a-score)(score-record a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-2-t3 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and(world-2p? a-world)(>(+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score))(score-hs a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))1))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and(world-2p? a-world)(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))1))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(+(score-2-t1 a-score)(score-2-t2 a-score)(score-2-t3 a-score))(score-hs a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))1))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (+(score-2-t1 a-score)(score-2-t2 a-score)(score-2-t3 a-score)) + (+(score-2-t1 a-score)(score-2-t2 a-score)(score-2-t3 a-score)) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))1))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (+(score-2-t1 a-score)(score-2-t2 a-score)(score-2-t3 a-score)) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(score-t1 a-score)(score-record a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-t1 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(score-t2 a-score)(score-record a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-t2 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(>(score-t3 a-score)(score-record a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))2))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-t3 a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and (world-2p? a-world)(>(score-t1 a-score)(score-try-try a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-t1 a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-2p? a-world)(>(score-t2 a-score)(score-try-try a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-t2 a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-2p? a-world)(>(score-t3 a-score)(score-try-try a-score))(or(=(world-try a-world)1)(=(world-try a-world)3)(=(world-try a-world)5))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-t3 a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-2p? a-world)(>(score-2-t1 a-score)(score-try-try-2 a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-2-t1 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-2p? a-world)(>(score-2-t2 a-score)(score-try-try-2 a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-2-t2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and (world-2p? a-world)(>(score-2-t3 a-score)(score-try-try-2 a-score))(or(=(world-try a-world)2)(=(world-try a-world)4)(=(world-try a-world)6))(=(arrow-timer(first a-loa))3))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-2-t3 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and(=(arrow-score (first a-loa))600)(=(arrow-timer(first a-loa))25))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (+(score-bulls a-score)1) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(=(arrow-score (first a-loa))0)(=(arrow-timer(first a-loa))25))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (+(score-nom a-score)1) + (score-p1w a-score) + (score-p2w a-score))] + [(and(=(world-try a-world)1)(=(arrow-timer(first a-loa))4))(make-score + (+(score-t1 a-score)(arrow-score (first a-loa))) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-1p? a-world)(=(world-try a-world)2)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (+(score-t2 a-score)(arrow-score (first a-loa))) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-1p? a-world)(=(world-try a-world)3)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (score-t2 a-score) + (+(score-t3 a-score)(arrow-score (first a-loa))) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(=(world-try a-world)3)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (+(score-t2 a-score)(arrow-score (first a-loa))) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(=(world-try a-world)5)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (score-t2 a-score) + (+(score-t3 a-score)(arrow-score (first a-loa))) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [(and(world-2p? a-world)(=(world-try a-world)2)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (+(score-2-t1 a-score)(arrow-score (first a-loa))) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(=(world-try a-world)4)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (+(score-2-t2 a-score)(arrow-score (first a-loa))) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + [(and(world-2p? a-world)(=(world-try a-world)6)(=(arrow-timer(first a-loa))4))(make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (+(score-2-t3 a-score)(arrow-score (first a-loa))) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (+(score-t1 a-score)(score-t2 a-score)(score-t3 a-score)) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (score-arrows-shot a-score) + (score-noc a-score) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score))] + + [else(update-score-list a-score (rest a-loa) a-world)])] + [else (cons (update-score a-score (first a-loa) a-world)(update-score-list a-score (rest a-loa) a-world))] + )) + +;update-arrow: arrow target world -> arrow +;consumes an arrow, a target, and a world and updates the arrow accordingly +(define (update-arrow a-arrow a-target a-world) + (make-arrow + (cond + [(>(arrow-x a-arrow)920)(arrow-x a-arrow)] + [else(+(arrow-x a-arrow)(arrow-x-v a-arrow))]) + (cond + [(>(arrow-x a-arrow)300)(+(arrow-y a-arrow)(* -1 (*(world-wind a-world).2)))] + [else (arrow-y a-arrow)]) + (arrow-x-v a-arrow) + (arrow-y-v a-arrow) + (cond + [(=(arrow-angle a-arrow)4.9)5] + [(>(arrow-angle a-arrow)10)10.00] + [(eq?(world-increase? a-world)false)(arrow-angle a-arrow)] + [(and (not(>=(arrow-angle a-arrow)10))(world-increase? a-world))(+(arrow-angle a-arrow).49)] + [else(arrow-angle a-arrow)]) + (cond + [(eq? (arrow-timer a-arrow)0)0] + [else(-(arrow-timer a-arrow)1)]) + (cond + [(eq?(arrow-bounce-timer a-arrow)10)0] + [else (+(arrow-bounce-timer a-arrow)1)]) + (arrow-score a-arrow) + (arrow-increase? a-arrow) + )) + +;update-loa: loa target world -> loa +;consumes a loa, a target, and a world and updates the loa accorgingly+ +(define (update-loa a-loa a-target a-world) + (cond + [(empty? a-loa)a-loa] + [(eq?(arrow-timer(first a-loa))1)(rest a-loa)] + [(>(arrow-x (first a-loa))920)(cons(make-arrow + (arrow-x (first a-loa)) + (arrow-y (first a-loa)) + (arrow-x-v (first a-loa)) + (arrow-y-v (first a-loa)) + (arrow-angle (first a-loa)) + (cond + [(eq? (arrow-timer (first a-loa))0)0] + [else(-(arrow-timer (first a-loa))1)]) + (cond + [(eq?(arrow-bounce-timer (first a-loa))10)0] + [else (+(arrow-bounce-timer (first a-loa))1)]) + 0 + (arrow-increase? (first a-loa)) + )(rest a-loa))] + [(and(eq?(target-dir a-target)'down)(collision? (first a-loa) a-target))(cons (make-arrow + (arrow-x (first a-loa)) + (+(arrow-y (first a-loa))4) + (arrow-x-v (first a-loa)) + (arrow-y-v (first a-loa)) + (arrow-angle (first a-loa)) + (cond + [(eq? (arrow-timer (first a-loa))0)0] + [else(-(arrow-timer (first a-loa))1)]) + (cond + [(eq?(arrow-bounce-timer (first a-loa))10)0] + [else (+(arrow-bounce-timer (first a-loa))1)]) + (cond + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))5)600] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))10)400] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))20)300] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))32.5)200] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5(arrow-angle (first a-loa)))))2)))45)100] + [(and(> (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa))))(-(target-ty a-target)52.6))(< (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa))))(+(target-ty a-target)52.6))(>(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (+(target-ty a-target)52.5) (-(target-ty a-target)(* 10.5 (arrow-angle (first a-loa)))))2)))45))50] + [else 0]) + (arrow-increase? (first a-loa)))(rest a-loa))] + [(and(eq?(target-dir a-target)'up)(collision? (first a-loa) a-target))(cons (make-arrow + (arrow-x (first a-loa)) + (-(arrow-y (first a-loa))4) + (arrow-x-v (first a-loa)) + (arrow-y-v (first a-loa)) + (arrow-angle (first a-loa)) + (cond + [(eq? (arrow-timer (first a-loa))0)0] + [else(-(arrow-timer (first a-loa))1)]) + (cond + [(eq?(arrow-bounce-timer (first a-loa))10)0] + [else (+(arrow-bounce-timer (first a-loa))1)]) + (cond + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))5)600] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))10)400] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))20)300] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa)))))2)))32.5)200] + [(<(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (target-ty a-target) (-(+(target-ty a-target)52.5)(* 10.5(arrow-angle (first a-loa)))))2)))45)100] + [(and(> (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa))))(-(target-ty a-target)52.6))(< (-(+(target-ty a-target)52.5)(* 10.5 (arrow-angle (first a-loa))))(+(target-ty a-target)52.6))(>(sqrt(+(expt(- (target-tx a-target)(- (target-tx a-target)(-(target-y a-target)(arrow-y (first a-loa)))))2)(expt(- (+(target-ty a-target)52.5) (-(target-ty a-target)(* 10.5 (arrow-angle (first a-loa)))))2)))45))50] + [else 0]) + (arrow-increase? (first a-loa)))(rest a-loa))] + [(cons? a-loa) + (cons (update-arrow (first a-loa) a-target a-world)(update-loa (rest a-loa) a-target a-world))])) + +;update-blinks: blinks -> blinks +;consumes a blinks and updates it accordingly +(define (update-blinks a-blinks) + (make-blinks + (cond + [(eq? (blinks-timer a-blinks) 16)0] + [else (+(blinks-timer a-blinks)1)]) + (cond + [(<(blinks-timer a-blinks)8)true] + [else false]))) + +;update-archer: archer -> archer +;consumes an archer and updates it accordingly +(define (update-archer a-archer) + (make-archer + (archer-x a-archer) + (archer-y a-archer) + (cond + [(eq? (archer-timer a-archer)0)0] + [else(-(archer-timer a-archer)1)]))) + +;process-mouse: world number number mouse-event -> world +;consumes a world, a number, a number, and a mouse-event and updates the world accordingly +(define (process-mouse a-world x y mouse-event) + (cond + [(game-over? a-world)(make-world + (world-archer a-world) + (world-loa a-world) + (world-target a-world) + (cond + [(and (mouse=? mouse-event "button-down")(or (and (< x 555)(> x 345)(< y 310)(> y 240))(and (< x 555)(> x 345)(< y 410)(> y 340)))) + (make-score + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + (score-record (world-score a-world)) + 0 + 0 + (score-hs (world-score a-world)) + (score-best-try (world-score a-world)) + (score-total-q (world-score a-world)) + (score-arrows-shot (world-score a-world)) + (score-noc (world-score a-world)) + (score-bulls (world-score a-world)) + (score-nom (world-score a-world)) + (score-p1w (world-score a-world)) + (score-p2w (world-score a-world)))] + [else (world-score a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(or (and (< x 555)(> x 345)(< y 310)(> y 240))(and (< x 555)(> x 345)(< y 410)(> y 340))))9] + [else(world-count a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(or (and (< x 555)(> x 345)(< y 310)(> y 240))(and (< x 555)(> x 345)(< y 410)(> y 340))))1] + [else(world-try a-world)]) + (world-turn a-world) + (world-atimer a-world) + (world-blinks a-world) + (world-wind a-world) + (cond + [(and (mouse=? mouse-event "button-down")(or (and (< x 555)(> x 345)(< y 310)(> y 240))(and (< x 555)(> x 345)(< y 410)(> y 340))))false] + [else(world-stopped? a-world)]) + (world-r-t a-world) + (world-increase? a-world) + (world-cc a-world) + (world-how-to a-world) + (world-tg a-world) + (cond + [(and (mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(< y 410)(> y 340)))true] + [else(world-hub? a-world)]) + (world-stats? a-world) + (world-credits? a-world) + (world-how-to? a-world) + (world-how-too? a-world) + (cond + [(and (mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(< y 410)(> y 340)))false] + [else(world-1p? a-world)]) +(cond + [(and (mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(< y 410)(> y 340)))false] + [else(world-2p? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(< y 310)(> y 240)))true] + [(and (mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(< y 410)(> y 340)))false] + [else(world-start? a-world)]) + (world-pause? a-world) + (world-sure? a-world) + (world-slider-x a-world) + (cond + [(and (mouse=? mouse-event "button-down")(or (and (< x 555)(> x 345)(< y 310)(> y 240))(and (< x 555)(> x 345)(< y 410)(> y 340))))2] + [else(world-gcount a-world)]) + )] + [(not(world-pause? a-world)) + (make-world + (process-mouse-archer(world-archer a-world) a-world x y mouse-event) + (cond + [(and(world-stopped? a-world)(mouse=? mouse-event "button-down")(eq?(world-count a-world)0))(world-loa a-world)] + [(and(world-stopped? a-world)(mouse=? mouse-event "button-down")(not(eq?(world-atimer a-world)0)))(world-loa a-world)] + [(and (world-start? a-world)(mouse=? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))(world-loa a-world)] + [(and(mouse=? mouse-event "button-down")(world-start? a-world)(world-stopped? a-world))(cons ARROW1 (world-loa a-world))] + [else (world-loa a-world)]) + (world-target a-world) + (process-mouse-score(world-score a-world)a-world x y mouse-event) + (cond + [(and(world-stopped? a-world)(mouse=? mouse-event "button-down")(=(world-count a-world)0))(world-count a-world)] + [(and(world-stopped? a-world)(mouse=? mouse-event "button-down")(not(eq? (world-atimer a-world)0)))(world-count a-world)] + [(and (world-start? a-world)(mouse=? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))(world-count a-world)] + [(and(world-stopped? a-world)(world-start? a-world)(mouse=? mouse-event "button-down"))(-(world-count a-world)1)] + [else(world-count a-world)]) + (world-try a-world) + (world-turn a-world) + (cond + [(and (world-start? a-world)(mouse=? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))(world-atimer a-world)] + [(and (world-stopped? a-world)(world-start? a-world)(mouse=? mouse-event "button-down")(eq? (world-atimer a-world)0))75] + [(and (world-stopped? a-world)(mouse=? mouse-event "button-down")(not(eq? (world-atimer a-world)0)))(world-atimer a-world)] + [else(world-atimer a-world)]) + (world-blinks a-world) + (world-wind a-world) + (cond + [(and (world-start? a-world)(mouse=? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))(world-stopped? a-world)] + [(and(world-start? a-world)(mouse=? mouse-event "button-down"))true] + [else(world-stopped? a-world)]) + (random 2) + (cond + [(and (eq? (world-cc a-world)0)(not (world-hub? a-world))(mouse=? mouse-event "button-down"))true] + [(and(world-start? a-world)(mouse=? mouse-event "button-up"))false] + [else (world-increase? a-world)]) + (cond + [(and(mouse=? mouse-event "button-down")(world-start? a-world)(eq?(world-atimer a-world)0))1] + [(and(mouse=? mouse-event "button-down")(not(eq?(world-atimer a-world)0)))(world-cc a-world)] + [else(world-cc a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-how-to? a-world)(and(< x 40)(> x 5)(> y 5)(< y 40)))1] + [(and (world-how-too? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))1] + [(and (or (world-how-to? a-world)(world-how-too? a-world))(mouse=? mouse-event "button-down")(not(=(world-how-to a-world)7))(<(sqrt(+(expt(- x 650)2)(expt(- y 300)2)))15))(+(world-how-to a-world)1)] + [(and (or (world-how-to? a-world)(world-how-too? a-world))(mouse=? mouse-event "button-down")(not(=(world-how-to a-world)1))(<(sqrt(+(expt(- x 250)2)(expt(- y 300)2)))15))(-(world-how-to a-world)1)] + [else (world-how-to a-world)]) + (world-tg a-world) + (cond + [(and (or (and (> x 345)(< x 555)(> y 165)(< y 235))(and (> x 345)(< x 555)(> y 250)(< y 320))(and (> x 345)(< x 555)(> y 335)(< y 405))(and (> x 345)(< x 555)(> y 420)(< y 490))(and (> x 345)(< x 555)(> y 505)(< y 575))) (mouse=? mouse-event "button-down"))false] + [(and (mouse=? mouse-event "button-down")(not(world-hub? a-world))(or (world-how-too? a-world)(world-stats? a-world)(world-credits? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))true] + [else(world-hub? a-world)]) + + (cond + [(and (world-hub? a-world)(mouse=? mouse-event "button-down")(and (> x 345)(< x 555)(> y 420)(< y 490)))true] + [(and (world-stats? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))false] + [else(world-stats? a-world)]) + (cond + [(and (world-hub? a-world)(mouse=? mouse-event "button-down")(and (> x 345)(< x 555)(> y 505)(< y 575)))true] + [(and (world-credits? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))false] + [else(world-credits? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-how-to? a-world)(and(< x 40)(> x 5)(> y 5)(< y 40)))false] + [(and(world-hub? a-world)(mouse=? mouse-event "button-down")(or (and (> x 345)(< x 555)(> y 165)(< y 235))(and (> x 345)(< x 555)(> y 250)(< y 320))))true] + [else(world-how-to? a-world)]) + (cond + [(and(world-hub? a-world)(mouse=? mouse-event "button-down")(and (> x 345)(< x 555)(> y 335)(< y 405)))true] + [(and (world-how-too? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))false] + [else(world-how-too? a-world)]) + (cond + [(and (world-hub? a-world)(mouse=? mouse-event "button-down")(and (> x 345)(< x 555)(> y 165)(< y 235)))true] + [else(world-1p? a-world)]) + (cond + [(and (world-hub? a-world)(mouse=? mouse-event "button-down")(and (> x 345)(< x 555)(> y 250)(< y 320)))true] + [else(world-2p? a-world)]) + (cond + [(and (world-start? a-world)(mouse=? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))false] + [(and (mouse=? mouse-event "button-down")(world-how-to? a-world)(and(< x 40)(> x 5)(> y 5)(< y 40)))true] + [else(world-start? a-world)]) + (cond + [(and (world-start? a-world)(mouse=? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))true] + [else(world-pause? a-world)]) + (world-sure? a-world) + (cond + [(and(or(mouse=? mouse-event "button-down")(mouse=? mouse-event "drag"))(and (< x 420)(> x 316)(< y 545)(> y 525)))x] + [else(world-slider-x a-world)]) + (world-gcount a-world) + + )] + [(world-pause? a-world)(make-world + (world-archer a-world) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))empty] + [else(world-loa a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))TARGET1] + [else(world-target a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))(make-score + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + (score-record (world-score a-world)) + 0 + 0 + (score-hs (world-score a-world)) + (score-best-try (world-score a-world)) + (score-total-q (world-score a-world)) + (score-arrows-shot (world-score a-world)) + (score-noc (world-score a-world)) + (score-bulls (world-score a-world)) + (score-nom (world-score a-world)) + (score-p1w (world-score a-world)) + (score-p2w (world-score a-world)))] + [else(process-mouse-score(world-score a-world)a-world x y mouse-event)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))9] + [else(world-count a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))1] + [else(world-try a-world)]) + (world-turn a-world) + (world-atimer a-world) + (world-blinks a-world) + (world-wind a-world) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))false] + [else(world-stopped? a-world)]) + (world-r-t a-world) + (world-increase? a-world) + (world-cc a-world) + (cond + [(and (world-how-too? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))1] + [(and (or (world-how-to? a-world)(world-how-too? a-world))(mouse=? mouse-event "button-down")(not(=(world-how-to a-world)7))(<(sqrt(+(expt(- x 650)2)(expt(- y 300)2)))15))(+(world-how-to a-world)1)] + [(and (or (world-how-to? a-world)(world-how-too? a-world))(mouse=? mouse-event "button-down")(not(=(world-how-to a-world)1))(<(sqrt(+(expt(- x 250)2)(expt(- y 300)2)))15))(-(world-how-to a-world)1)] + [else (world-how-to a-world)]) + (world-tg a-world) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))true] + [else(world-hub? a-world)]) + (cond + [(and (not(world-sure? a-world))(mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(< y 375)(> y 305)))true] + [(and (not(world-sure? a-world))(world-stats? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))false] + [else(world-stats? a-world)]) + (world-credits? a-world) + (world-how-to? a-world) + (cond + [(and (not(world-sure? a-world))(mouse=? mouse-event "button-down")(and(< x 555)(> x 345) (< y 295) (> y 225)))true] + [(and (not(world-sure? a-world))(world-how-too? a-world)(mouse=? mouse-event "button-down")(not(world-hub? a-world))(and (< x 135)(> x 5)(< y 65)(> y 5)))false] + [else(world-how-too? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))false] + [else(world-1p? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))false] + [else(world-2p? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))false] + [(and (mouse=? mouse-event "button-down")(and(< x 555)(> x 345) (< y 215) (> y 145)))true] + [else(world-start? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(and(< x 555)(> x 345) (< y 215) (> y 145)))false] + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))false] + [else(world-pause? a-world)]) + (cond + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 395)(> y 325)))false] + [(and (mouse=? mouse-event "button-down")(world-sure? a-world)(and (< x 555)(> x 345)(< y 275)(> y 205)))false] + [(and (mouse=? mouse-event "button-down")(and (< x 555)(> x 345)(> y 385)(< y 455)))true] + [else(world-sure? a-world)]) + (cond + [(and(or(mouse=? mouse-event "button-down")(mouse=? mouse-event "drag"))(and (< x 420)(> x 316)(< y 545)(> y 525)))x] + [else(world-slider-x a-world)]) + (world-gcount a-world) + )] + [else a-world])) + +;process-mouse-archer: archer world number number mouse-event -> archer +;consumes an archer, a world, a number, a number. and a mouse-event and updates the archer accordingly +(define (process-mouse-archer a-archer a-world x y mouse-event) + (make-archer + (archer-x a-archer) + (archer-y a-archer) + (cond + [(and(world-stopped? a-world)(eq? mouse-event "button-down")(not(eq?(archer-timer a-archer)0)))(archer-timer a-archer)] + [(and(world-stopped? a-world)(eq? mouse-event "button-down"))75] + [else(archer-timer a-archer)]))) + +;process-mouse-score: score world number number mouse-event -> score +;consumes a score, a world, a number, a number, and a mouse-event and updates the score accordingly +(define (process-mouse-score a-score a-world x y mouse-event) + (make-score + (score-t1 a-score) + (score-t2 a-score) + (score-t3 a-score) + (score-2-t1 a-score) + (score-2-t2 a-score) + (score-2-t3 a-score) + (score-try-try a-score) + (score-try-try-2 a-score) + (score-record a-score) + (score-total a-score) + (score-2-total a-score) + (score-hs a-score) + (score-best-try a-score) + (score-total-q a-score) + (cond + [(and (world-start? a-world)(world-stopped? a-world)(eq? mouse-event "button-down")(and (< x 897.5)(> x 857.5)(> y 2.5)(< y 42.5)))(score-arrows-shot a-score)] + [(and (eq? mouse-event "button-down")(=(world-atimer a-world)0)(world-stopped? a-world)(world-start? a-world)(or(and(world-1p? a-world)(not(=(world-try a-world)4)))(and (world-2p? a-world)(not(=(world-try a-world)7)))))(+(score-arrows-shot a-score)1)] + [else(score-arrows-shot a-score)]) + (cond + [(eq? mouse-event "button-down")(+(score-noc a-score)1)] + [else (score-noc a-score)]) + (score-bulls a-score) + (score-nom a-score) + (score-p1w a-score) + (score-p2w a-score) +)) + +;collision?: arrow target -> boolean +;consumes an arrow and a target and determines if they have collided +(define (collision? a-arrow a-target) + (or + (and(<(abs(-(arrow-x a-arrow)(target-x5 a-target)))(+ (/(image-width ARROW)4)(/(image-width (rectangle 5 105 "solid""yellow"))2))) + (<(abs(-(arrow-y a-arrow)(target-y a-target)))(+ (/(image-height ARROW)8)(/(image-height(rectangle 5 105 "solid""yellow"))2)))) + (and(<(abs(-(arrow-x a-arrow)(target-x4 a-target)))(+ (/(image-width ARROW)4)(/(image-width (rectangle 5 90 "solid""yellow"))2))) + (<(abs(-(arrow-y a-arrow)(target-y a-target)))(+ (/(image-height ARROW)8)(/(image-height(rectangle 5 90 "solid""yellow"))2)))) + (and(<(abs(-(arrow-x a-arrow)(target-x3 a-target)))(+ (/(image-width ARROW)4)(/(image-width (rectangle 5 65 "solid""yellow"))2))) + (<(abs(-(arrow-y a-arrow)(target-y a-target)))(+ (/(image-height ARROW)8)(/(image-height(rectangle 5 65 "solid""yellow"))2)))) + (and(<(abs(-(arrow-x a-arrow)(target-x2 a-target)))(+ (/(image-width ARROW)4)(/(image-width (rectangle 5 40 "solid""yellow"))2))) + (<(abs(-(arrow-y a-arrow)(target-y a-target)))(+ (/(image-height ARROW)8)(/(image-height(rectangle 5 40 "solid""yellow"))2)))) + (and(<(abs(-(arrow-x a-arrow)(target-x1 a-target)))(+ (/(image-width ARROW)4)(/(image-width (rectangle 5 20 "solid""yellow"))2))) + (<(abs(-(arrow-y a-arrow)(target-y a-target)))(+ (/(image-height ARROW)8)(/(image-height(rectangle 5 20 "solid""yellow"))2)))) + )) + +;game-over?: world -> boolean +;consumes a world and determines if a game over has occured +(define (game-over? a-world) + (or(and (world-1p? a-world)(=(world-try a-world)4))(and(world-2p? a-world)(=(world-try a-world)7)))) + + (big-bang IW + (to-draw draw-world) + (on-tick update-world (/ 1.0 28)) + (on-mouse process-mouse)) diff --git a/static/index.html b/static/index.html index 9487327..1f2249d 100644 --- a/static/index.html +++ b/static/index.html @@ -78,6 +78,7 @@
  • Flappy Birds
  • 2048 Game
  • Tetris
  • +
  • Archery
  • RacketScript on Github
  • From 21842480e32a2e76ada732087d131bad25abae56 Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Fri, 18 Jun 2021 19:10:42 -0700 Subject: [PATCH 03/38] Create docker-publish.yml --- .github/workflows/docker-publish.yml | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..b416e0e --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,61 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '27 19 * * *' + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: docker.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From fde1546a10c8132e16b42f4de8e7cc6f97f9d4bb Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Fri, 18 Jun 2021 19:15:52 -0700 Subject: [PATCH 04/38] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b416e0e..181e69f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,4 +1,4 @@ -name: Docker +name: Publish to Docker Hub # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by @@ -22,7 +22,7 @@ env: jobs: build: - + name: Build and Push runs-on: ubuntu-latest permissions: contents: read @@ -39,8 +39,8 @@ jobs: uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c with: registry: ${{ env.REGISTRY }} - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} # Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action From 516205528d8b335fc6a8d179fb6436a4e55e412c Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Fri, 18 Jun 2021 19:21:13 -0700 Subject: [PATCH 05/38] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 181e69f..9f6f707 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,10 +1,5 @@ name: Publish to Docker Hub -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - on: schedule: - cron: '27 19 * * *' @@ -14,12 +9,8 @@ on: branches: [ master ] env: - # Use docker.io for Docker Hub if empty - REGISTRY: docker.io - # github.repository as / IMAGE_NAME: ${{ github.repository }} - jobs: build: name: Build and Push From 87c0ec67787782326aaf7ba70d2caf3bcb090aef Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Fri, 18 Jun 2021 20:32:39 -0700 Subject: [PATCH 06/38] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 9f6f707..8b2b4fe 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -5,6 +5,8 @@ on: - cron: '27 19 * * *' push: branches: [ master ] + tags: + - 'latest' pull_request: branches: [ master ] From 1b7db08386b9dc8dd391ca5dc01dd7b67f3fe921 Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Fri, 18 Jun 2021 20:40:00 -0700 Subject: [PATCH 07/38] Remove metadata action from github action --- .github/workflows/docker-publish.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8b2b4fe..12b6983 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -35,20 +35,10 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: - context: . push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ env.IMAGE_NAME }}:latest From 471b90cf3cbb85d6ed072358189bff836fca7549 Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Fri, 18 Jun 2021 21:47:08 -0700 Subject: [PATCH 08/38] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94756f4..3f47ee5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Racketscript Playground ======================= [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](COPYING.md) -[![Try Online](https://img.shields.io/badge/try_it-online!-ff9900.svg)]( http://play.racketscript.org:8080/) +[![Try Online](https://img.shields.io/badge/try_it-online!-ff9900.svg)]( http://play.racketscript.org) Playground for [RacketScript](https://github.com/vishesh/racketscript). Both server-side and client-side code is written in RacketScript. From 01b69c2bb09502168c1ab3485e23a3a1ea346d14 Mon Sep 17 00:00:00 2001 From: Stephen Chang Date: Mon, 28 Jun 2021 22:10:17 +0000 Subject: [PATCH 09/38] github saving: basic functionality rough draft --- app.rkt | 286 ++++++++++++++++++++++++- client.rkt | 134 +++++++++++- package-lock.json | 536 +++++----------------------------------------- package.json | 1 + static/index.html | 2 + 5 files changed, 468 insertions(+), 491 deletions(-) diff --git a/app.rkt b/app.rkt index dc5358a..31abc15 100644 --- a/app.rkt +++ b/app.rkt @@ -9,6 +9,10 @@ (define express ($/require "express")) (define body-parser ($/require "body-parser")) (define child-process ($/require "child_process")) +(define https ($/require "https")) +(define url ($/require "url")) +(define session ($/require "express-session")) + (define spawn ($ child-process 'spawn)) (define process #js*.global.process) @@ -20,9 +24,278 @@ #js.process.env.PORT 8080)) +;; hash mapping user ids to auth tokens +(define USERS (make-hash)) + +;; TODO: this is temporary. use the above hash instead +(define ACCESS-TOKEN "") ;;----------------------------------------------------------------------------- ;; Handlers +(define PLAYGROUND-GH-CLIENT-ID #js"079bd6bc167ef3ba0753") +(define PLAYGROUND-GH-SECRET #js"d0beada041f11935c6e27acd3e34566b6548b72a") + +(define (has-code? url) (#js.url.includes #js"?code=")) + +(define (url->code uu) + (#js.console.log ($/binop + #js"extracting code from: " uu)) + (define u ($/new (#js.url.URL uu))) + (#js.console.log #js.u.searchParams) + (#js.console.log (#js.u.searchParams.get #js"code")) + (#js.u.searchParams.get #js"code")) +; ($ (#js.url.split #js"?code=") 1)) + +(define (handle-save req res) + (#js.console.log ($/binop + #js"User wants to save: " #js.req.session.id)) + (#js.console.log #js.req.session) + (define tok #js.req.session.access_token) + (#js.console.log ($/binop + #js"access_token: " tok)) +#; (define data + {$/obj + [public #t] +#; [files + (assoc->object + `([,*gist-source-file* ,{$/obj + [content (#js.cm-editor-racket.getValue)]}] + [,*gist-javascript-file* ,{$/obj + [content (#js.cm-editor-jsout.getValue)]}]))] + [files + {$/obj + [source.rkt {$/obj + [content (#js.cm-editor-racket.getValue)]}] + [compiled.js {$/obj + [content (#js.cm-editor-jsout.getValue)]}]}]}) + ;; (define settings + ;; {$/obj + ;; [url #js"https://api.github.com/gists"] + ;; [data #js.req.data] + ;; [headers + ;; {$/obj + ;; [Accept #js"application/vnd.github.v3+json"] + ;; [Authorization #js.req.session.access_token]}]}) + ;; ($> (#js.jQuery.post settings) + ;; (done (λ (data) + ;; (#js.console.log #js.data.id) + ;; #; (define id #js.data.id) + ;; #; (:= #js.window.location.href ($/binop + #js"#gist/" id)))) + ;; (fail (λ (e) + ;; (#js.console.log #js.e) + ;; #;(show-error "Error saving as Gist" + ;; #js.e.responseJSON.message))))) + ;; TODO: can we just forward data directly, without re-parsing/stringifying? + (define data (#js*.JSON.stringify #js.req.body)) + (define options + {$/obj + [hostname #js"api.github.com"] + [path #js"/gists"] + [method #js"POST"] + [headers + {$/obj + [Accept #js"application/vnd.github.v3+json"] + [Authorization ($/binop + #js"token " #js.req.session.access_token)] +#; [Content-Type #js"application/json"] + #; [Content-Length #js.data.length] + ;; from: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#user-agent-required + ;; User agent required: + ;; All API requests MUST include a valid User-Agent + ;; header. Requests with no User-Agent header will be + ;; rejected. We request that you use your GitHub username, or + ;; the name of your application, for the User-Agent header + ;; value. This allows us to contact you if there are problems. + [User-Agent #js"RacketScript Playground"] + }]}) + (define gh-req + (#js.https.request + options + (λ (gh-res) + (#js.console.log ($/binop + #js"statusCode: " #js.gh-res.statusCode)) + (#js.console.log ($/binop + #js"headers: " #js.gh-res.headers)) + (#js.console.log (#js*.JSON.stringify #js.gh-res.headers)) + (define gh-datas ($/array)) ; array of partial data buffers + ;; TODO: is there a more high level way to get the data? + ;; https://stackoverflow.com/questions/40537749/how-do-i-make-a-https-post-in-node-js-without-any-third-party-module + (#js.gh-res.on #js"data" (λ (chunk) (#js.gh-datas.push chunk))) + (#js.gh-res.on #js"end" + (λ () + (define gh-data (#js*.Buffer.concat gh-datas)) + ;; TODO: directly convert data to JSON? + (define res-data (#js*.JSON.parse (#js.gh-data.toString))) + (#js.console.log #js.res-data.id) + (#js.res.send #js.res-data.id) +#; (#js.process.stdout.write d) + ;; (define params ($/new (#js.url.URLSearchParams (#js.d.toString #js"utf8")))) + ;; (#js.console.log #js.params) + ;; (define tok (#js.params.get #js"access_token")) + ;; (#js.console.log ($/binop + #js"Received GH access_token: " tok)) + ;; (#js.console.log ($/binop + #js"user id: " #js.req.session.id)) + ;; (#js.console.log ($/binop + #js"stored access_token (before): " #js.req.session.access_token)) + ;; ($/:= #js.req.session.access_token tok) + ;; (#js.console.log ($/binop + #js"stored access_token: " #js.req.session.access_token)) + ;; (#js.req.session.save (λ (e) (#js.console.log #js"access_token saved"))) + ;; (#js.console.log #js.req.session) + ;; (#js.res.send #js"") + ;; (set! ACCESS-TOKEN tok)))))) + ))))) + (#js.gh-req.on #js"error" + (λ (e) + (#js.console.error e))) + + (#js.gh-req.write data) + (#js.gh-req.end)) + +(define (handle-login req res) + (#js.console.log ($/binop + #js"User id wants to login: " #js.req.session.id)) + (#js.console.log ($/binop + #js"User id wants to login: " #js.req.session.id)) + ($/:= #js.req.session.access_token #js"") ; initialize so session gets saved + (#js.console.log #js.req.session) + (#js.console.log #js"Initiating GH Auth request ...") + (define params + ($/new + (#js.url.URLSearchParams + {$/obj + [client_id PLAYGROUND-GH-CLIENT-ID] + [scope #js"gist"] + [state #js.req.session.id]}))) + (#js.console.log ($/binop + #js"https://github.com/login/oauth/authorize?" params)) + (#js.res.redirect + 302 + ($/binop + #js"https://github.com/login/oauth/authorize?" params)) +;; client_id=079bd6bc167ef3ba0753&scope=gist") +;; (define data +;; (#js*.JSON.stringify +;; {$/obj +;; [client_id PLAYGROUND-GH-CLIENT-ID] +;; #; [client_secret CLIENT-SECRET] +;; #; [code code]})) +;; (define options +;; {$/obj +;; [hostname #js"github.com"] +;; [path #js"/login/oauth/authorize??client_id=079bd6bc167ef3ba0753&scope=gist"] +;; [method #js"GET"] +;; #; [headers +;; {$/obj +;; [Content-Type #js"application/json"] +;; [Content-Length #js.data.length]}]}) +;; (define gh_auth_req +;; (#js.https.request +;; options +;; (λ (gh_auth_res) +;; (#js.console.log #js"github response ...") +;; (#js.gh_auth_res.on #js"data" +;; (λ (d) ;; data buffer +;; ;; (#js.process.stdout.write d) +;; ;; (#js.console.log ($/typeof d)) +;; ;; TODO: should be able to send buffer directly without converting to string? +;; ;; must set Content-Type to "text/html"? +;; ;; When the parameter is a Buffer object, the method sets the Content-Type response header field to “application/octet-stream”, unless previously defined as shown below: res.set('Content-Type', 'text/html') +;; ;; https://expressjs.com/en/api.html#res +;; (define str (#js.d.toString #js"utf8")) +;; (#js.console.log str) +;; (#js.res.set #js"Content-Type" #js"text/html; charset=UTF-8") ; otherwise gets treated as plain text +;; ; (#js.res.send #js"you are being redirected") +;; (#js.res.send str) +;; ;; (define params ($/new (#js.url.URLSearchParams (#js.d.toString #js"utf8")))) +;; ;; (#js.console.log #js.params) +;; ;; (define tok (#js.params.get #js"access_token")) +;; ;; (#js.console.log ($/binop + #js"Received GH access_token: " tok)) +;; ;; (set! ACCESS-TOKEN tok)))))) +;; ))))) +;; (#js.gh_auth_req.on #js"error" +;; (λ (e) +;; (#js.console.error e))) +;; (#js.gh_auth_req.end) +) + ;; (#js.console.log ($/binop + #js"statusCode: " #js.res.statusCode)) + ;; (#js.console.log ($/binop + #js"headers: " #js.res.headers)) + ;; (#js.console.log (#js*.JSON.stringify #js.res.headers)) + ;; (#js.res.on #js"data" + ;; (λ (d) ;; data buffer + ;; (#js.process.stdout.write d) + ;; (define params ($/new (#js.url.URLSearchParams (#js.d.toString #js"utf8")))) + ;; (#js.console.log #js.params) + ;; (define tok (#js.params.get #js"access_token")) + ;; (#js.console.log ($/binop + #js"Received GH access_token: " tok)) + ;; (set! ACCESS-TOKEN tok)))))) + ;; (#js.req.on #js"error" + ;; (λ (e) + ;; (#js.console.error e))) + ;; + + + +;; OAuth steps: +;; 1) User initiates login by clicking "login" button, client_id sent to gh +;; 2) github calls this handler with a "code" +;; 3) server calls github authorize with: +;; - code +;; - client_id +;; - client secret +;; 4) gh responds with auth token +;; 5) send auth token in header with every gh api call +;; NOTE: the client_id comes from creating github oauth app; +;; handler url "racketscript.org/auth" must be registered on this app page +(define (handle-auth req res) + (#js.console.log #js"Making GH Auth request ...") + ;; (#js.console.log #js.res.req) + (#js.console.log #js.res.req.query.code) + (#js.console.log #js.res.req.query.state) +#; (define sess + (#js.res.req.session.store.get + #js.res.req.query.state + (λ (e sid) + (#js.console.log + ($/binop + #js"ERR, session not found: " sid))))) +;; (define code (url->code #js.res.req.url)) + (define code #js.res.req.query.code) + (#js.console.log ($/binop + #js"Received GH code: " code)) + + (#js.console.log #js"Making GH Access Token request ...") + (define data + (#js*.JSON.stringify + {$/obj + [client_id PLAYGROUND-GH-CLIENT-ID] + [client_secret PLAYGROUND-GH-SECRET] + [code code]})) + (define options + {$/obj + [hostname #js"github.com"] + [path #js"/login/oauth/access_token"] + [method #js"POST"] + [headers + {$/obj + [Content-Type #js"application/json"] + [Content-Length #js.data.length]}]}) + (define gh-req + (#js.https.request + options + (λ (gh-res) + ;; (#js.console.log #js.gh-res) + (#js.console.log ($/binop + #js"statusCode: " #js.gh-res.statusCode)) + (#js.console.log ($/binop + #js"headers: " #js.gh-res.headers)) + (#js.console.log (#js*.JSON.stringify #js.gh-res.headers)) + (#js.gh-res.on #js"data" + (λ (d) ;; data buffer + (#js.process.stdout.write d) + (define params ($/new (#js.url.URLSearchParams (#js.d.toString #js"utf8")))) + (#js.console.log #js.params) + (define tok (#js.params.get #js"access_token")) + (#js.console.log ($/binop + #js"Received GH access_token: " tok)) + (#js.console.log ($/binop + #js"user id: " #js.req.session.id)) + (#js.console.log ($/binop + #js"stored access_token (before): " #js.req.session.access_token)) + ($/:= #js.req.session.access_token tok) + (#js.console.log ($/binop + #js"stored access_token: " #js.req.session.access_token)) + (#js.req.session.save (λ (e) (#js.console.log #js"access_token saved"))) + (#js.console.log #js.req.session) + (#js.res.send #js"") + (set! ACCESS-TOKEN tok)))))) + (#js.gh-req.on #js"error" + (λ (e) + (#js.console.error e))) + + (#js.gh-req.write data) + (#js.gh-req.end)) + + (define (handle-compile req res) (define racket-code (or ($ req 'body 'code) #f)) @@ -77,11 +350,22 @@ (#js.app.use (#js.express.static #js"static")) (#js.app.use #js"/examples" (#js.express.static #js"examples")) - (#js.app.use (#js.body-parser.urlencoded {$/obj [extended #f] + (#js.app.use (#js.body-parser.urlencoded {$/obj [extended #t] ; must be #t for nested objs (see save code) [limit #js"8mb"]})) (#js.app.use (#js.body-parser.json {$/obj [limit #js"8mb"]})) + ;; TODO: not supposed to use the default sessionStore + (#js.app.use (session {$/obj [secret #js"RacketScript PlayGround"] + [resave #f] + [saveUninitialized #f]})) + + (#js.app.get #js"/auth" handle-auth) + + (#js.app.get #js"/login" handle-login) + (#js.app.post #js"/compile" handle-compile) + + (#js.app.post #js"/save" handle-save) (#js.app.listen PORT (λ () diff --git a/client.rkt b/client.rkt index 94c467a..d3efa46 100644 --- a/client.rkt +++ b/client.rkt @@ -32,6 +32,7 @@ (define compiling? #f) (define last-compile-time (#js*.Date.now)) +(define logged-in? #f) (define-syntax := (make-rename-transformer #'$/:=)) (define run-frame-init-handler (λ () @@ -67,6 +68,10 @@ (click (λ (e) (#js.e.preventDefault) (compile #t)))) +#; ($> (jQuery #js"#btn-login") + (click (λ (e) + (#js.e.preventDefault) + (login)))) ($> (jQuery #js"#btn-save") (click (λ (e) (#js.e.preventDefault) @@ -208,23 +213,142 @@ #js.xhr.responseJSON.message))))) (define (save) + ;; this data will get forwarded to github + ;; see: https://docs.github.com/en/rest/reference/gists#create-a-gist--parameters (define data {$/obj - [public #t] - [files + [public #f] + [description #js"RacketScript Playground Program"] +#; [files (assoc->object `([,*gist-source-file* ,{$/obj [content (#js.cm-editor-racket.getValue)]}] [,*gist-javascript-file* ,{$/obj - [content (#js.cm-editor-jsout.getValue)]}]))]}) - ($> (#js.jQuery.post #js"https://api.github.com/gists" (#js*.JSON.stringify data)) + [content (#js.cm-editor-jsout.getValue)]}]))] +#; [rkt (#js.cm-editor-racket.getValue)] + #; [js (#js.cm-editor-jsout.getValue)] + [files + {$/obj + [source.rkt {$/obj + [content (#js.cm-editor-racket.getValue)]}] + [compiled.js {$/obj + [content (#js.cm-editor-jsout.getValue)]}]}]}) + (#js*.console.log #js"sending to server ...") + (#js*.console.log #js.data) + (define settings + {$/obj + [url #js"/save"] + [data data #;(#js*.JSON.stringify data)] + ;[data data] +#; [headers + {$/obj + [Accept #js"application/vnd.github.v3+json"] + [Authorization #js"token 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"]}]}) + ($> (#js.jQuery.post #js"/save" data) #;(#js.jQuery.post settings) + #;(#js.jQuery.post #js"https://api.github.com/gists" (#js*.JSON.stringify data)) (done (λ (data) - (define id #js.data.id) + (#js*.console.log data) + (define id #js.data) (:= #js.window.location.href ($/binop + #js"#gist/" id)))) (fail (λ (e) + (#js*.console.log #js.e) + (show-error "Error saving as Gist" + #js.e.responseJSON.message))))) + +#;(define (save) +#; (define data + {$/obj + [public #t] +#; [files + (assoc->object + `([,*gist-source-file* ,{$/obj + [content (#js.cm-editor-racket.getValue)]}] + [,*gist-javascript-file* ,{$/obj + [content (#js.cm-editor-jsout.getValue)]}]))] + [files + {$/obj + [source.rkt {$/obj + [content (#js.cm-editor-racket.getValue)]}] + [compiled.js {$/obj + [content (#js.cm-editor-jsout.getValue)]}]}]}) + (define settings + {$/obj + [url #js"/save"] +; [data (#js*.JSON.stringify data)] + ;[data data] + #; [headers + {$/obj + [Accept #js"application/vnd.github.v3+json"] + [Authorization #js"token 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"]}]}) + ($> (#js.jQuery.post settings) + #;(#js.jQuery.post #js"https://api.github.com/gists" (#js*.JSON.stringify data)) + (done (λ (data) + (show-error "saved" + #js.data.responseJSON.message) + #;(define id #js.data.id) + #;(:= #js.window.location.href ($/binop + #js"#gist/" id)))) + (fail (λ (e) + (#js*.console.log #js.e) (show-error "Error saving as Gist" #js.e.responseJSON.message))))) +#;(define (login) + (show-error "Logging in" "Github login coming soon!")) +(define (login) + #;(define (compile execute?) + (when (or (not compiling?) (> (- (#js*.Date.now) last-compile-time) 5000)) + (:= compiling? #t) + (#js*.setTimeout (λ () + (:= compiling? #f)) + 5000) + (#js.cm-editor-console.setValue #js"Console Log:\n") + (#js.cm-editor-jsout.setValue #js"Compiling ...") + ($> (#js.jQuery.post #js"/compile" {$/obj [code (#js.cm-editor-racket.getValue)]}) + (done (λ (data) + (set-javascript-code data) + (when execute? + (run)))) + (fail (λ (xhr status err) + (#js.cm-editor-console.setValue + ($/binop + #js"Compilation error:\n" #js.xhr.responseText)) + (#js.cm-editor-jsout.setValue #js""))) + (always (λ () + (:= compiling? #f)))))) + (#js.jQuery.get #js"/login") +#;(define data + {$/obj + [client-id #js"079bd6bc167ef3ba0753"]}) +#;(define settings + {$/obj + [url #js"https://github.com/login/oauth/authorize"] + [data (#js*.JSON.stringify data)] +#; [headers + {$/obj + [Authorization #js"token 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"]}]}) +#; ($> (#js.jQuery.get settings) + (done (λ (data) + (#js*.console.log #js.data) + #;(show-error "logging in" + #js.data.responseJSON.message))) + (fail (λ (e) + (show-error "failed logging in" + #js.e.responseJSON.message))))) +#;(define (login) + (define settings + {$/obj + [url #js"https://api.github.com/user"] + [headers + {$/obj + [Authorization #js"token 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"]}]}) + ($> (#js.jQuery.get settings) + (done (λ (data) + (#js*.console.log #js.data) + #;(show-error "logging in" + #js.data.responseJSON.message))) + (fail (λ (e) + (show-error "failed logging in" + #js.e.responseJSON.message))))) + ;;------------------------------------------------------------------------------- (define (show-error title msg) diff --git a/package-lock.json b/package-lock.json index 669f28a..908835a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,492 +1,8 @@ { "name": "racketscript-playground", "version": "0.0.1", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "version": "0.0.1", - "dependencies": { - "body-parser": "*", - "express": "^4.17.1" - } - }, - "node_modules/accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", - "dependencies": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "node_modules/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "dependencies": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "dependencies": { - "safe-buffer": "5.1.2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "dependencies": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", - "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.31", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", - "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", - "dependencies": { - "mime-db": "1.48.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "dependencies": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "dependencies": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - }, - "node_modules/serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" - }, - "node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", - "engines": { - "node": ">= 0.8" - } - } - }, "dependencies": { "accepts": { "version": "1.3.7", @@ -622,6 +138,38 @@ "vary": "~1.1.2" } }, + "express-session": { + "version": "1.17.2", + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.2.tgz", + "integrity": "sha512-mPcYcLA0lvh7D4Oqr5aNJFMtBMKPLl++OKKxkHzZ0U0oDq1rpKBnkR5f5vCHR26VeArlTOEF9td4x5IjICksRQ==", + "requires": { + "cookie": "0.4.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~2.0.0", + "on-headers": "~1.0.2", + "parseurl": "~1.3.3", + "safe-buffer": "5.2.1", + "uid-safe": "~2.1.5" + }, + "dependencies": { + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } + } + }, "finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", @@ -727,6 +275,11 @@ "ee-first": "1.1.1" } }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -751,6 +304,11 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, + "random-bytes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=" + }, "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -839,6 +397,14 @@ "mime-types": "~2.1.24" } }, + "uid-safe": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", + "requires": { + "random-bytes": "~1.0.0" + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/package.json b/package.json index a846da9..0b592f1 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "dependencies": { "express": "^4.17.1", + "express-session": "*", "body-parser": "*" }, "scripts": { diff --git a/static/index.html b/static/index.html index 1f2249d..a930dfb 100644 --- a/static/index.html +++ b/static/index.html @@ -86,6 +86,8 @@