Scrap Mechanic

Scrap Mechanic

评价数不足
best zero-error frame-perfect random generator... with completely lossless timed output - mp testing
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
34.676 KB
2024 年 11 月 6 日 下午 9:59
1 项改动说明 ( 查看 )

订阅以下载
best zero-error frame-perfect random generator... with completely lossless timed output - mp testing

描述
Best Zero-Error Frame-Perfect Random Choice Generator.

With the option of timed output.

Also with modpack distribution testing.

----

First note, the entire purpose of the logic is to make things frame-perfect and errorless. Without the logic, there are chances for multiple or no sensors to be signaled, which makes them less helpful for things that need randomization.

Here's how the logic works:


The first section, black, toggles a set of 4 XORs everytime a different sensor is signaled. The sensors are signaled by a randomly rotating mechanism. The randomness is great due to bad physics between two hand objects.

The orange section directly after the black section converts the black section XORs into 2 bits.

The dark grey is logic to turn those 2 bits into a single output out of 4. The green section directly following, the outputs, will ALWAYS only have a single gate on at any time. There will never be more or less than one output. This is frame-perfect.

These 4 outputs are the standard frame-perfect output of this blueprint. A zero-error 4 choice selection.


The light gray section takes the standard output, and makes it timed. It polls from the standard output at a set interval. The green section here is the timed output. This is also frame perfect.

The yellow section is timed as well, and polls from the timed section, but only signals at the given interval. It's a single-frame pulse of the current timed output choice.

----

Any red section is just for testing:

- The two red XOR gates are just to show that both of the main outputs are frame-perfect. Notice they never flash, meaning the output is ALWAYS only 1 of the 4 options. Never more, never less.
- The large red section is just to show the distribution of the timed outputs, to show how evenly distributed the outputs are.

----

If you don't need timed output, just remove everything after the standard output. That is, the light grey section and everything after it.

If you do need timed output but don't need it to be single-frame outputs, just remove the yellow section and use the green before it.

Anything for testing can also be removed of course.

----

By default the timing is set to change the output every 1 second.

If you need to adjust the timing, just ensure the following:

- The 4 timers grouped must each be the same exact length. This is how often the timed output will change.
- The timer off to the side must be exactly 2 ticks less than half the amount chosen for those 4.