Page 1 of 1

Coinflip

Posted: Fri Sep 07, 2018 8:56 am
by flyeatsdog
Coinflip is a 50-50 chance only,or? But that doesn't mean that we can't even the odds on more choices.
Here are my thoughts on how to even the chances:

ET=Event Trigger, O=Order, V=Modify Value, Trigger=Perform Event

ET:Choice 1
O:0 V:c1=1
O:0 V:c1=2 Crit:Coinflip
O:1 Trigger:Choice 2

ET:Choice 2
O:0 V:c2=1 Crit:c1=1
O:0 V:c2=2 Crit:c1=1;Coinflip
O:0 V:c2=3 Crit:c1=2
O:0 V:c2=4 Crit:c1=2;Coinflip

c1=1 and c1=2 should both have a chance of 50%.
c2=1, c2=2, c2=3 and c2=4 should all have a chance of 25%.


ET:CChoice 1
O:0 V:cc1=1
O:0 V:cc1=2 Crit:Coinflip
O:1 Trigger:CChoice 2

ET:CChoice 2
O:0 V:cc2=1 Crit:cc1=1
O:0 V:cc2=2 Crit:cc1=1;Coinflip
O:0 V:cc2=3 Crit:cc1=2
O:0 V:cc2=4 Crit:cc1=2;Coinflip
O:1 V:cc1=0 Crit:cc2=4
O:1 V:cc2=0 Crit:cc2=4
O:2 Trigger:CChoice 1 Crit:cc2=0

cc2=1, cc2=2, cc2=3 and cc2=4 should all have a chance of 25%, but since cc2=4 resets the values and jumps back
it should even the chances for cc2=1, cc2=2 and cc2=3 to be 33,33%.

This could be expanded to more choices. I have added a file where you can see or test it. Please correct me if i'm wrong.
Is my thinking right? Is there maybe a better/easier way to do it?

Re: Coinflip

Posted: Fri Sep 07, 2018 11:02 am
by peter980
I'm already doing something like this in my story.

For example two conflips in condition equals 25% chance.

Or if you assign separate variable to result of both conditions, you essentilly get binary number between 0-3 (00, 01, 10, 11), whivh you can use as random select between 4 choices.

Re: Coinflip

Posted: Fri Sep 07, 2018 11:47 am
by flyeatsdog
Thanks for your fast reply. I'm gonna check it out.

Re: Coinflip

Posted: Fri Sep 07, 2018 12:21 pm
by eekdon
Yep, you can do a fair amount with coin flips and nesting them (as I believe you're discussing here) can allow for some interesting possibilities. Always just be aware that a coin flip by itself will execute the moment it "passes". E.g. our warpto's when the Original Story starts can effectively have the characters warp to several places prior to the checking against the result of their final flip. Oops.

Re: Coinflip

Posted: Sat Sep 08, 2018 12:34 am
by e2pii
You can simplify that considerably.

modify value x set 0 (if not already)
modify value x add 1, criteria coinflip
modify value x add 2, criteria coinflip
modify value x add 4, criteria coinflip
and so on.

Then x has a uniform distribution (equal probability) from 0 to 2^(n)-1. And don't forget you can use less than, greater than, and inequality checks when deciding what values trigger what events.

Re: Coinflip

Posted: Wed Sep 12, 2018 7:35 am
by flyeatsdog
Thanks e2pii. Thats alot easier.