Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Probability and mass creating triggers
Probability and mass creating triggers
This topic is locked. You can no longer write replies here.
Feb 19 2010, 5:06 am
By: Newb  

Feb 19 2010, 5:06 am Newb Post #1



First off, I would like to know how many triggers it would take if:
There are 5 dice, 1-6 may be rolled. How many possibilities are there of each number appearing?

Ex.
Roll one 1
Roll one 2
Roll one 3
Roll one 4
Roll one 5
Next Possibility

Roll two 1s
Roll one 2
Roll one 3
Roll one 6

Depending on the number I won't even bother, but if it's not too much, then the other thing is how do I mass spam create these triggers with little chance of repeating or missing one?



None.

Feb 19 2010, 5:52 am NudeRaider Post #2

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

There's multiple ways to go about it. Here's how I'd do it.
11 triggers, 5 switches, 5 dcs:

Randomize:
C: Always
A: Randomize Switch 1-5 (5 actions)

Add to Dice x: (5 triggers)
C: switch x is set
A: Add 1 to death counts of "Dice x" for Current Player

Reset Dice x when at 7: (5 triggers)
C: Deaths of Dice x for Current Player is at least 7
A: Set to 1 death counts of "Dice x" for Current Player

Of course all triggers need to be preserved.

Optimizations/Variations:
- You could reduce the amount of death counters used if there's always the 5 same players present (e.g. 4 computers and Player 1). Instead of using 5 seperate counters use the counts of the same dc for different players. Doing that for dynamic player changes (e.g. leavers, open slots, etc.) is pretty hard, so I'm not going into that
- You could use a single switch for randomization if you add another randomization trigger before each of the Add to dice x triggers.




Feb 19 2010, 6:07 am CecilSunkure Post #3



Nuderaider has the best method posted up already. I believe this would only take 1 trigger for randomizing the switches, 6 triggers (1 per switch + 1 in case all are not set). You need your one to reset the DC. So yeah, like 10 triggers for the randomization part. All other triggers would include what you do with the randomized number.



None.

Feb 19 2010, 9:37 pm rockz Post #4

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote from Newb
There are 5 dice, 1-6 may be rolled. How many possibilities are there of each number appearing?
(6+5-1)!/(5!(6-1)!)=252 different combinations. You've got a 1/6^5 chance of getting all the same number, or a specific order of numbers. (ie 12345 in that order).

