v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

User:Larix

From Dwarf Fortress Wiki
Jump to navigation Jump to search

I've developed a logic discipline which could actually deserve the label "Minecart Logic", if it wasn't already taken. So i've tentatively dubbed it "Minecart Pathing Logic", since, other than the known circuits, it is based on directing moving minecarts and manipulating their paths instead of placing resting carts on top of pressure plates.

Here you can find what i've written up about this logic discipline:

User:Larix/MPL

Very compact mechanical adder with instant carry calculation and subtraction capability:

User:Larix/Adder

Some findings on the mechanics of minecart collisions:

User:Larix/Minecart Collisions

At long last, my major computing project has been successfully completed!

Programmable Minecart/mechanical Computer[edit]

Arbeitsplatz.png

  • To the best of my knowledge, this is the second ever dwarfputer capable of executing complex instructions and the first able to run by itself. It has six-bit instructions and an active program store of a mere eight words. By making full use of the 64 possibilities offered in six bits and a mass storage device as a kind of "program ROM", fairly complicated programs are possible. Two conditional operations give various options of program flow control. I implemented a simplistic "print to screen" command, a crude sorting algorithm and calculation of square roots. The latter demonstrated the long-term accuracy and capability of the computer, performing 567 program steps in constant self-controlled operation, while not only the final but also all observed intermediate results were correct: it returned 28 as square root of 840 - the output had to be an integer, rounded down to the nearest value.

Thread with massive design notes, programming language reference, square root program explained: http://www.bay12forums.com/smf/index.php?topic=147725.0

Odds and Ends[edit]

A collection of Dwarf Logic projects, ranging from an overengineered silly joke to overengineered solutions for simple problems or challenges to... overengineered overengineering:


Maple 6/6 Programmable Computer[edit]

  • A project that grew out of a crude tape processor originally built to see how close i could get data processing to the 100-step limit set by pressure plates' reset time. With some encouragement and helpful comments on the forum, i put another afternoon into the extant machine and turned it into a computer capable of executing programs written in an ultra-compact (and extremely low-powered) machine language consisting of six main instructions modified by the actual program adress as parameter (six values possible). I tried to make it as simple and small as possible while still giving it more functionality than just pushing a solitary bit around.
  • Reading the program from a "tape" (effectively a ROM device) allows extremely fast execution - since the tape contains program data only, the data management processes of von Neumann machines are not needed, allowing single-action execution at a rate of one operation per 120 steps. On the other hand, it limits flexibility and more complicated programs can become quite long. Similarly, tape not needed for program storage cannot be used to store data.
  • All things considered, designing and building the machine took one week-end, and the in-game construction cost comes to 1875 mechanisms, 176 ropes (for rollers) and 210 logs. 260 mechanisms could be saved by removing redundant connections, putting it at ~1/5 the mechanism cost of Jong's dwarven computer theoretically, almost 1/4 practically.
The Manual: http://www.bay12forums.com/smf/index.php?topic=140773.msg5496324#msg5496324

Handout that hopefully gives a better idea of how this machine processes data: http://dwarffortresswiki.org/index.php/User:Larix/Programming_the_Maple_6-6

hq9+ Interpreter[edit]

  • Doing my very best to push the envelope of dwarfputing, i built a dwarven computer to execute programs written in a high-level programming language. Since so far, dwarven computers have effectively worked with machine code, this is a huge leap forward!!
The language in question is hq9+.
thread on the Dwarf Fortress forum:
http://www.bay12forums.com/smf/index.php?topic=130986.0
I am especially proud of the unary memory device.

The Drunk Number Generator[edit]

  • Dwarfs are always so sloshed that when they try to be random, they still just end up drunk. Their drunk stumbling around the meeting hall can be used to derive irresponsibly unpredictable signals, which in turn can be converted into apparently random numbers. Be careful when constructing such contraptions on your own computers, intoxicated computers can be quite difficult to handle.
The double-roller "bit splitter" should be pretty close to the optimum in turning non-periodically timed events (like citizen-triggered pressure plates in a well-travelled area) into pseudo-randomness.
http://www.bay12forums.com/smf/index.php?topic=129226.msg4452422#msg4452422

Security Blast Door[edit]

  • Do you lack the patience to wait a hundred steps for a pressure plate to re-set and close a door? Are you annoyed by dwarfs dragging their feet when ordered to pull the "close that door!" lever? No problem, you can get a door to close as reaction to an "on" signal, potentially in less than ten steps. It just takes ~400 power and 25 rollers and pressure plates and link jobs.
http://www.bay12forums.com/smf/index.php?topic=128095.msg4449221#msg4449221

Taming the diagonal Minecart[edit]

  • Just working out that diagonally-moving minecarts are notoriously unwilling to follow track directions only served as an incentive for me to step up my game and tame the wild diagonal minecart. I succeeded in getting such carts to stay in holding loops, cycle through repeaters and even hold a bit of information by their rotation direction in a read-writeable 'memory cell'.

While working on my "billard table", i came up with two other minor devices; the first should be useful, the second's more of a curiosity:

There's no need to use an extra minecart for every bit of memory you wish to store, a single minecart can hold a full byte of information.
Oh, and i got a rudimentary base-seven memory device or adder to work, based on regulating water depth and measuring it with pressure plates.
Controlling diagonal minecarts; one-cart one-byte memory; seven-state fluid memory/potential base-seven adder? http://www.bay12forums.com/smf/index.php?topic=131325.msg4621257#msg4621257

