when run the first timethe call checkpascal( printed probability of winning this is indeed quite close to ( / ) typing )** into the python shell produces pass or don' passnot all questions about games of chance are so easily answered in the game crapsthe shooter (the person who rolls the dicechooses between making "pass lineor "don' pass linebet pass lineshooter wins if the first roll (called coming outis "natural( or and loses if it is "craps( or if some other number is rolledthat number becomes the "pointand the shooter keeps rolling if the shooter rolls the point before rolling the shooter wins otherwise the shooter loses don' pass lineshooter loses if the first roll is or wins if it is or and ties ( "pushin gambling jargonif it is if some other number is rolledthat number becomes the point and shooter keeps rolling if the shooter rolls before rolling the pointthe shooter wins otherwise the shooter loses is one of these better bet than the otheris either good betit is possible to analytically derive the answer to these questionsbut it seems easier (at least to usto write program that simulates craps gameand see what happens figure contains the heart of such simulation the values of the instance variables of an instance of class crapsgame records the performance of the pass and don' pass lines since the start of the game the observer methods passresults and dpresults return these values the method playhand simulates one "hand" of game the bulk of the code in playhand is merely an algorithmic description of the rules stated above notice that there is loop in the else clause corresponding to what happens after point is established it is exited using break statement when either seven or the point is rolled hand starts when the shooter is "coming out,the term used in craps for roll before point is established hand ends when the shooter has won or lost his or her initial bet