try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="f99a0984-5a80-4ef6-8841-d1363828c6d2",e._sentryDebugIdIdentifier="sentry-dbid-f99a0984-5a80-4ef6-8841-d1363828c6d2")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9756],{1185:(e,r,s)=>{"use strict";s.d(r,{y:()=>t});var t=(0,s(56489).tv)({base:"shrink-0 bg-divider border-none",variants:{orientation:{horizontal:"w-full h-divider",vertical:"h-full w-divider"}},defaultVariants:{orientation:"horizontal"}})},29466:(e,r,s)=>{"use strict";s.d(r,{d:()=>o});var t=s(68820),a=s(1185),l=s(66601);function o(e){var r;let s,o,{as:i,className:d,orientation:n,...c}=e,h=i||"hr";"hr"===h&&"vertical"===n&&(h="div");let{separatorProps:x}=(r={elementType:"string"==typeof h?h:"hr",orientation:n},o=(0,t.$)(r,{enabled:"string"==typeof r.elementType}),("vertical"===r.orientation&&(s="vertical"),"hr"!==r.elementType)?{separatorProps:{...o,role:"separator","aria-orientation":s}}:{separatorProps:o}),y=(0,l.useMemo)(()=>(0,a.y)({orientation:n,className:d}),[n,d]);return{Component:h,getDividerProps:(0,l.useCallback)((e={})=>({className:y,role:"separator","data-orientation":n,...x,...c,...e}),[y,n,x,c])}}},32806:(e,r,s)=>{Promise.resolve().then(s.bind(s,52470))},52470:(e,r,s)=>{"use strict";s.r(r),s.d(r,{default:()=>x});var t=s(84573),a=s(5406),l=s(56794),o=s(31057),i=s(87039),d=s(24716),n=s.n(d),c=s(78927),h=s(66601);function x(){let[e,r]=(0,h.useState)([]),[s,d]=(0,h.useState)([]),x=c.b.find(e=>"ergodicity"==e.slug),y=()=>{r(e=>[...e,.6>Math.random()]),d(e=>[...e,.5>Math.random()])},p=()=>{r([]),d([])},m=(0,t.jsxs)("div",{className:"max-w-2xl mx-auto flex flex-col gap-4",children:[(0,t.jsx)("h1",{className:"text-center mb-4",children:"Basketball & Ergodicity"}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("p",{children:["This game will show you why redistribution is often a good idea"," ",(0,t.jsx)("b",{children:"even when you're better than the people you redistribute with."})]}),(0,t.jsxs)("p",{children:["Imagine playing the following game. You start with $100. Every round, you shoot a basketball; if you make the shot, you double your money, and if you fail, you halve it. Your chances of making the shot are"," ",60,"%."]}),(0,t.jsxs)("p",{children:["Your friend is also playing this game. However, he is worse than you, and only has a ",50,"% chance of making the shot."]}),(0,t.jsx)("p",{children:"You have the option, after each round, to poll your money together with your friend and split it evenly. Would you take this option?"}),(0,t.jsx)("p",{children:"Let's find out what's the best strategy!"})]})]}),b=(0,t.jsxs)("div",{className:"max-w-2xl mx-auto flex flex-col gap-4",children:[(0,t.jsx)(l.y,{className:"w-full my-4"}),(0,t.jsxs)("p",{className:"text-center text-sm italic",children:["This game is part of my book"," ",(0,t.jsx)("i",{children:(0,t.jsx)(n(),{href:"/books/ergodicity",children:"Ergodicity"})}),"."]})]});return(0,t.jsxs)("div",{className:"mx-auto flex max-w-3xl flex-col gap-8 items-center",children:[m,(()=>{let r=e.length,l=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"w-full text-center font-bold",children:"Shots"}),(0,t.jsxs)("table",{className:"border-collapse border border-gray-300 text-tiny",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Round"}),(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Your Shot"}),(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Their Shot"})]})}),(0,t.jsx)("tbody",{children:Array.from({length:r},(r,a)=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:a+1}),(0,t.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:e[a]?"✅":"❌"}),(0,t.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:s[a]?"✅":"❌"})]},a))})]})]}),o=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"w-full text-center font-bold",children:"Without redistribution"}),(0,t.jsxs)("table",{className:"border-collapse border border-gray-300 text-tiny",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Round"}),(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Your Money"}),(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"His Money"})]})}),(0,t.jsx)("tbody",{children:Array.from({length:r},(r,a)=>{let l=e.slice(0,a+1).reduce((e,r)=>r?2*e:e/2,100),o=s.slice(0,a+1).reduce((e,r)=>r?2*e:e/2,100);return(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:a+1}),(0,t.jsxs)("td",{className:"border border-gray-300 px-4 py-2 font-bold",children:["$",l.toFixed(2)]}),(0,t.jsxs)("td",{className:"border border-gray-300 px-4 py-2",children:["$",o.toFixed(2)]})]},a)})})]})]}),d=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("p",{className:"w-full text-center font-bold",children:"With redistribution"}),(0,t.jsxs)("table",{className:"border-collapse border border-gray-300 text-tiny",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Round"}),(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"Your Money"}),(0,t.jsx)("th",{className:"border border-gray-300 px-4 py-2",children:"His Money"})]})}),(0,t.jsx)("tbody",{children:Array.from({length:r},(r,a)=>{let l=100,o=100;for(let r=0;r<=a;r++){let t=(l=e[r]?2*l:l/2)+(o=s[r]?2*o:o/2);l=t/2,o=t/2}return(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:a+1}),(0,t.jsxs)("td",{className:"border border-gray-300 px-4 py-2 font-bold",children:["$",l.toFixed(2)]}),(0,t.jsxs)("td",{className:"border border-gray-300 px-4 py-2",children:["$",o.toFixed(2)]})]},a)})})]})]}),n=r>=10;return(0,t.jsxs)(i.a,{orientation:"vertical",className:"max-w-3xl mx-auto",children:[(0,t.jsx)("div",{className:"flex flex-col gap-2",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"text-sm text-center",children:["As you can see, after playing a few rounds, you are more likely to have more money if you decide to redistribute"," ",(0,t.jsx)("b",{children:"even if the other player is worse than you."})]}),(0,t.jsxs)("p",{className:"mx-auto max-w-lg text-tiny text-gray-500 text-center",children:[(0,t.jsx)("b",{children:"Note:"})," as this is a game of chance, it's not guaranteed that redistributing is always the winning strategy. It's merely more likely to be the best strategy. You can try playing this game multiple times to see what happens."]})]}):(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("p",{className:"text-sm text-center",children:["Play ",10," rounds to see what happens over time."]})})}),(0,t.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,t.jsx)(a.T,{color:"primary",size:"sm",onPress:y,disabled:n,variant:n?"bordered":"solid",children:"Next"}),(0,t.jsx)(a.T,{color:"primary",size:"sm",variant:n?"solid":"bordered",onPress:p,children:"Reset"})]}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row overflow-auto gap-4 items-center",children:[l,o,d]}),(0,t.jsxs)("p",{className:"text-tiny text-center italic",children:[(0,t.jsx)("b",{children:"Note:"})," the results are randomly generated using the parameters above."]})]})})(),b,x&&(0,t.jsx)(o.j,{book:x})]})}},56794:(e,r,s)=>{"use strict";s.d(r,{y:()=>i});var t=s(29466),a=s(98858),l=s(84573),o=(0,a.Rf)((e,r)=>{let{Component:s,getDividerProps:a}=(0,t.d)({...e});return(0,l.jsx)(s,{ref:r,...a()})});o.displayName="HeroUI.Divider";var i=o}},e=>{var r=r=>e(e.s=r);e.O(0,[915,8206,4445,5406,5507,224,3477,7763,2041,8927,1057,1004,6306,7358],()=>r(32806)),_N_E=e.O()}]);