Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stochastic functionality #7

Open
vvoovv opened this issue Nov 15, 2014 · 0 comments
Open

Stochastic functionality #7

vvoovv opened this issue Nov 15, 2014 · 0 comments

Comments

@vvoovv
Copy link
Owner

vvoovv commented Nov 15, 2014

Use case. Place an air conditioner in 30% of windows, a flower box in 20% of windows and both an air conditioner and a flower box in the rest of cases.

The proposed solution:

@rule
def Window()
    if pct(30):
        AirConditioner()
    elif pct(20):
        FlowerBox():
    elif pct():
        AirConditioner()
        FlowerBox():

pct is abbreviation for percent.

pct() without argument means "for the rest of cases". It also cleans up the internal stuff responsible for random values and makes it ready for the next usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant