v0.34 Talk:Mechanical logic

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Cart-based power-to-signal converter (cross-section)


Where ▲ is E/W (N/S) track ramp
^ is a pressure plate,
r is a roller (highest speed)
. is E/W (N/S) track

Power feeds in beside the roller on the lower level. Rollers can not be powered from above.

A cart is fed into the system with a little push from the upper-level track. Ramps hold it in place over the roller. When powered, cart travels rapidly back and forth over pressure plate, maintaining 'on' state. This can then be used to power doors, bridges, etc.

--TerryDactyl 02:07, 21 May 2012 (UTC)

Miniaturized cart-based power-to-signal converter (overhead)[edit]


where P is power source
a are each gear assemblies
arrows represent rollers and direction of force
^ represents a pressure plate.

Be careful priming this machine. I'm not entirely sure, but I doubt it should be loaded in the active state.

Delay is ~10 or 11 ticks to trigger the plate. --TerryDactyl 04:16, 25 May 2012 (UTC)

Combing Load Based Mechanics[edit]

If I'm reading this correctly, for load based mechanics, won't a 'off' state (which connects the Power Line to the Load) will essentially "short" out the system, making all outputs negative? This is ok for simple systems, but you'll want to avoid that for more complex logic... -- IdeaHat 19:32, 24 June 2012 (UTC)

You are reading it correctly. Individual gates in load-based systems require independent power sources. Vasiln 19:14, 28 June 2012 (UTC)

The all-powerful single-gear gate[edit]

The toggle-based XOR gate was a great find. Although strictly speaking it's an even/odd gate, it's just convenient that the "even" states in a two-input binary comparison are equal (00 and 11) and the "odd" states are different (01 and 10).

The even/odd distinction makes this gate extremely useful for calculations of any kind - a sum bit is generally set when an odd number of inputs are on. The easiest case is in the binary adder, where one _or_ three active inputs (0+0+1, 0+1+0, 1+0+0, 1+1+1) produce a sum output, which is easiest realised by connecting a-line, b-line and carry input all to a single gear. In a binary multiplier, i used even/odd gates for 14 of 16 sum calculations, one of them had 15 connected inputs on a single gear.

Load-based logic may be a poor choice for two-input binary gates, but it offers great possibilities when trying to measure how many of a largish number of inputs are on. A well-documented and -explained take can be found in this forum thread: http://www.bay12forums.com/smf/index.php?topic=91793.msg2561476#msg2561476

I used load-based "activity measuring" to calculate the 1-4 carries generated per bit in an eight-by-eight bit multiplier, saving me the hassle of dragging the partial results through seven successive additions. --Larix (talk) 14:54, 7 November 2013 (UTC)

P.S. Coming to think of it, effectively every gear assembly is an even/odd gate: its engaged/disengaged status depends on how many signals it has received since it was built: an even number - assembly is engaged; an odd number - assembly is disengaged. If the gear is linked to a single input, it will be synchronous to the input's states, if it's linked to multiple inputs, it'll measure if the number of active inputs is even or odd.--Larix (talk) 11:35, 8 November 2013 (UTC)