Multiplication with beyond-binary result calculation[edit]

  • Binary multiplication has a simple basis, but tends to get unwieldy because so many adders are needed to put all the partial results together. DF's mechanical logic, however, offers amazing options to compactify the adding-up process so that for a multiplication of two eight-bit numbers, no more than fifteen additions are run in a single adding step, and the sum results generated in another semi-simultaneous step. But how can this be, when up to sixty-four signals are generated before any addition takes place, and the addition will produce a slew of extra carries, up to seven on the "middle" result bit, while a full adder has no more than three inputs? Simple (or not so simple): by using something else than normal binary adders, so that more than three signals can be added in a single circuit. A load-based "how many inputs are on?" circuit can not only check against a defined threshold of inputs before switching off, by using the output-generating pressure plates to re-configure the circuit itself and thus change the load, it can check for different significant load limits in succession and enforce a stable state when the "correct" output is reached.
I endeavoured to make it more elegant by "pre-processing" the carries generated and unwittingly introduced another problem - the "resistor-based input counter" can process new inputs turning on, but will ignore inputs turning off during operation, something that is bound to happen in the course of preprocessing. Conservatively, this problem can be handled by not pre-processing the generated carries and just passing up to seven up to the next bit, meaning you'll have to handle up to fourteen in- and seven outputs.
Or you can build a "consistency check" routine into the resistance counter, which massively increases the parts count but adds a whole new level of elegance and potential for further use. Equipping a multiplier with the presented finalised "count to ten" circuit will likely use at least as many parts as a Wallace or Dadda (or un-organised old-school) adder to collate the partial results, but allows calculating all carries of a bit and its sum on the same circuit.
The main achievement of this calculator is that it indeed uses the self-regulating properties of DF mechanical logic to condense the entire addition process of a multiplication into a one-to-two-step job using fifteen carry calculators and sixteen sum generators in the built example, while a more conventional truly binary multiplier would take 48 full and at least eight half-adders and need to do five to seven partial calculations, depending on the multiplier architecture chosen (a Dadda tree multiplier would take five, an ordinary shift-and-add multiplier seven steps).
Mechanical Multiplier (binary), 8x8 bits, with "single-pass" addition. As a possible improvement, the 0-10 Volume Meter
http://www.bay12forums.com/smf/index.php?topic=132977.0

The Signal Grinder[edit]

An unbeatably dwarven (and delicious) power-to-signal converter.
It seems that people think that screw pumps and rollers are the only power-driven "output devices". This is not true - there's another building that accepts power: the millstone. And like the two others, it can be used to transform power into a signal. All you need is a dwarf with the milling labour, a manager, millable plants and empty bags.

Construction:

###==1==
#o^..c..
###==2==
o - Millstone
^ - citizen-triggered pressure plate
=1= - stockpile accepting only millable plant (preferably without barrels)
=2= - stockpile accepting only bags
c - chair, assigned as office for the manager


The circuit must be primed by the manager. Order a number of "mill plant" or "mill seeds to paste" jobs. Once they have been approved, they can be assigned to querns or powered millstones. Milling jobs will only be assigned to a millstone if the building receives power and are automatically cleared from the millstone's job list the moment power is disconnected.
As soon as the millstone receives power, it will line up milling jobs and sooner or later (or much later) a miller will show up to mill, passing over the pressure plate when collecting plants and bags and bringing them to the mill. The plate will get activated repeatedly until power is cut or until the miller decides to eat, drink, sleep, party, go on break, pick up new socks or relocate a sheep that moved one step out of its pasture, or until all milling jobs have been performed.
By choosing the number of milling jobs ordered through the manager, a longer or shorter period of signal activity can be selected. As a notable benefit, this device not only generates signals from power, it also produces valuable powders (dyes and cookable flours/sugar) and trains dwarven skills (organiser and miller). And since it in fact uses dwarfs to turn power into signals, it can rightfully claim to be the only truly dwarven power-to-signal converter.
Technical data:
Extrapolated latency - 200-12 000 turns (the latter if there's only one miller, who just went on break when power turned on)
Produced signal - intermittent, with a period of ~200 steps. Acceptable for opening/closing bridges or extending/retracting spikes.
List of Materials: 1 millstone, 2 mechanisms, one chair, millable plant(s), empty bag(s). The chair can be deconstructed after priming the circuit, to recover materials.

Very compact incrementers and a collection of other computing components[edit]

The second post in a thread originally made to present a pseudo-random RNG using standard computing procedure - a linear-feedback shift register. During that construction, i got some ideas for smaller dwarven computing stuff, so went and built those, too. Some of them may be of practical use (as far as dwarven computing can be considered practical).
The water level measurer is highly theoretical for now, since i'm not aware of any kind of liquid-based computing that'd produce liquid of discrete depth.
The two designs of all-purpose logic gates are primarily concept demonstrations, to show what minecart computing is capable of. Each can distinguish the four possible states of two binary inputs accurately, using only two input devices/connections, which don't need reconfiguring for different logical conditions.
The memory cell is still more for showing off - there are compacter and more reliable powerless memory cells possible. The design shown was an important stepping stone, since it was the first time i fiddled with concepts of adressing memory instead of using memory cells dedicated to a single purpose.
The binary and ternary incrementer are very compact and to my knowledge perfectly reliable devices. I fully intend to use them in future projects.
For now, the synchronous toggler is another curiosity, but it's a great step forward in compactness and regularity for such devices.
Grab-bag of mechanical and minecart logic stuff, crammed into a thread full of weird computey things: http://www.bay12forums.com/smf/index.php?topic=135141.msg4881573#msg4881573