Hi all,
I've been playing around with repeaters a lot lately, and have hit on a couple of very useful things that I thought I'd pass on. I'm using it to build a fully automated version of Eli Dupree's crossbow range so I can train up marksdwarves quickly. Here's the visible part:
Key:
# wall
. floor
open space
+ door
#########################
# . ++ + ....
#########################
Goblin gets pitted onto the pillar at the left; dorfs stationed on the right. The special sauce is those two doors by the goblin: they're repeater-powered, with repeaters that work the doors fast enough to provoke and then block flying crossbow bolts (the door in the middle is used to shut down the range, since the repeaters take work to get going again after you stop them). Naturally, it's fiendishly complex, and I won't guarantee it can be built fast enough to beat dwarves sitting in front of archery targets, but it's much more fun. The only drawback: no goblins are harmed in the making or operating of this semi-megaproject. Of course, that can be arranged in other ways, such as using these repeaters to power a trap alley (next on my TODO list).
Now to get under the hood.
The first problem is getting a repeater with a reasonably short period and a sane duty cycle: the best one I know of, the two step alternating repeater courtesy of MrFake, has a 200-tick period, but with a 199:1 ON/OFF duty cycle in the best case.
Fortunately, I've worked out a couple of ways to give the two-step repeater a 100:100 duty cycle:
The first way uses the basic repeater to control a modified mist
generator:
# ! !
# %% %% %%
# %%^# %%^## %%_##
#^####_#####_#####_
The repeater is on the left, and the mist generator on the right. I've removed the power train and unrolled the mist generator to make it easier to follow (the '!' mark where the mist generator's ends should join).
The bottom pressure plate of the repeater disables the right-bottom pump of the mist generator, and the top repeater plate disables the left-bottom pump; the other two pumps are always on. That one pressure plate in the mist generator is the device's output, and it needs to be built top < plate < bottom so it sees the water as it teleports to the top of the first fall. The net result is that, every time the bottom pump enables on the repeater, the left pump pair of the mist generator kick in and move a second block of water past the pressure plate. When the top repeater pump enables, the right pair of the mist generator does as well, moving the block of water back to it origin.
The water always falls 2z in less than 100 cycles, so the mist generator has the same 200 tick period as the repeater. However, at the beginning of every 200 cycle period, the water triggers the output without staying there, so an OFF is sent after 100 ticks when the plate resets.
PRO: 100% legitimate
CON: 6 pumps
The second way exploits the hanging pressure plate bug:
#!
#^%%
# %%^#
#^####
PRO: dirt cheap and dead simple
CON: exploit
For simplicity, I'm sticking with the exploit, but the other design can be substituted if your ethics demand that you double the hardware costs of the final project.
With a good repeater in hand, the next task to figure out how to send multiple sets of ON/OFF signals to a door -- at different times -- to give it
an effective period much shorter than 200 ticks.
Here's a simplified schematic of my solution:
#^%% %% ^%%
# %%^# %%_# %%^#
#^####^####^####
There are three pairs of pumps. The leftmost ("master") and rightmost ("slave") pumps are enhanced two-step repeaters with a 50/50 duty cycle on their topmost plates. As usual, the bottom plate toggles the top pump, and the middle plate toggles the bottom pump. Water starts in the bottom chamber, though I'm not sure it actually matters.
The middle ("control") pumps are used to put the slave a precise amount out of phase with the master. The slave's main power supply is controlled by a single gear having two links: a lever, L1, and the control plate. The top control pump is powered by an AND gate, with the master's output plate at one input and a lever, L2, at the other. Finally, L3 gates power to the bottom pump. All three levers are set to OFF before adding water to the system.e
Water starts at the upper control pump's intake. To synchronize the slave, first start the master. Then, set L2 to ON to arm the top control AND gate. The next ON signal from the master enables the pump and sends the water over the edge. 10-40 ticks later, the water hits the control plate and powers up the slave. If the delay is acceptable, we're done. The two repeaters will remain synchronized with the current delay until one or both is powered off. Otherwise, we need to try again.
To shut down the slave, set L2 to OFF, disabling the top pump after 50 ticks. Set L3 to ON to power the bottom pump, and the water
will be pulled off the control plate, cutting power to the slave 150 ticks later. Set L3 to OFF and you're ready to try again. Repeat the process until the random liquid fall time is acceptable. The design can be daisy-chained to get longer delays.
Finally, we need to set up a good pattern and then synchronize the repeaters to deliver it:
Assuming five ticks per mark, a pattern like the following would almost work for target practice:
OO....OO....OO....OO..OOOO..OOOO..OOOO..
O...................C...................
......O...................C.............
............O...................C.......
..................O...................C.
..C...................O.................
........C...................O...........
..............C...................O.....
Here, we have signals arriving at T={0, 30, 60, 90, 110, 140, 170}, which gives nice 10-tick openings for part of the period, but has unacceptable 20-tick openings, too. This is where the second door comes in:
OOOOOOOOOOOOOOOOOOOO....................
O...................C...................
Together, the doors give this pattern of line of sight in each 200-tick interval:
OO....OO....OO....OO....................
Implementing this pattern requires a daisy chain of six slaves hanging off the master, with each slave delayed relative to the slave before it (delays of 30,30,30,20,30,30 ticks); tighter tolerances could probably be achieved but would take a *lot* of work to set up.
And there you have it! I'm only starting to buildi the archery range, but the pieces work so it should just be engineering to work out power train and build orders. I also plan to adapt it to raise and lower spikes in my trap alley: they're slower and don't have nearly the tight tolerance, so it should be even easier to set up.
Thoughts?