Skip to main content

A simple dice package which has a type Dice

Project description

Dice Package

This is a simple dice package which has the type Dice which can have a value between 1 and the number of sides.

Importing

Import dice

You can import the dice package by:

from dice_tb import dice

Import dice_simulation

You can import the dice package by:

from dice_tb import dice_simulation

Uses

How you can use this package.

Using dice

How you can use dice.

Instantiate dice.Dice

You can use the dice using:

d1 = dice.Dice()

which has the value:

d1.sides
d1.value

of 6 and -1.

Or you can use the dice by setting the sides using:

d2 = dice.Dice(sides=20)

which has the value:

d2.sides
d2.value

of 20 and -1.

Using roll

You can roll a dice using:

d3 = dice.roll(d1)

which generates a new dice d3 with different values.

You can roll a dice using a seed:

d4 = dice.roll(d1, seed=5)
d5 = dice.roll(d4, seed=5)

where d4.value == d5.value.

Using dice_simulation

How you can use dice.

You can simulate dice roll for a simple game that computes the sum of 2 six-sided dice, where the player starts with a $100 bankroll, each roll you bet $1, and if the sum is 7, 11, or a pair then you make $2 otherwise you lose $1.

The outcomes of the set of rolls.

You can run the Monte Carlo Simulation using:

monte_carlo_simulation = dice_simulation.MonteCarloSimulation(None, dice_simulation.setup_before_all_simulations, dice_simulation.simulation_loop_body, dice_simulation.display)
monte_carlo_simulation.run_simulation()
dice_simulation.monte_carlo(1000)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dice_tb-0.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

dice_tb-0.0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file dice_tb-0.0.1.tar.gz.

File metadata

  • Download URL: dice_tb-0.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for dice_tb-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ae6206d847cb0ee5d4b40e50bf5aea548ff3a253aa057f17663961e8cf59545e
MD5 c88a3afbe43fbf4487b430c02e6d29dc
BLAKE2b-256 3a38f91c0fb83f84611c6b3d1a6bb0d1fcb6dda622b67b06d57c7f6a2f7f4325

See more details on using hashes here.

File details

Details for the file dice_tb-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dice_tb-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for dice_tb-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e9ce9fc101ff510eff64021be4afdc9fcbc50bff2cebdf6668ab800548806ed
MD5 f809dff591ec3e05c17547e736a82071
BLAKE2b-256 bbcbbd26e1563045b33f54dff5ebd38682f3e44aa8af04e0714dcaada7dd036e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page