DS5100 Final Project Fall 2022
Suraj Kunthu
sk9km
UVA School of Data Science
Clone the git repo:
git clone https://github.com/surajkunthu/ds5100_MonteCarloSim.git
Next install the package:
!pip install montecarlo
Import into your python code
from ds5100_MonteCarloSim.montecarlo.montecarlo import Die, Game, Analyzer
There are three classes: Die
, Game
, and Analyzer
test = Die(faces = [])
test_game = Game(object_list = [test])
test_game.play(rolls = )
test_analyze = Game(game_object = [test_game])
test_analyze.jackpot()
test_analyze.combo()
Doc String: A die has N sides, or “faces”, and W weights, and can be rolled to select a face
Methods:
change_weights(self, face, weight)
: A method to change the weight of a single sideself
.face
: face chosen to change weightself
.new_weight
: weight being changed
roll_die(self, rolls = 1)
: Method to roll the die, receive random die roll resultsself
.rolls
: how many dice rolls?
show_die(self)
: A method to show the user the die’s current set of faces and weights
Doc String: A game consists of rolling of one or more dice of the same kind one or more times. The class has a behavior to play a game, i.e. to roll all of the dice a given number of times
Methods:
play(self, rolls)
: Play method takes a parameter to specify how many times the dice should be rolledself
.rolls
: how many rolls in game play
show(self, form = "Wide")
: method displays th user the results of the most recent play in narrow or wide (default) dataframeself
.form
: choose "wide" (default) table or "narrow" table
Doc String: An analyzer takes the results of a single game and computes various descriptive statistical properties about it Methods:
count_face(self)
: Method to compute how many times a given face is rolled in each eventjackpot(self)
: Method to compute how many times the game resulted in all faces being identicalcombo(self)
: Method to compute the distinct combinations of faces rolled, along with their counts