Open djwglpuppy opened 3 years ago
Branching off prob is a good idea. The example you give is easily done with TR.P + 1 TOSS
for equal chance, but you’re right that with the conditional PROB is a simpler way to weight the choice.
this is a nice addition, thank you.
i'm a little concern that the IF / PROB
pattern in the documentation makes things a little confusing for first time readers, and it'd be better to mention PROB as an addendum to the IF/ELSE section.
thanks for reviewing thus far. I agree with the docs, it felt correct putting the PROB
along side the the other conditional, but it comes across a little clunky. I will adjust.
also @tehn I am going to add to this PR a new sibling operator to PROB
called WTOSS
(WTOSS x
where x
is the weight from 0 to 100 (alias WT
)) which is a weighted toss. It runs in a similar fashion but instead returns a 1
or 0
instead of being a conditional. I have been doing it manually all the time and thought it would be easier to just do stuff like
DEL ? WTOSS 90 300 3000: TR.P 1
or cascading weighted tosses based on this PR
PRB 50: TR.P 1
ELIF WT 70: TR.P 2
ELSE: TR.P 3
@tehn I added a new OP previously mentioned to this. I typically try to keep my PRs to a singular case, but I decided to add on since they are so similar in nature for working with weighted probabilities. I just built and tested these and really hope it makes it in the next release because I already see myself using this new stuff a ton. Thankfully it was fairly easy to implement with my abysmal c knowledge. Please lemme know if anything can be done more efficiently.
Refer to the comment above for testing WTOSS
/ WT
I put the PR out in the forum and some people made some interesting points about PROB
sitting between an IF
/ ELSE
that works for their workflow. Would be be better to split this into a new [sub]OP like BPROB
? (BPRB
) (B is for Bernoulli) That way existing PROB
does not hurt their workflow.
https://llllllll.co/t/a-draft-of-some-prob-tweaks-i-made-for-teletype/48956/5
What does this PR do?
Adds Functionality to the following
PRB
is now an alias ofPROB
Having the extra character helps when createing complex patches based on Probability
PROB
can now use theELSE
statementA common use case is to use a Bernoulli gate. What this means is that it either goes to A OR to B based on a weighted coin toss
example/. (60% chance of triggering 1, otherwise trigger 2)
How should this be manually tested?
See example above
I have,
CHANGELOG.md
andwhats_new.md
help_mode.c
(if applicable)make format
on each commit