Nude's method will be psuedorandom, so you have to factor in time. If you reroll on the next frame, the number isn't really that random anymore. There's a very good chance half will stay the same and half will increase by 1 each. If you want to roll a lot, you'll need to randomize 3 switches per die (you can easily reuse the same switch, it's single switch randomization in the wiki) and reroll when you score two pre chosen numbers (ie 0 or 7). If you only roll at non-constant intervals, the process will be fairly random.

Post has been edited 1 time(s), last time on Feb 19 2010, 10:27 pm by rockz.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Feb 19 2010, 10:39 pm Newb Post #5



Well I'm not for sure if those methods would work, here is what I was thinking of doing but it would take awhile. Yes it is a yahtzee map. I already have something that calculates the death counts, just a matter of not messing up making every trigger or an easier way. I have no idea where to get the psuedorandom and how to use it.


Conditions:
Bring("Current Player", "Terran Marine", "Chance", Exactly, 1);
Bring("Current Player", "Terran Firebat", "Chance X", Exactly, 0);
Switch("Round 1", set);
Deaths("Player 7", "Unused type 2", Exactly, 1);
Deaths("Player 7", "Zerg Egg", Exactly, 1);
Deaths("Player 7", "Zerg Larva", Exactly, 1);
Deaths("Player 7", "Zerg Lurker Egg", Exactly, 2);

Actions:
Set Deaths("Current Player", "Uraj Crystal", Add, 1);
Display Text Message(Always Display, "\x013\x007Chance\r\n\x013\x007+11 Points");
Set Score("Current Player", Add, 11, Custom);
Set Deaths("Player 7", "Unused type 1", Subtract, 5);
Set Deaths("Player 7", "Unused type 2", Subtract, 5);
Set Deaths("Player 7", "Zerg Egg", Subtract, 5);
Set Deaths("Player 7", "Zerg Larva", Subtract, 5);
Set Deaths("Player 7", "Zerg Lurker Egg", Subtract, 5);
Set Deaths("Player 7", "Floor Hatch (UNUSED)", Subtract, 5);
Set Switch("Switch1", clear);
Set Switch("Switch2", clear);
Set Switch("Switch3", clear);
Set Switch("Switch4", clear);
Set Switch("Switch5", clear);
Set Switch("Switch6", clear);
Set Switch("Switch7", clear);
Set Switch("Switch8", clear);
Set Switch("Switch9", clear);
Set Switch("Switch10", clear);
Set Switch("Switch100", clear);
Set Switch("Switch101", clear);
Set Switch("Switch102", clear);
Set Switch("Switch103", clear);
Set Switch("Switch104", clear);
Set Deaths("Current Player", "Duke Turret type 1", Subtract, 1);
Set Deaths("Player 7", "Cave", Subtract, 1);
Set Deaths("Player 7", "Cave-in", Subtract, 1);
Set Deaths("Player 7", "Cocoon", Subtract, 1);
Set Deaths("Player 7", "Danimoth (Arbiter)", Subtract, 1);
Set Deaths("Player 7", "Dark Swarm", Subtract, 1);
Set Deaths("Current Player", "Alan Turret", Subtract, 1);
Set Deaths("Current Player", "Tank Turret type 1", Subtract, 1);
Set Deaths("Current Player", "Duke Turret type 2", Subtract, 1);
Set Deaths("Current Player", "Goliath Turret", Subtract, 1);
Set Deaths("Current Player", "Scanner Sweep", Subtract, 1);
Remove Unit At Location("Player 7", "Protoss Carrier", All, "Fill All");
Set Deaths("Current Player", "Unused Zerg Bldg 5", Subtract, 3);
Set Deaths("Player 7", "Unused Zerg Bldg", Add, 1);
Move Unit("Current Player", "Men", All, "Score Choose", "Unit Stay");
Move Location("Current Player", "Uraj Crystal", "Anywhere", "X Create");
Create Unit("Current Player", "Terran Firebat", 1, "X Create");
Remove Unit At Location("Current Player", "Terran Civilian", All, "Fill Dice1");
Remove Unit At Location("Current Player", "Terran Civilian", All, "Fill Dice2");
Remove Unit At Location("Current Player", "Terran Civilian", All, "Fill Dice3");
Remove Unit At Location("Current Player", "Terran Civilian", All, "Fill Dice4");
Remove Unit At Location("Current Player", "Terran Civilian", All, "Fill Dice5");
Set Switch("Here p1", set);
Set Switch("Here p2", set);
Set Switch("Here p3", set);
Set Switch("Here p4", set);
Set Switch("Here p5", set);
Set Switch("Here p6", set);
Set Switch("Display Roll #", clear);
Preserve Trigger();
}

//-----------------------------------------------------------------//



None.

Feb 19 2010, 11:05 pm NudeRaider Post #6

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

