Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Unit Randomization and then mimic it
Unit Randomization and then mimic it
May 22 2017, 12:36 am
By: LoveLess  

May 22 2017, 12:36 am LoveLess Post #1

Let me show you how to hump without making love.

So I have 100+ units pre-placed in an area that make up a "small" grid. What I want to do is go through these and randomly select four of them to remain.

However, there are four conditions.

The first of them is that the first is limited to the outer edge of the grid, no big deal. I did this by just giving away everything besides the outermost units and then randomize among them.

The second is that they can never be next to each other, which again I solved by removing all the neighboring locations when the last unit is chosen.

The third is aimed to achieve a more broad spectrum of random units and as such only units that are intended to be skipped cannot be removed (aside from condition two) and reused again in the next cycles. Only remove the remaining units once all four have been selected.

The final is that I want the results of this randomization to be duplicated for four other sets of 100+ units. Not that big of a deal... but-

I am having issues with getting what feels like a pure random result. They always seem to wind up on the same few results. Without posting my long list of inefficient triggers that I have made now out of frustration, how would you go about achieving this?



None.

May 22 2017, 3:28 am rockz Post #2

ᴄʜᴇᴇsᴇ ɪᴛ!

Start with your grid of units, which I assume are the same.

Count the number of units with countoffs and store it in a DC.

Generate a random number from 0-DC.

Repeat the random number generation if it's bigger than DC. Save this number in DC4 for use later.

Give random number units to player 2 and make the next one owned by a player 3.

Remove all units owned by player 2 around player 3.

Give all units owned by player 3 to player 4.

Repeat until player 4 has 4 units.

Copy DC4 into DC3, DC3 into DC2, DC2 into DC1.

You can likely save players through other methods like a burrowed zergling, or other logic.

Post has been edited 1 time(s), last time on May 22 2017, 3:49 am by rockz.



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

May 22 2017, 8:08 pm Moose Post #3

We live in a society.

Is there a requirement that this randomization be done in a maximum number of trigger cycles?




May 22 2017, 8:42 pm CecilSunkure Post #4



OK, this is going to be a very weird way to do this... But. If you generate a lot of triggers with a higher level language, it can be pretty easy to pick 4 spots and then spawn those units. If you have 128 locations, get a random DC from 0-127. Then hand this DC off to the "spawner" triggers, which are all very similar to one another. Basically 128 triggers, each will spawn the individual unit. I'm assuming you've already worked out a way to spawn the units? 128 burrowed zerglings would work perfectly fine. Each zergling can act as a unique location via the Give Units action.

Can be done in a single trigger cycle.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
[06:38 pm]
Vrael -- I need a go-to solution and someone who understands that Carpets are more than just decorative elements in my home.
Please log in to shout.


Members Online: RIVE, NudeRaider