#reader(lib"read.ss""wxme")WXME0108 ## #| This file uses the GRacket editor format. Open this file in DrRacket version 7.2 or later to read it. Most likely, it was created by saving a program in DrRacket, and it probably contains a program with non-text elements (such as images or comment boxes). http://racket-lang.org/ |# 33 7 #"wxtext\0" 3 1 6 #"wxtab\0" 1 1 8 #"wximage\0" 2 0 8 #"wxmedia\0" 4 1 34 #"(lib \"syntax-browser.ss\" \"mrlib\")\0" 1 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0" 1 0 68 ( #"((lib \"image-core.ss\" \"mrlib\") (lib \"image-core-wxme.rkt\" \"mr" #"lib\"))\0" ) 1 0 16 #"drscheme:number\0" 3 0 44 #"(lib \"number-snip.ss\" \"drscheme\" \"private\")\0" 1 0 36 #"(lib \"comment-snip.ss\" \"framework\")\0" 1 0 93 ( #"((lib \"collapsed-snipclass.ss\" \"framework\") (lib \"collapsed-sni" #"pclass-wxme.ss\" \"framework\"))\0" ) 0 0 43 #"(lib \"collapsed-snipclass.ss\" \"framework\")\0" 0 0 19 #"drscheme:sexp-snip\0" 0 0 29 #"drscheme:bindings-snipclass%\0" 1 0 101 ( #"((lib \"ellipsis-snip.rkt\" \"drracket\" \"private\") (lib \"ellipsi" #"s-snip-wxme.rkt\" \"drracket\" \"private\"))\0" ) 2 0 88 ( #"((lib \"pict-snip.rkt\" \"drracket\" \"private\") (lib \"pict-snip.r" #"kt\" \"drracket\" \"private\"))\0" ) 0 0 55 #"((lib \"snip.rkt\" \"pict\") (lib \"snip-wxme.rkt\" \"pict\"))\0" 1 0 34 #"(lib \"bullet-snip.rkt\" \"browser\")\0" 0 0 25 #"(lib \"matrix.ss\" \"htdp\")\0" 1 0 22 #"drscheme:lambda-snip%\0" 1 0 29 #"drclickable-string-snipclass\0" 0 0 26 #"drracket:spacer-snipclass\0" 0 0 57 #"(lib \"hrule-snip.rkt\" \"macro-debugger\" \"syntax-browser\")\0" 1 0 26 #"drscheme:pict-value-snip%\0" 0 0 45 #"(lib \"image-snipr.ss\" \"slideshow\" \"private\")\0" 1 0 38 #"(lib \"pict-snipclass.ss\" \"slideshow\")\0" 2 0 55 #"(lib \"vertical-separator-snip.ss\" \"stepper\" \"private\")\0" 1 0 18 #"drscheme:xml-snip\0" 1 0 31 #"(lib \"xml-snipclass.ss\" \"xml\")\0" 1 0 21 #"drscheme:scheme-snip\0" 2 0 34 #"(lib \"scheme-snipclass.ss\" \"xml\")\0" 1 0 10 #"text-box%\0" 1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0" 1 0 1 6 #"wxloc\0" 0 0 59 0 1 #"\0" 0 75 1 #"\0" 0 10 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9 #"Standard\0" 0 75 9 #"Consolas\0" 0 10 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 -1 -1 2 24 #"framework:default-color\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 255 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 15 #"text:ports out\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 192 46 214 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 15 #"text:ports err\0" 0 -1 1 #"\0" 1 0 -1 -1 93 -1 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 17 #"text:ports value\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 57 89 216 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 -1 2 27 #"Matching Parenthesis Style\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:symbol\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 102 102 255 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:keyword\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 102 102 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:comment\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 249 148 40 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:string\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 51 174 51 0 0 0 -1 -1 2 35 #"framework:syntax-color:scheme:text\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 51 174 51 0 0 0 -1 -1 2 39 #"framework:syntax-color:scheme:constant\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 60 194 57 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 49 #"framework:syntax-color:scheme:hash-colon-keyword\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 151 69 43 0 0 0 -1 -1 2 42 #"framework:syntax-color:scheme:parenthesis\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 151 69 43 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:error\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:other\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 255 255 0 0 0 -1 -1 2 16 #"Misspelled Text\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 255 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 38 #"drracket:check-syntax:lexically-bound\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 50 163 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28 #"drracket:check-syntax:set!d\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 192 203 0 0 0 -1 -1 2 37 #"drracket:check-syntax:unused-require\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 192 203 0 0 0 -1 -1 2 36 #"drracket:check-syntax:free-variable\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 192 203 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 31 #"drracket:check-syntax:imported\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 166 0 255 0 0 0 -1 -1 2 47 #"drracket:check-syntax:my-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 192 203 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 50 #"drracket:check-syntax:their-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 50 205 50 0 0 0 -1 -1 2 48 #"drracket:check-syntax:unk-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 255 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 49 #"drracket:check-syntax:both-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 240 230 140 0 0 0 -1 -1 2 26 #"plt:htdp:test-coverage-on\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 255 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 1 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 2 27 #"plt:htdp:test-coverage-off\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 1 0 0 0 0 0 0 205 92 92 0 0 0 -1 -1 4 1 #"\0" 0 70 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 4 4 #"XML\0" 0 70 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 37 #"plt:module-language:test-coverage-on\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 255 255 0 0 0 -1 -1 2 38 #"plt:module-language:test-coverage-off\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 1 0 0 0 0 0 0 205 92 92 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 4 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 70 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 148 0 211 0 0 0 -1 -1 2 1 #"\0" 0 70 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 200 0 0 0 0 0 -1 -1 0 496 0 17 3 29 #";; Probability demonstrations" 0 0 24 29 1 #"\n" 0 0 17 3 25 #";; CMPU 145, Spring, 2019" 0 0 24 29 1 #"\n" 0 0 28 3 12 #"#lang racket" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"include" 0 0 24 3 1 #" " 0 0 19 3 17 #"\"prob-helper.scm\"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 26 #";; From last week's lab..." 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 15 #";; GEN-AND-TEST" 0 0 24 29 1 #"\n" 0 0 17 3 15 #";; ------------" 0 0 24 29 1 #"\n" 0 0 17 3 36 #";; INPUTS: N, a non-negative integer" 0 0 24 29 1 #"\n" 0 0 17 3 71 ( #";; GEN, a function of one input that is used to generate ran" #"dom" ) 0 0 24 29 1 #"\n" 0 0 17 3 77 ( #";; instances of some event (e.g., tossing a die, dealin" #"g a card)" ) 0 0 24 29 1 #"\n" 0 0 17 3 75 ( #";; TEST, a function that tests whether some given instance h" #"as some" ) 0 0 24 29 1 #"\n" 0 0 17 3 68 #";; property (e.g., die > three, or card is a face card)" 0 0 24 29 1 #"\n" 0 0 17 3 74 ( #";; OUTPUT: The fraction of N random trials in which the randomly gen" #"erated" ) 0 0 24 29 1 #"\n" 0 0 17 3 40 #";; instances satisfied the TEST." 0 0 24 29 1 #"\n" 0 9 709 21 0 0 0 117 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 12 #"gen-and-test" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 6 #"lambda" 0 0 24 3 2 #" (" 0 0 14 3 1 #"n" 0 0 24 3 1 #" " 0 0 14 3 3 #"gen" 0 0 24 3 1 #" " 0 0 14 3 4 #"test" 0 0 24 3 2 #" [" 0 0 14 3 5 #"print" 0 0 24 3 1 #" " 0 0 21 3 2 #"#f" 0 0 24 3 2 #"])" 0 0 24 29 1 #"\n" 0 0 24 3 4 #" " 0 0 17 3 30 #";; COUNT is a counter variable" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 15 3 3 #"let" 0 0 24 3 3 #" ((" 0 0 14 3 5 #"count" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 17 3 32 #";; FOR executes its body N times" 0 0 24 29 1 #"\n" 0 0 24 3 7 #" (" 0 0 15 3 3 #"for" 0 0 24 3 3 #" ((" 0 0 14 3 1 #"i" 0 0 24 3 1 #" " 0 0 14 3 1 #"n" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 8 #" " 0 0 17 3 43 #";; Use (GEN) to generate a random instance;" 0 0 24 29 1 #"\n" 0 0 24 3 8 #" " 0 0 17 3 54 #";; Use TEST to determine whether that instance has the" 0 0 24 29 1 #"\n" 0 0 24 3 8 #" " 0 0 17 3 19 #";; desired property" 0 0 24 29 1 #"\n" 0 0 24 3 9 #" (" 0 0 15 3 4 #"let*" 0 0 24 3 3 #" ((" 0 0 14 3 3 #"rnd" 0 0 24 3 2 #" (" 0 0 14 3 3 #"gen" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 16 #" (" 0 0 14 3 6 #"result" 0 0 24 3 2 #" (" 0 0 14 3 4 #"test" 0 0 24 3 1 #" " 0 0 14 3 3 #"rnd" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 15 3 4 #"when" 0 0 24 3 1 #" " 0 0 14 3 5 #"print" 0 0 24 29 1 #"\n" 0 0 24 3 13 #" (" 0 0 14 3 6 #"printf" 0 0 24 3 1 #" " 0 0 19 3 11 #"\"[~A: ~A] \"" 0 0 24 3 1 #" " 0 0 14 3 3 #"rnd" 0 0 24 3 1 #" " 0 0 14 3 6 #"result" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 15 3 4 #"when" 0 0 24 3 1 #" " 0 0 14 3 6 #"result" 0 0 24 29 1 #"\n" 0 0 24 3 12 #" " 0 0 17 3 56 #";; If it does, then destructively increment the counter!" 0 0 24 29 1 #"\n" 0 0 24 3 13 #" (" 0 0 14 3 4 #"set!" 0 0 24 3 1 #" " 0 0 14 3 5 #"count" 0 0 24 3 2 #" (" 0 0 14 3 1 #"+" 0 0 24 3 1 #" " 0 0 14 3 5 #"count" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 5 #")))))" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 17 3 62 #";; After the DOTIMES loop finishes, return the fraction of the" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 17 3 34 #";; trials that satisfied the TEST." 0 0 24 29 1 #"\n" 0 0 24 3 7 #" (" 0 0 14 3 1 #"/" 0 0 24 3 1 #" " 0 0 14 3 5 #"count" 0 0 24 3 1 #" " 0 0 14 3 1 #"n" 0 0 24 3 1 #" " 0 0 21 3 3 #"1.0" 0 0 24 3 4 #"))))" 0 0 24 29 1 #"\n" 0 0 0 0 24 29 1 #"\n" 0 0 17 3 4 #";;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"problem" 0 0 24 3 1 #" " 0 0 19 3 15 #"\"Dealing cards\"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 8 #";; Cards" 0 0 24 29 1 #"\n" 0 0 17 3 8 #";; -----" 0 0 24 29 1 #"\n" 0 0 17 3 64 #";; Each card represented by an integer from 0 to 51 (inclusive)." 0 0 24 29 1 #"\n" 0 0 17 3 66 #";; Rank of a card is (the remainder when dividing by 13) plus one!" 0 0 24 29 1 #"\n" 0 0 17 3 46 #";; -- Rank guaranteed to be between 1 and 13" 0 0 24 29 1 #"\n" 0 0 17 3 42 #";; -- 11-->Jack, 12-->Queen, 13-->King" 0 0 24 29 1 #"\n" 0 0 17 3 56 #";; Suit of a card is (the quotient when dividing by 13)." 0 0 24 29 1 #"\n" 0 0 17 3 45 #";; -- Suit guaranteed to be between 0 and 3" 0 0 24 29 1 #"\n" 0 0 17 3 53 #";; -- 0-->Club; 1-->Diamond, 2-->Heart, 3-->Spade" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 57 #";; Generate a full DECK of cards as a list of numeric IDs" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 16 #"create-list-from" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 6 #"lambda" 0 0 24 3 2 #" (" 0 0 14 3 1 #"n" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 14 3 2 #"if" 0 0 24 3 2 #" (" 0 0 14 3 2 #"<=" 0 0 24 3 1 #" " 0 0 14 3 1 #"n" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 9 #" (" 0 0 14 3 4 #"list" 0 0 24 3 1 #" " 0 0 21 3 1 #"0" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 9 #" (" 0 0 14 3 4 #"cons" 0 0 24 3 1 #" " 0 0 14 3 1 #"n" 0 0 24 3 2 #" (" 0 0 14 3 16 #"create-list-from" 0 0 24 3 2 #" (" 0 0 14 3 1 #"-" 0 0 24 3 1 #" " 0 0 14 3 1 #"n" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 6 #"))))))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 9 #"*deck-52*" 0 0 24 3 2 #" (" 0 0 14 3 16 #"create-list-from" 0 0 24 3 1 #" " 0 0 21 3 2 #"51" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 14 3 9 #"*deck-52*" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"newline" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"newline" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 3 #"map" 0 0 24 3 1 #" " 0 0 14 3 14 #"card->rank-str" 0 0 24 3 2 #" (" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 3 #"map" 0 0 24 3 1 #" " 0 0 14 3 14 #"card->rank-str" 0 0 24 3 2 #" (" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"newline" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 7 #";; RANK" 0 0 24 29 1 #"\n" 0 0 17 3 7 #";; ----" 0 0 24 29 1 #"\n" 0 0 17 3 54 #";; INPUT: CARD, an integer between 0 and 51 inclusive" 0 0 24 29 1 #"\n" 0 0 17 3 76 ( #";; OUTPUT: The \"rank\" of that card (an integer between 1 and 13, " #"inclusive)" ) 0 0 24 29 1 #"\n" 0 0 17 3 80 ( #";; This adjusts the output of card->rank-num to make it match the \"" #"real\" numbers" ) 0 0 24 29 1 #"\n" 0 0 17 3 76 ( #";; for cards but without producing names like \"A\", \"J\", \"Q\", a" #"nd \"K\" used by" ) 0 0 24 29 1 #"\n" 0 0 17 3 17 #";; card->rank-str" 0 0 24 29 1 #"\n" 0 0 17 3 27 #";; added to prob-helper.scm" 0 0 24 29 1 #"\n" 0 9 127 21 0 0 0 20 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 4 #"rank" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 6 #"lambda" 0 0 24 3 2 #" (" 0 0 14 3 4 #"card" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 14 3 1 #"+" 0 0 24 3 1 #" " 0 0 21 3 1 #"1" 0 0 24 3 2 #" (" 0 0 14 3 14 #"card->rank-num" 0 0 24 3 1 #" " 0 0 14 3 4 #"card" 0 0 24 3 4 #"))))" 0 0 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 4 #"sort" 0 0 24 3 2 #" (" 0 0 14 3 3 #"map" 0 0 24 3 1 #" " 0 0 14 3 4 #"rank" 0 0 24 3 2 #" (" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 3 #")) " 0 0 14 3 2 #"<=" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 4 #"sort" 0 0 24 3 2 #" (" 0 0 14 3 3 #"map" 0 0 24 3 1 #" " 0 0 14 3 4 #"rank" 0 0 24 3 2 #" (" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 3 #")) " 0 0 14 3 2 #">=" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 4 #";;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"problem" 0 0 24 3 1 #" " 0 0 19 3 36 #"\"Calculate probability: 4-of-a-kind\"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 68 #";; The number of distinct 5-card poker hands (O-R-) is 52-choose-5." 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 18 #"*num-5-card-hands*" 0 0 24 3 2 #" (" 0 0 14 3 10 #"n-choose-k" 0 0 24 3 1 #" " 0 0 21 3 2 #"52" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 14 3 18 #"*num-5-card-hands*" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 61 #";; The number of 5-card hands having four-of-a-kind = 13 * 48" 0 0 24 29 1 #"\n" 0 0 17 3 46 #";; - 13 choices for rank of the four-of-a-kind" 0 0 24 29 1 #"\n" 0 0 17 3 41 #";; - 48 choices for the non-matching card" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 28 #"*num-hands-with-4-of-a-kind*" 0 0 24 3 2 #" (" 0 0 14 3 1 #"*" 0 0 24 3 1 #" " 0 0 21 3 2 #"13" 0 0 24 3 1 #" " 0 0 21 3 2 #"48" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 14 3 28 #"*num-hands-with-4-of-a-kind*" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 49 #";; Probability of getting 4-of-a-kind is just the" 0 0 24 29 1 #"\n" 0 0 17 3 48 #";; number of hands having 4 of a kind divided by" 0 0 24 29 1 #"\n" 0 0 17 3 38 #";; the total number of possible hands." 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 21 #"*prob-of-4-of-a-kind*" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 14 3 1 #"/" 0 0 24 3 1 #" " 0 0 14 3 28 #"*num-hands-with-4-of-a-kind*" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" " 0 0 14 3 18 #"*num-5-card-hands*" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" " 0 0 21 3 3 #"1.0" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 14 3 21 #"*prob-of-4-of-a-kind*" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 4 #";;;;" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 7 #"problem" 0 0 24 3 1 #" " 0 0 19 3 51 #"\"Test probability of 4-of-a-kind with gen-and-test\"" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 23 #";; Genete a random hand" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 14 #"gen-poker-hand" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 6 #"lambda" 0 0 24 3 3 #" ()" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 14 3 13 #"choose-k-from" 0 0 24 3 1 #" " 0 0 21 3 1 #"5" 0 0 24 3 1 #" " 0 0 14 3 6 #"*deck*" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 28 #";; Test if it's 4-of-a-kind?" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 15 3 6 #"define" 0 0 24 3 1 #" " 0 0 14 3 19 #"has-four-of-a-kind?" 0 0 24 29 1 #"\n" 0 0 24 3 3 #" (" 0 0 15 3 6 #"lambda" 0 0 24 3 2 #" (" 0 0 14 3 5 #"cards" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 5 #" (" 0 0 15 3 3 #"let" 0 0 24 3 3 #" ((" 0 0 14 3 12 #"sorted-ranks" 0 0 24 3 2 #" (" 0 0 14 3 4 #"sort" 0 0 24 3 2 #" (" 0 0 14 3 3 #"map" 0 0 24 3 1 #" " 0 0 14 3 4 #"rank" 0 0 24 3 1 #" " 0 0 14 3 5 #"cards" 0 0 24 3 2 #") " 0 0 14 3 2 #"<=" 0 0 24 3 3 #")))" 0 0 24 29 1 #"\n" 0 0 24 3 6 #" " 0 0 17 3 47 #";; Should be one of: (X X X X Y) or (X Y Y Y Y)" 0 0 24 29 1 #"\n" 0 0 24 3 7 #" (" 0 0 14 3 2 #"or" 0 0 24 3 2 #" (" 0 0 14 3 1 #"=" 0 0 24 3 2 #" (" 0 0 14 3 5 #"first" 0 0 24 3 1 #" " 0 0 14 3 12 #"sorted-ranks" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 14 #" (" 0 0 14 3 6 #"fourth" 0 0 24 3 1 #" " 0 0 14 3 12 #"sorted-ranks" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 11 #" (" 0 0 14 3 1 #"=" 0 0 24 3 2 #" (" 0 0 14 3 6 #"second" 0 0 24 3 1 #" " 0 0 14 3 12 #"sorted-ranks" 0 0 24 3 1 #")" 0 0 24 29 1 #"\n" 0 0 24 3 14 #" (" 0 0 14 3 5 #"fifth" 0 0 24 3 1 #" " 0 0 14 3 12 #"sorted-ranks" 0 0 24 3 6 #"))))))" 0 0 24 29 1 #"\n" 0 0 24 29 1 #"\n" 0 0 17 3 11 #";; Simulate" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 12 #"gen-and-test" 0 0 24 3 1 #" " 0 0 21 3 6 #"100000" 0 0 24 3 1 #" " 0 0 14 3 14 #"gen-poker-hand" 0 0 24 3 1 #" " 0 0 14 3 19 #"has-four-of-a-kind?" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 12 #"gen-and-test" 0 0 24 3 1 #" " 0 0 21 3 6 #"100000" 0 0 24 3 1 #" " 0 0 14 3 14 #"gen-poker-hand" 0 0 24 3 1 #" " 0 0 14 3 19 #"has-four-of-a-kind?" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 24 3 1 #"(" 0 0 14 3 12 #"gen-and-test" 0 0 24 3 1 #" " 0 0 21 3 6 #"100000" 0 0 24 3 1 #" " 0 0 14 3 14 #"gen-poker-hand" 0 0 24 3 1 #" " 0 0 14 3 19 #"has-four-of-a-kind?" 0 0 24 3 2 #"))" 0 0 24 29 1 #"\n" 0 0 24 3 1 #"(" 0 0 14 3 6 #"tester" 0 0 24 3 1 #" " 0 0 21 3 1 #"'" 0 0 14 3 21 #"*prob-of-4-of-a-kind*" 0 0 24 3 1 #")" 0 0