I think my method will be fine for a yahtzee map. If you notice predictable numbers in a quick reroll (shouldn't be predictable anymore after at most 2 seconds) then do what rockz said randomize 3 switches per die, so you get a non-pseudorandom number.

I have no idea what you're asking, what this trigger should be doing or why you posted it...

In case you're having problems with pseudorandom: This means that the number is random, but is partially predictable. Given enough time you can't foretell in which range the dice will be, but the next trigger loop you know it's either the same as before or just 1 more, thus not being fully random.




Feb 19 2010, 11:17 pm Newb Post #7



So I should probably calculate the dice total separately; although, I'm not for sure if that's what you meant since you guys are talking about randomizing. I was needing to calculate chance, which is the total of all the dice numbers. Ex. 1+2+4+5+6= score of 18 points
Thanks for the help of giving me the idea :cool:

(may be locked) Oh wait, before this gets locked, anyone mind answering how many triggers there will be if there is 5 slots and they may either be on or off?

Post has been edited 2 time(s), last time on Feb 19 2010, 11:34 pm by Newb.



None.

Feb 19 2010, 11:38 pm azala Post #8



Quote from rockz
Nude's method will be psuedorandom, so you have to factor in time.
Is it seeded by int(time) in SC seconds? (the answer is no, because otherwise if you ran a randomizer in a map with hypers, you would consistently get blocks of 8 consecutive same values, which I've tested and is not the case.) You would have to know how the pseudorandom number list is seeded to make that assertion.

Quote from rockz
If you reroll on the next frame, the number isn't really that random anymore.
This is *very* interesting if true. What was your methodology in testing it? (providing a test map is fine too, just so I can see what you did to come up with that conclusion)

Quote from rockz
There's a very good chance half will stay the same and half will increase by 1 each.
What do you mean by that?



None.

Feb 20 2010, 12:14 am MetalGear Post #9



if you want... let me trigger it for you. it will be 100% accurate... ive done loads of this binary stuff before. just tell me exactly what needs to happen and im happy to do it.



None.

Feb 20 2010, 12:15 am Kenoli Post #10



Quote from azala
Quote from rockz
Nude's method will be psuedorandom, so you have to factor in time.
Is it seeded by int(time) in SC seconds? (the answer is no, because otherwise if you ran a randomizer in a map with hypers, you would consistently get blocks of 8 consecutive same values, which I've tested and is not the case.) You would have to know how the pseudorandom number list is seeded to make that assertion.

Quote from rockz
If you reroll on the next frame, the number isn't really that random anymore.
This is *very* interesting if true. What was your methodology in testing it? (providing a test map is fine too, just so I can see what you did to come up with that conclusion)

Quote from rockz
There's a very good chance half will stay the same and half will increase by 1 each.
What do you mean by that?
The system described by NudeRaider merely iterates a counter. The way you get 'random' values out of it is by using player input, which is essentially unpredictable and more or less unexploitable. The randomized switches serve no purpose.



None.

Feb 20 2010, 12:45 am NudeRaider Post #11

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from azala
Quote from rockz
Nude's method will be psuedorandom, so you have to factor in time.
Is it seeded by int(time) in SC seconds? (the answer is no, because otherwise if you ran a randomizer in a map with hypers, you would consistently get blocks of 8 consecutive same values, which I've tested and is not the case.) You would have to know how the pseudorandom number list is seeded to make that assertion.
Quote from rockz
If you reroll on the next frame, the number isn't really that random anymore.
This is *very* interesting if true. What was your methodology in testing it? (providing a test map is fine too, just so I can see what you did to come up with that conclusion)
Quote from rockz
There's a very good chance half will stay the same and half will increase by 1 each.
What do you mean by that?
Yes, technically every random number a computer generates is pseudo random. But for all intends and purposes a randomized switch is truly random.
rockz meant that he has to wait a bit until the numbers aren't predictable (=pseudo random) anymore.
Since I just add 1 to the dcs you know the next trigger loop the number is either the same or just 1 greater. Not very random.
Quote from Kenoli
The way you get 'random' values out of it is by using player input, which is essentially unpredictable and more or less unexploitable. The randomized switches serve no purpose.
The randomized switches serve the purpose of not having all dice have the same value.
Quote from Newb
anyone mind answering how many triggers there will be if there is 5 slots and they may either be on or off?
First you need to chose a randomization system and then we can tell you what the chances are to get a certain value and how many triggers it will need.

Post has been edited 1 time(s), last time on Feb 20 2010, 4:12 am by Cervantes. Reason: Slightly dickish.




Feb 20 2010, 1:02 am Newb Post #12



No I mean, just plain out math. If I have 5 objects and they may face forward or backwards. How many outcomes are there?

1. Forward
2. Back
3. Forward
4. Back
5. Back

1. Forward
2. Back
3. Forward
4. Back
5. Forward

1. Forward
2. Back
3. Back
4. Back
5. Forward



None.

Feb 20 2010, 1:10 am JaFF Post #13



It's the number of positions an object may have to the power of the number of the objects. So 2^5=32.



None.

Feb 20 2010, 1:13 am Newb Post #14



Thanks. I can't believe I didn't know that lol.

Post has been edited 1 time(s), last time on Feb 20 2010, 1:47 am by Newb.



None.

Feb 20 2010, 2:15 am rockz Post #15

ᴄʜᴇᴇsᴇ ɪᴛ!

FYI, you don't want to use "switch 1 is set" "Switch 2 is set" "switch 3 is set" etc for 32 triggers. Convert the switches into binary data (randomize a switch, add 1, 2, 4, 8, 16, 32, etc to a death counter if it's set) and then detect if the death counter is exactly 1, 2, 3, 4, etc... or a range of numbers. Not only can you then put a number to the trigger, but it's a lot harder to mess up.

@azala
If you look at the triggers nude posted, you'll see than from trigger run to trigger run, the largest difference you can get is 1 DC. That's not random. If all the DCs are 1, I know that next trigger run, I can ONLY get 1s and 2s. After a few trigger runs, it's impossible for me to know with certainty what the numbers will be.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Feb 20 2010, 2:19 am Newb Post #16



Ok then. Well I have all the info I need for this topic.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
Please log in to shout.


Members Online: lil-Inferno, Roy, jun3hong