Package: mcgs
Monte Carlo SimulatorMonte Carlo Simulator for different board games such as Coin flips ,
Dice rolls , Roman Alphabet ,Card shuffle and many more.MetadataAuthor: Brook Tarekegn AssefaNet UD: rnc3mmProject name: Monte Carlo SimulatorSynopsisInstallationpip install mcgsImportingfrommontecarloimportDie,Game,AnalyzerCreating fair dice objects  all of six sides with the faces 1 through 6frommontecarloimportDiefair_die_faces=[1,2,3,4,5,6]fair_die=Die(fair_die_faces)Create fair coin object with faces H and TfrommontecarloimportDiecoin_faces=['H','T']fair_coin=Die(coin_faces)Playing Games with two six sided dicefrommontecarloimportDie,Gamefair_die_faces=[1,2,3,4,5,6]fair_die=Die(fair_die_faces)# Let us Play a game of 10 rolls with 2 fair dicedice=[]dice.extend([fair_die,fair_die])# Playing a Two Fair dicedice_game=Game(dice)dice_game.show(dice_game.play(10),1)# Displaying results in Wide Dataframe format (see API List Table)Playing Games with two coinsfrommontecarloimportDie,Gamecoin_faces=['H','T']fair_coin=Die(coin_faces)# Let us Play a game of 10 rolls with 2 fair coinscoins=[]coins.extend([fair_coin,fair_coin])coin_game=Game(coins)coin_game.show(coin_game.play(10),1)Analyzing games with two six sided dicefrommontecarloimportDie,Game,Analyzerfair_die_faces=[1,2,3,4,5,6]fair_die=Die(fair_die_faces)# Let us Play a game of 10 rolls with 2 fair dice# This is similar for Coins as welldice=[]dice.extend([fair_die,fair_die])dice_game=Game(dice)dice_game.show(dice_game.play(10),1)# Let us now analyze the gamedice_analyzer=Analyzer(dice_game)# Get the face count on each roll eventdice_analyzer.face_count()# Get how many times the game resulted in all faces being identical (jackpot)dice_analyzer.jackpot()# Compute the distinct/unique combinations of faces rolled along with their countsdice_analyzer.combo()# Compute how may sequence types were rolled and their countsdice_analyzer.permutation()API descriptionClass TableClass NameMethod NameAttributesDieMethodsinitchange_weightroll_dieshow_stateAttributesDescriptionfacesSides of the diceweightsValue of assigned to a facefaces_weights_dfDataframe of faces and weightsGameMethodsinitplayshowAttributesDescriptiondiceDie Object List passed from Die classcols/columnsHeaders of the play result dataframeplay_dfPlay result dataframe shape N rolls by M dicenumber_of_rollsThe number of times games/rolls playedplay_result_df_listList form of the play resultAnalyzerMethodsinitface_countshowjackpotcombopermutationAttributesDescriptiongameGame Object passed from Game Classgame_df_data_typeHolds the primitive type of the Dataframegame_result / game_result_dfGame result Dataframe shape N rolls by M dice playedface_count_dfFace Count result Dataframe shape N rolls by M die facesface_listList form of the face count resultjackpot_results_dfJackpot result Dataframe shape N of Jackpots rolls by M die facesjackpot_listList form of the jackpot resultjack_pot_indicesIndex values of where the Jackpot occurred in result Dataframecombination_dfCombination result as multi-columned Dataframe shape X of N rolls by Y die faces with Z number of occurrence.combination_listTuple zipped List form of the Combination resultpermutation_dfPermutation result as multi-columned Dataframe shape X of N rolls by Y die faces with Z number of occurrence.permutation_listTuple zipped List form of the Permutation resultMethod TableMethod NameDescription DocsParametersReturn valuesSnapshotschange_weightChange the weight of a single side/faceData typesDefaultsFace Valueinteger,string,floatinteger(1)string("")float (1.0)New Weightinteger,string,float1.0Assigns a dataframe (integer,string or float ) with faces and the newly assigned weights.roll_dieRoll the die one or more timesData typesDefaultsNumber of rollsinteger1Return a list of outcomes similar to the face types      (integer,string or float ).show_stateShow the die’s current set of faces and weightsTakes no argumentReturns the dataframe according to the face types      (integer,string or float ).playRolls the Dice using the inherited roll_die method from the Die classData typesDefaultsNumber of Rollsinteger1Returns the results of the play as a dataframe of shape N rolls by M dice.showShow the results of the most recent playData typesDefaultsPlay ResultDataFramepd.DataFrame()DataFrame table FormintegerWide (1) or Narrow(2)1Display the result of the latest play result as a dataframe of shape N rolls by M dice.face_countMethod to compute how many times a given face is rolled in each eventTakes no argumentsReturns the count for each face displayed according to the initial dice face sides given as a dataframe of shape N rolls by M dice.See how the above row show dataframe is displayed by face_count dataframe.jackpotMethod to compute how many times the game resulted in all faces being identicalTakes no argumentsReturns the count of how many times the game resulted in all faces being identical. You can also access the Jackpot Dataframe using Analyzer Object.jackpot_results_df.comboMethod to compute the distinct/unique combinations of faces rolled, along with their countsTakes no argumentsReturns the count of how many times the Game could result in distinct/unique combinations of faces when dice is played/rolled.You can also access the full combination multi-columned Dataframe using Analyzer Object.combination_df.permutationMethod to compute how may sequence types were rolled and their countsTakes no argumentsReturns the count of all the possible combinations of faces present when dice is played/rolled. You can also access the permutation multi-columned Dataframe using Analyzer Object.permutation_df.Montecarlo Simulator Demonstration