Cell[CellGroupData[{Cell[BoxData[ RowBox[{ RowBox[{"Urn", "[", RowBox[{ "good_", ",", " ", "bad_", ",", " ", "draws_", ",", " ", "need_"}], "]"}], " ", ":=", " ", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"need", " ", "<=", " ", "draws"}], " ", "&&", " ", RowBox[{"draws", " ", "<=", " ", RowBox[{"good", "+", "bad"}]}], " ", "&&", " ", RowBox[{"Not", "[", RowBox[{ RowBox[{"draws", "-", "bad"}], " ", ">", " ", "need"}], "]"}], " ", "&&", RowBox[{"need", "<=", "good"}]}], ",", "\n", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Binomial", "[", RowBox[{"good", ",", " ", "need"}], "]"}], "*", RowBox[{"Binomial", "[", RowBox[{"bad", ",", " ", RowBox[{"draws", " ", "-", " ", "need"}]}], "]"}]}], ")"}], "/", "\n", " ", RowBox[{"Binomial", "[", RowBox[{ RowBox[{"bad", " ", "+", " ", "good"}], ",", " ", "draws"}], "]"}]}], ",", " ", RowBox[{"1", "/", "7777"}]}], "]"}]}]], "Input", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{ 3.35696210375764*^9, {3.36879580085527*^9, 3.3687959132059*^9}, { 3.36879615386553*^9, 3.36879617414277*^9}, {3.36879633229324*^9, 3.36879636083566*^9}, {3.36879639997755*^9, 3.36879641069724*^9}, 3.36879647935333*^9, {3.36879682982702*^9, 3.36879683076875*^9}, { 3.36879691261405*^9, 3.36879691349439*^9}, 3.36879699012349*^9, { 3.36879761702599*^9, 3.36879761738656*^9}, {3.36879774245511*^9, 3.36879775301186*^9}, 3.760835558647791*^9}, CellID->503707234], Cell[BoxData[ RowBox[{ RowBox[{"BallRectangle", "[", RowBox[{"good_", ",", "bad_", ",", "draws_", ",", "need_"}], "]"}], ":=", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"color", "=", RowBox[{"RandomSample", "[", RowBox[{"Join", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{"1", ",", ".26", ",", "0"}], "]"}], ",", RowBox[{"{", "bad", "}"}]}], "]"}], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"RGBColor", "[", RowBox[{".67", ",", ".75", ",", ".15"}], "]"}], ",", RowBox[{"{", "good", "}"}]}], "]"}]}], "]"}], "]"}]}], ",", " ", RowBox[{"ranker", "=", RowBox[{"Partition", "[", RowBox[{ RowBox[{"Range", "[", RowBox[{"bad", "+", "good"}], "]"}], ",", RowBox[{"Floor", "[", RowBox[{"Sqrt", "[", RowBox[{"bad", "+", "good"}], "]"}], "]"}], ",", RowBox[{"Floor", "[", RowBox[{"Sqrt", "[", RowBox[{"bad", "+", "good"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"-", RowBox[{"(", RowBox[{ RowBox[{"Floor", "[", RowBox[{"Sqrt", "[", RowBox[{"bad", "+", "good"}], "]"}], "]"}], "+", "2"}], ")"}]}]}], "}"}], ",", "0"}], "]"}]}]}], "}"}], ",", RowBox[{"Grid", "[", RowBox[{ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"color", "[", RowBox[{"[", "a", "]"}], "]"}], ",", RowBox[{"Disk", "[", RowBox[{ RowBox[{"Reverse", "[", RowBox[{"First", "[", RowBox[{"Position", "[", RowBox[{"ranker", ",", "a"}], "]"}], "]"}], "]"}], ",", ".5"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"a", ",", "1", ",", RowBox[{"bad", "+", "good"}]}], "}"}]}], "]"}], ",", RowBox[{"AbsoluteThickness", "[", "4", "]"}], ",", RowBox[{"Line", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"9", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ")"}], "/", "20"}]}], ",", RowBox[{ RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "+", "1.7"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"9", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ")"}], "/", "20"}]}], ",", RowBox[{ RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "+", ".7"}]}], "}"}], ",", RowBox[{"{", RowBox[{".3", ",", RowBox[{ RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "+", ".7"}]}], "}"}], ",", RowBox[{"{", RowBox[{".3", ",", ".3"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "+", ".7"}], ",", ".3"}], "}"}], ",", RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "+", RowBox[{"{", RowBox[{".7", ",", ".7"}], "}"}]}], ",", RowBox[{"{", RowBox[{ RowBox[{"13", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ")"}], "/", "20"}]}], ",", RowBox[{ RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "+", ".7"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"13", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ")"}], "/", "20"}]}], ",", RowBox[{ RowBox[{ RowBox[{"Reverse", "[", RowBox[{"Dimensions", "[", "ranker", "]"}], "]"}], "[", RowBox[{"[", "2", "]"}], "]"}], "+", "1.7"}]}], "}"}]}], "}"}], "]"}], ",", RowBox[{"PlotRange", "->", " ", "All"}]}], "}"}], ",", RowBox[{"ImageSize", "->", " ", RowBox[{"{", RowBox[{"300", ",", "400"}], "}"}]}]}], "]"}], ",", RowBox[{"Text", "@", RowBox[{"Style", "[", RowBox[{ RowBox[{ RowBox[{"ToString", "[", "good", "]"}], "<>", "\"\< good, \>\"", "<>", RowBox[{"ToString", "[", "bad", "]"}], "<>", "\"\< bad, \>\"", "<>", RowBox[{"ToString", "[", "draws", "]"}], "<>", "\"\< drawn\\n\\n\>\"", "<>", "\"\\"", "<>", RowBox[{"ToString", "[", "need", "]"}], "<>", " ", "\"\< good ball(s) ~~ \\n\>\"", "<>", " ", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Urn", "[", RowBox[{ "good", ",", "bad", ",", "draws", ",", "need"}], "]"}], "==", RowBox[{"1", "/", "7777"}]}], ",", "\"\\"", ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Urn", "[", RowBox[{ "good", ",", "bad", ",", "draws", ",", "need"}], "]"}], "==", "1"}], ",", "\"\\"", ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Round", "[", RowBox[{"1", "/", RowBox[{"N", "[", RowBox[{"Urn", "[", RowBox[{ "good", ",", "bad", ",", "draws", ",", "need"}], "]"}], "]"}]}], "]"}], ">", RowBox[{"10", "^", "15"}]}], ",", "\"\\"", ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Urn", "[", RowBox[{ "good", ",", "bad", ",", "draws", ",", "need"}], "]"}], ">=", RowBox[{"1", "/", "2"}]}], ",", RowBox[{ RowBox[{"ToString", "[", RowBox[{"N", "[", RowBox[{"100", " ", RowBox[{"Urn", "[", RowBox[{ "good", ",", "bad", ",", "draws", ",", "need"}], "]"}]}], "]"}], "]"}], "<>", "\"\< percent chance\>\""}], ",", RowBox[{"\"\<1 in \>\"", "<>", RowBox[{"ToString", "[", RowBox[{ RowBox[{"Round", "[", RowBox[{"1", "/", RowBox[{"N", "[", RowBox[{"Urn", "[", RowBox[{ "good", ",", "bad", ",", "draws", ",", "need"}], "]"}], "]"}]}], "]"}], "-", "1"}], "]"}]}]}], "]"}]}], "]"}]}], "]"}]}], "]"}]}], ",", "12", ",", "\"\\""}], "]"}]}]}], "}"}], "}"}], ",", RowBox[{"Alignment", "->", " ", "Top"}], ",", RowBox[{"ItemSize", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", "15"}], "}"}], ",", "Automatic"}], "}"}]}]}], "]"}]}], "]"}]}]], "Input", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{ 3.35696210375764*^9, {3.3685458560901*^9, 3.3685459578673*^9}, { 3.36854602409564*^9, 3.36854602640516*^9}, {3.36854610267964*^9, 3.36854610557156*^9}, {3.36854620401744*^9, 3.36854621120709*^9}, { 3.36854625200529*^9, 3.3685462560821*^9}, {3.36854636055229*^9, 3.36854643209305*^9}, {3.36854653465557*^9, 3.3685465979841*^9}, { 3.3685466672158*^9, 3.36854686554415*^9}, {3.36854700003195*^9, 3.3685470417055*^9}, {3.36854707887136*^9, 3.36854710424092*^9}, { 3.36854802242437*^9, 3.36854803432106*^9}, {3.36854811027916*^9, 3.36854813297824*^9}, {3.36854818042445*^9, 3.36854821266096*^9}, { 3.36854841815744*^9, 3.36854851058015*^9}, {3.36854854279659*^9, 3.36854860759088*^9}, {3.36854947606925*^9, 3.36854948715275*^9}, { 3.36855082720182*^9, 3.36855087603346*^9}, 3.36855163912826*^9, { 3.3685529687267*^9, 3.36855300670925*^9}, {3.36855304620861*^9, 3.3685530918791*^9}, {3.36855345758748*^9, 3.36855346803901*^9}, { 3.36855351091817*^9, 3.36855364089828*^9}, {3.36855367330547*^9, 3.36855369864491*^9}, {3.36855374674368*^9, 3.36855381394742*^9}, 3.36855386134343*^9, {3.36855440404327*^9, 3.36855440441473*^9}, { 3.36855443469356*^9, 3.36855443485419*^9}, {3.36855528036242*^9, 3.36855533743641*^9}, {3.36855539937951*^9, 3.36855540248168*^9}, { 3.3685556126766*^9, 3.36855563467293*^9}, {3.36855568837368*^9, 3.36855579160883*^9}, {3.36855584493812*^9, 3.36855585293952*^9}, { 3.36855592078579*^9, 3.36855594584413*^9}, {3.36879681683315*^9, 3.3687968698906*^9}, {3.36879692756973*^9, 3.36879693243158*^9}, { 3.36879759830627*^9, 3.36879761975031*^9}, {3.36879910694006*^9, 3.36879917455729*^9}, {3.36879925903877*^9, 3.36879932662595*^9}, { 3.36880475146399*^9, 3.36880480279035*^9}, {3.36880485545871*^9, 3.36880491334483*^9}, {3.36880494388026*^9, 3.36880499233235*^9}, { 3.36880504341835*^9, 3.36880506643259*^9}, {3.3688087787132*^9, 3.36880877904134*^9}, {3.36935007621875*^9, 3.3693501208125*^9}, { 3.3693502385949*^9, 3.36935023867302*^9}, {3.371833460093988*^9, 3.3718334677153273`*^9}, 3.3718342161388187`*^9, 3.3718342473352327`*^9, {3.37520076794218*^9, 3.375200822207805*^9}, 3.37520090119218*^9, {3.37520097019218*^9, 3.37520099622343*^9}, {3.37520104472343*^9, 3.375201051364055*^9}, {3.375201222051555*^9, 3.37520131131718*^9}, {3.37520134969218*^9, 3.375201389582805*^9}, {3.382703020969991*^9, 3.382703021894637*^9}, 3.382703251840027*^9, {3.382812044023755*^9, 3.38281206672688*^9}, 3.760835558648025*^9}, CellID->13036470], Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"BallRectangle", "[", RowBox[{"good", ",", "bad", ",", "draws", ",", "need"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"good", ",", "8", ",", "\"\\""}], "}"}], ",", "2", ",", "200", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"bad", ",", "20", ",", "\"\\""}], "}"}], ",", "2", ",", "200", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"draws", ",", "1", ",", "\"\\""}], "}"}], ",", "1", ",", RowBox[{"good", "+", "bad"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"need", ",", "1", ",", "\"\\""}], "}"}], ",", "1", ",", "good", ",", "1"}], "}"}], ",", RowBox[{"SaveDefinitions", "->", " ", "True"}]}], "]"}]], "Input", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{ 3.35757176568782*^9, 3.36673356653348*^9, {3.3675787771572*^9, 3.36757879260942*^9}, {3.36757885019222*^9, 3.36757899932667*^9}, 3.36758039460696*^9, {3.36758071623944*^9, 3.36758072101631*^9}, 3.36758075151016*^9, {3.36794477877055*^9, 3.36794478606132*^9}, 3.36794481616581*^9, {3.36794485213897*^9, 3.36794485467272*^9}, { 3.36794512441134*^9, 3.3679451578808*^9}, {3.36794538773048*^9, 3.36794538899234*^9}, {3.36794799690911*^9, 3.3679483369484*^9}, { 3.3679483729323*^9, 3.36794837701842*^9}, {3.36794885299131*^9, 3.36794893509428*^9}, {3.36794957268924*^9, 3.36794958424655*^9}, { 3.3679498772554*^9, 3.36794993172699*^9}, {3.36818480837665*^9, 3.36818481199194*^9}, 3.3681848602288*^9, 3.36818543754994*^9, { 3.36818548748695*^9, 3.36818548846591*^9}, {3.36818567758524*^9, 3.36818572840131*^9}, {3.36821927732813*^9, 3.3682192966875*^9}, { 3.36821934840625*^9, 3.36821937607813*^9}, {3.36821943378125*^9, 3.368219449375*^9}, {3.36836298430346*^9, 3.36836300689798*^9}, { 3.36836303808562*^9, 3.36836309160738*^9}, {3.36836333957808*^9, 3.36836337913654*^9}, {3.36836397603315*^9, 3.36836399184747*^9}, { 3.36836402890445*^9, 3.36836403792832*^9}, {3.36836516304112*^9, 3.36836517132237*^9}, {3.36836613376985*^9, 3.36836616590413*^9}, { 3.36837091415447*^9, 3.3683709299777*^9}, {3.36837100257426*^9, 3.36837100824258*^9}, {3.36837365962154*^9, 3.36837366950684*^9}, { 3.36837374889971*^9, 3.36837374983116*^9}, {3.36837383094669*^9, 3.36837385853939*^9}, {3.36837393347536*^9, 3.36837398245116*^9}, { 3.36837401695456*^9, 3.36837415832333*^9}, 3.36837565790426*^9, { 3.3683757053238*^9, 3.36837577075353*^9}, {3.36838116604771*^9, 3.36838150207069*^9}, {3.3683815826782*^9, 3.36838165949094*^9}, { 3.36844331996595*^9, 3.36844341258957*^9}, {3.36844357262862*^9, 3.36844375237971*^9}, {3.36844380201772*^9, 3.36844380320111*^9}, { 3.36844406115933*^9, 3.36844409678475*^9}, {3.36844413566648*^9, 3.36844414165599*^9}, {3.36844419657317*^9, 3.3684442410037*^9}, { 3.36844428738733*^9, 3.36844431949831*^9}, {3.3684453313546*^9, 3.36844546764096*^9}, {3.36844562164543*^9, 3.36844562661332*^9}, { 3.36844577878489*^9, 3.36844581688537*^9}, {3.36844598318938*^9, 3.36844600954121*^9}, {3.36846361301616*^9, 3.36846365689274*^9}, { 3.36846407418774*^9, 3.36846413123294*^9}, {3.3684642506003*^9, 3.3684642512111*^9}, {3.36846656271815*^9, 3.36846661638887*^9}, { 3.36846899577616*^9, 3.36846905971938*^9}, {3.3685289924448*^9, 3.3685290016168*^9}, {3.36852904994002*^9, 3.36852905100141*^9}, { 3.36852918439593*^9, 3.36852919181564*^9}, {3.36852981216195*^9, 3.36852981265306*^9}, {3.36852984818389*^9, 3.36852990007192*^9}, { 3.36853021845333*^9, 3.36853028108838*^9}, 3.36853088601551*^9, 3.36853134667124*^9, {3.3685313877407*^9, 3.3685313974047*^9}, { 3.36853162271092*^9, 3.3685316230414*^9}, {3.36853189849861*^9, 3.36853191535284*^9}, {3.36853203909077*^9, 3.36853208303396*^9}, { 3.36853211717305*^9, 3.36853213295574*^9}, {3.36853301525717*^9, 3.36853303463035*^9}, {3.36853330747722*^9, 3.36853332672125*^9}, { 3.36853344107313*^9, 3.36853348305391*^9}, {3.36853357297411*^9, 3.36853357472664*^9}, 3.3685337624885*^9, 3.3685342676626*^9, { 3.36853446706073*^9, 3.36853449900131*^9}, {3.36854932954421*^9, 3.36854940627534*^9}, {3.3685494408912*^9, 3.36854944848098*^9}, { 3.36855069340674*^9, 3.36855077767746*^9}, {3.36855589332803*^9, 3.3685559122021*^9}, {3.36855596202764*^9, 3.36855602575818*^9}, { 3.3685565930318*^9, 3.36855662811683*^9}, {3.36855726061419*^9, 3.36855727602799*^9}, {3.36855733168949*^9, 3.36855733442661*^9}, { 3.36878880058005*^9, 3.36878885783532*^9}, {3.3687904766763*^9, 3.36879047745657*^9}, {3.36879056385986*^9, 3.36879059834576*^9}, 3.36879064898877*^9, 3.36879429347506*^9, {3.36879432930551*^9, 3.36879433721886*^9}, {3.36879437020451*^9, 3.36879437227801*^9}, { 3.36879440538302*^9, 3.36879444930794*^9}, {3.36879453747824*^9, 3.36879459345095*^9}, {3.36879620166332*^9, 3.36879626120267*^9}, { 3.36880873361801*^9, 3.36880873885255*^9}, 3.36935006282813*^9, 3.379169074572565*^9, {3.379169150566079*^9, 3.379169157618469*^9}, {3.3827030718054204`*^9, 3.382703072669763*^9}, {3.382812020961255*^9, 3.382812022555005*^9}, 3.7608355586334457`*^9}, CellID->1496021318], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`bad$$ = 20, $CellContext`draws$$ = 1, $CellContext`good$$ = 8, $CellContext`need$$ = 1, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`good$$], 8, "good balls"}, 2, 200, 1}, {{ Hold[$CellContext`bad$$], 20, "bad balls"}, 2, 200, 1}, {{ Hold[$CellContext`draws$$], 1, "balls drawn"}, 1, Dynamic[$CellContext`good$$ + $CellContext`bad$$], 1}, {{ Hold[$CellContext`need$$], 1, "good balls needed"}, 1, Dynamic[$CellContext`good$$], 1}}, Typeset`size$$ = { 497., {197.5, 202.5}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = False, $CellContext`good$48849$$ = 0, $CellContext`bad$48850$$ = 0, $CellContext`draws$48851$$ = 0, $CellContext`need$48852$$ = 0}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`bad$$ = 20, $CellContext`draws$$ = 1, $CellContext`good$$ = 8, $CellContext`need$$ = 1}, "ControllerVariables" :> { Hold[$CellContext`good$$, $CellContext`good$48849$$, 0], Hold[$CellContext`bad$$, $CellContext`bad$48850$$, 0], Hold[$CellContext`draws$$, $CellContext`draws$48851$$, 0], Hold[$CellContext`need$$, $CellContext`need$48852$$, 0]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> $CellContext`BallRectangle[$CellContext`good$$, \ $CellContext`bad$$, $CellContext`draws$$, $CellContext`need$$], "Specifications" :> {{{$CellContext`good$$, 8, "good balls"}, 2, 200, 1}, {{$CellContext`bad$$, 20, "bad balls"}, 2, 200, 1}, {{$CellContext`draws$$, 1, "balls drawn"}, 1, Dynamic[$CellContext`good$$ + $CellContext`bad$$], 1}, {{$CellContext`need$$, 1, "good balls needed"}, 1, Dynamic[$CellContext`good$$], 1}}, "Options" :> {}, "DefaultOptions" :> {ControllerLinking -> True}], ImageSizeCache->{542., {285., 291.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, Initialization:>({$CellContext`BallRectangle[ Pattern[$CellContext`good, Blank[]], Pattern[$CellContext`bad, Blank[]], Pattern[$CellContext`draws, Blank[]], Pattern[$CellContext`need, Blank[]]] := With[{$CellContext`color = RandomSample[ Join[ Table[ RGBColor[1, 0.26, 0], {$CellContext`bad}], Table[ RGBColor[ 0.67, 0.75, 0.15], {$CellContext`good}]]], $CellContext`ranker = Partition[ Range[$CellContext`bad + $CellContext`good], Floor[ Sqrt[$CellContext`bad + $CellContext`good]], Floor[ Sqrt[$CellContext`bad + $CellContext`good]], { 1, -(Floor[ Sqrt[$CellContext`bad + $CellContext`good]] + 2)}, 0]}, Grid[{{ Graphics[{ Table[{ Part[$CellContext`color, $CellContext`a], Disk[ Reverse[ First[ Position[$CellContext`ranker, $CellContext`a]]], 0.5]}, {$CellContext`a, 1, $CellContext`bad + $CellContext`good}], AbsoluteThickness[4], Line[{{9 (Part[ Reverse[ Dimensions[$CellContext`ranker]], 1]/20), Part[ Reverse[ Dimensions[$CellContext`ranker]], 2] + 1.7}, { 9 (Part[ Reverse[ Dimensions[$CellContext`ranker]], 1]/20), Part[ Reverse[ Dimensions[$CellContext`ranker]], 2] + 0.7}, { 0.3, Part[ Reverse[ Dimensions[$CellContext`ranker]], 2] + 0.7}, {0.3, 0.3}, {Part[ Reverse[ Dimensions[$CellContext`ranker]], 1] + 0.7, 0.3}, Reverse[ Dimensions[$CellContext`ranker]] + {0.7, 0.7}, { 13 (Part[ Reverse[ Dimensions[$CellContext`ranker]], 1]/20), Part[ Reverse[ Dimensions[$CellContext`ranker]], 2] + 0.7}, { 13 (Part[ Reverse[ Dimensions[$CellContext`ranker]], 1]/20), Part[ Reverse[ Dimensions[$CellContext`ranker]], 2] + 1.7}}], PlotRange -> All}, ImageSize -> {300, 400}], Text[ Style[ StringJoin[ ToString[$CellContext`good], " good, ", ToString[$CellContext`bad], " bad, ", ToString[$CellContext`draws], " drawn\n\n", "odds of getting exactly ", ToString[$CellContext`need], " good ball(s) ~~ \n", If[$CellContext`Urn[$CellContext`good, \ $CellContext`bad, $CellContext`draws, $CellContext`need] == 1/7777, "Impossible", If[$CellContext`Urn[$CellContext`good, \ $CellContext`bad, $CellContext`draws, $CellContext`need] == 1, "Certainty", If[Round[1/N[ $CellContext`Urn[$CellContext`good, \ $CellContext`bad, $CellContext`draws, $CellContext`need]]] > 10^15, "Remote possibility", If[$CellContext`Urn[$CellContext`good, \ $CellContext`bad, $CellContext`draws, $CellContext`need] >= 1/2, StringJoin[ ToString[ N[ 100 $CellContext`Urn[$CellContext`good, \ $CellContext`bad, $CellContext`draws, $CellContext`need]]], " percent chance"], StringJoin["1 in ", ToString[Round[1/N[ $CellContext`Urn[$CellContext`good, \ $CellContext`bad, $CellContext`draws, $CellContext`need]]] - 1]]]]]]], 12, "Label"]]}}, Alignment -> Top, ItemSize -> {{Automatic, 15}, Automatic}]], Attributes[PlotRange] = {ReadProtected}, $CellContext`Urn[ Pattern[$CellContext`good, Blank[]], Pattern[$CellContext`bad, Blank[]], Pattern[$CellContext`draws, Blank[]], Pattern[$CellContext`need, Blank[]]] := If[ And[$CellContext`need <= $CellContext`draws, \ $CellContext`draws <= $CellContext`good + $CellContext`bad, Not[$CellContext`draws - $CellContext`bad > \ $CellContext`need], $CellContext`need <= $CellContext`good], ( Binomial[$CellContext`good, $CellContext`need] Binomial[$CellContext`bad, $CellContext`draws - \ $CellContext`need])/ Binomial[$CellContext`bad + $CellContext`good, \ $CellContext`draws], 1/7777]}; Typeset`initDone$$ = True), SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{3.7608355586339273`*^9}, CellID->135816229] }, {4}]]