Coinflip

General discussion of the House Party CSC, or get help making your own story.
Forum rules
Please follow all Eek! Forum rules.
Post Reply
flyeatsdog
Posts: 34
Joined: Thu Aug 09, 2018 10:02 pm

Coinflip

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?
Attachments
Choices.zip
(107.61 KiB) Downloaded 366 times
peter980
Posts: 1601
Joined: Thu Feb 15, 2018 1:50 am

Re: Coinflip

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.
flyeatsdog
Posts: 34
Joined: Thu Aug 09, 2018 10:02 pm

Re: Coinflip

Thanks for your fast reply. I'm gonna check it out.
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

Re: Coinflip

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.
Image
e2pii
Posts: 36
Joined: Mon Aug 06, 2018 6:48 pm

Re: Coinflip

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.
flyeatsdog
Posts: 34
Joined: Thu Aug 09, 2018 10:02 pm

Re: Coinflip

Thanks e2pii. Thats alot easier.
Post Reply