Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: [CHALLENGE]Dwarven Combination Locks  (Read 13570 times)

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #45 on: August 09, 2013, 07:27:44 pm »

I fiddled with 'evaluation' concepts, but it got completely out of hand:

If only I could remember my lessons in simplifying logic to it's simplest form. We used to start with hundreds of inputs and end up getting the logic we wanted off of 8 NAND gates. NAND gates are the best!

Anyway here is my entry + attached mega project:

Lock:
Spoiler (click to show/hide)

Treasure Vault (full of artifacts) with nice engraved gold vein leading up to it
Treasure level:
Spoiler (click to show/hide)
Z+1
Spoiler (click to show/hide)

Summary of machine:
- 8 Levers but could use any number
- Must be pulled in correct order to open door.
- Once you have chosen your order you step onto the bridge and pull the MASTER lever. At this point the vault will open and you will be admitted OR you get melted instantly by delicious hot magma.
- Fully re settable, with a delay set on how quickly you can try again (I guess only relevant for fortress mode)
- Vault does not stay open for long. Only long enough to allow entry.
- Exit switch is currently controlled by lever in queens room, but could easily be moved into the vault itself.

How it works:
Spoiler (click to show/hide)
Diagram 1 shows the logic gate for each lever. You need one of these per lever you want in your lock.
A - Gear powering closed loop. This is what you connect to the lever
B - Gear powering reset circuit, This is connected to D from OTHER circuits
C - This roller pushes the minecart back into a closed loop when it gets power from B
D - This pressure plate controls what order the levers should be pulled in. Detailed explanation below
E - This pressure plate connects to one of the mechanisms at K (Diagram 3). You need one of these for each lever.
F (diag 1) - When powered by A this roller keeps minecart going in a circuit and constantly triggering E, this keeps the gear assembly in K permanently set to OFF.

Spoiler (click to show/hide)
Diagram 2 shows the master switch control.
F (diag 2) - This gear is turned on/off by the master switch (marked P). In both cases it causes the minecart at H to move over G, either because it's rolling back off a ramp or because it's being pushed forward by rollers.
G - This Pressure switch toggles the bars at J (diagram 3) which will start the unlocking mechanism running

Spoiler (click to show/hide)
Diagram 3 shows my unlocking mechanism.
I - This gear assembly is permanently on to power the rollers for this circuit
J - These are the bars preventing the minecart from continuously going round.
K - These are the gears being kept off by the pressure plates E. When all levers are correctly pulled they will be ON and the roller L will be active.
L - This roller sends the minecart down the correct path, toggling M
N - This pressure plate is triggered if not all the gear assemblies at K were ON. It is connected to the bridge circled in white, marked S. This will drop magma into the corridor between the treasure room and my fortress.
M - This pressure plate is connected to Q and opens the treasure vault... long enough to run inside!

Spoiler (click to show/hide)
Diagram 4 shows the particulars of the treasure vault.
O - This is the entrance switch which you must pull to get into the gem window lined corridor leading to the treasure room. It simply toggles the bridge P. Pulling this during system reset can cause a very small amount of magma to wash over your dwarf body bringing a warming glow. (Only possible in fortress mode, this is impossible in adventure mode I think)
P - This is the master lever which toggles Gear assembly F (Diag 2). It will either result in a minecart passing over N or M (diag 3) and opening the vault... or dumping magma on your head. It ALSO raises the bridge behind you sealing you from escape (and preventing magma leakage). Because of Diag 2 pulling this repeatedly in short succession will NOT save you as the mechanisms are attached to pressure plate G not to the lever itself.
Q - This adamantine bridge lowers to allow entrance. It also atom smashes the magma left over from failed attempts (along with O)
R- The levers for pulling
S - Magma bridge.


Logic explanation:
Basically I have 8 Diag 1 machines. I assign them an order 1,2,3,4,5,6,7,8.
Machine 1 has it's D pressure switch connected to gear B on ALL other machines.
Machine 2 has it's D pressure switch connected to gear B on ALL machines with a greater order number
etc, etc.

The end result is that you cannot ever open the vault without pulling the switches in the correct order, as pulling a lower number switch after a higher number one will turn off ALL switches of a higher number than itself. Ideally your logic should look like this in the end (for a four lock)
1111
0111
0011
0001


Possible improvements:
The levers are setup so that you are expected to pull each one once. You can pull each as many as you want but you will quickly end up finding it VERY difficult to get the vault open, even in fortress mode. It also ends up a bit ugly looking if you have a mix of pulled and unpulled levers THEN reset the trap... I don't see any way round this with my setup. Once the trap is reset the state of the levers does not matter, lock will function as expected.

I also need to make two adjustments for adventure mode:
1) Minecarts all need a starting position and an initial, turn the machine on switch (would simply pulse B for each minecart)
2) Exit switch needs to be in treasure vault so you can leave again. (Hooked up to a copy of diagram 2 so it closes behind you)

Reset explanation:
The trap resets after a failed attempt, or if you pull the reset switch in the mechanism room.
Resetting does the following actions:
- All minecarts are put back into closed loops through toggling of B gears
- Vault bridge and bridge O are lowered and raised to atom smash magma, leaving a single 7/7 pool in the middle. This spreads out nicely covering the corridor for a period of time and preventing anyone running through while the bridges are down (I don't actually know if you could go that fast, but I didn't want to leave it to chance).


FINALLY now I've finished my design I can look at everyone else's design and see how I size up against the competition =D
« Last Edit: August 09, 2013, 07:53:43 pm by Ravendarksky »
Logged

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #46 on: August 09, 2013, 08:24:44 pm »

A few more comments about my design (on my phone do not brave enough to edit original post).

- device is all magma proof... In theory it can be submersed in magma (as lkng as a mine cart will roll 3 squares off a ramp through magma, not had time to check).

-device could in theory be beaten by pulling all 8 lever simultaneously, but unlikely to be achieveble even in fortress mode.

- device is snoop proof, looking at number of gears in each lever doesn't tell you anything.



Logged

Larix

  • Bay Watcher
    • View Profile
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #47 on: August 11, 2013, 04:20:26 am »

Hmm, could you add a screenshot of the main operation level (the one with all the tracks) with everything 'hidden'?
d-b-h ('d'esignations - 'b'uildings/items properties - 'h'ide), designate the whole area. You can reveal everything back with d-b-H (shift-h) when you're done.

I do not understand how exactly pulling a lever out of order prevents the proper activation of the following lock sequence, and think seeing the tracks in full could help - it seems each lock cell has 8 tiles of track, only three of which are visible in the pictures, everything else is covered up by pressure plates, gears and rollers.

EDIT: i thought about the basic concept of multiple evaluation and built a _comparatively_ simple demonstration circuit. Buckle up, it's not actually simple:

A mockup lock evaluating two two-bit keys:
Spoiler (click to show/hide)
This extremely dumbed-down lock still looks like this fully installed:
   

I guess it demonstrates the general difficulty of multi-part keys, but more particularly the limitations of strictly minecart-pathing based locks: diverting from plain sequence combinations quickly leads to designs which are either hideously large, hideously tangled, or both, because minecarts can only process one bit of information at a time.

Spoiler: Afterthoughts (click to show/hide)
« Last Edit: August 11, 2013, 03:28:13 pm by Larix »
Logged

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #48 on: August 11, 2013, 08:22:05 am »

Hi Larix,

Thanks again for the help you were giving me eariler. I hope this diagram clears everything up for you :)



This is my NEW machine. It is exactly the same as the previous one except that the levers ONLY send on signals when you toggle them on or off. It really wasn't worth adding 8 more logical circuits but oh well.

Oh and I've tidied up all the mechanisms a bit.

My next design will go for simplicity, now that I've wasted 10+ hours on minecart logic.
« Last Edit: August 11, 2013, 08:05:58 pm by Ravendarksky »
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #49 on: August 11, 2013, 03:50:34 pm »

This thead is awesome.  :o
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Larix

  • Bay Watcher
    • View Profile
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #50 on: August 12, 2013, 06:21:49 am »

Argh, i still don't fully get it. Logic, my greatest weakness ;)
I have a better idea of what the eight lever-run cells do, though, so thanks.

Does it graciously reset, so the operative carts end up in their proper start locations?
I _think_ wrong lever pulls can result in strange tangles of on/off gears (because gears toggle on _any_ signal)? As long as the wrong sequence reliably breaks the chain, that's mostly an aesthetic concern, though.

It does have a nice, regular layout. I appreciate that (although my designs clearly favour compactness over clarity).
« Last Edit: August 12, 2013, 06:35:03 am by Larix »
Logged

Ravendarksky

  • Bay Watcher
    • View Profile
    • DFMon.exe - Get rid of DF SPAM
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #51 on: August 13, 2013, 07:22:55 am »

Okay so last night I thought on how to explain this to you better and this is what I came up with:

The way the system works is as follows:
- Each lever sets a gear assembly to TURN ON, This is achieved through stopping a minecart which was passing over a pressure plate loop (Think of this as State 1)
- Each lever ALSO sets X number of other circuits to TURN OFF, This is achieved through activating a given number of gear assemblies which push minecarts BACK into pressure plate loops. (Think of this as States 0)

Where the magic happens is that the levers are actually controlling different circuits which cause a PULSE to be sent, rather than a continual ON signal. In the case of the rollers in the closed loop it disables them for a very short time. In the case of the rollers to push them back into the circuit it enables them for a very short time.

So lets set X to a number and see how it should look.
X = 4
So we have 4 machines to wire up.
Lever 1 (L1) : Enable Machine 1(M1) and disable M2,M3,M4
L2: Enable M2, Disable M3, M4
L3: Enable M3, Disable M4
L4: Enable M4

Now lets model that so you can understand how this forces the lever order:
L PulledM1M2M3M4
L20100
L40101
L11000
Because we didn't Pull L1 first we are now STUCK with L2 and L4 turned off until the machine is reset.

Another example:

L PulledM1M2M3M4
L11000
L21100
L41101
L31110


Do you get it now :)?

And yes the machine graciously resets, it simply pushes all minecarts back into their loops (this is also the function of the "Starter" switch for adventure mode... although it will need a safety too as having these all stationary in the start position will mean the treasure room is set to open).

The only thing which I can't reset is the position of the levers.... sadly unless each one is pulled before each attempt they will end up a strange mix of left and right (although the underlying functionality won't change, it will just be harder to remember if you've pulled them all or not).
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #52 on: August 13, 2013, 08:06:31 am »

Spoiler (click to show/hide)

Treasure Vault (full of artifacts) with nice engraved gold vein leading up to it
Treasure level:
Spoiler (click to show/hide)
Z+1
Spoiler (click to show/hide)

Summary of machine:
- 8 Levers but could use any number
- Must be pulled in correct order to open door.
- Once you have chosen your order you step onto the bridge and pull the MASTER lever. At this point the vault will open and you will be admitted OR you get melted instantly by delicious hot magma.
- Fully re settable, with a delay set on how quickly you can try again (I guess only relevant for fortress mode)
- Vault does not stay open for long. Only long enough to allow entry.
- Exit switch is currently controlled by lever in queens room, but could easily be moved into the vault itself.

How it works:
Spoiler (click to show/hide)
Diagram 1 shows the logic gate for each lever. You need one of these per lever you want in your lock.
A - Gear powering closed loop. This is what you connect to the lever
B - Gear powering reset circuit, This is connected to D from OTHER circuits
C - This roller pushes the minecart back into a closed loop when it gets power from B
D - This pressure plate controls what order the levers should be pulled in. Detailed explanation below
E - This pressure plate connects to one of the mechanisms at K (Diagram 3). You need one of these for each lever.
F (diag 1) - When powered by A this roller keeps minecart going in a circuit and constantly triggering E, this keeps the gear assembly in K permanently set to OFF.

Spoiler (click to show/hide)
Diagram 2 shows the master switch control.
F (diag 2) - This gear is turned on/off by the master switch (marked P). In both cases it causes the minecart at H to move over G, either because it's rolling back off a ramp or because it's being pushed forward by rollers.
G - This Pressure switch toggles the bars at J (diagram 3) which will start the unlocking mechanism running

Spoiler (click to show/hide)
Diagram 3 shows my unlocking mechanism.
I - This gear assembly is permanently on to power the rollers for this circuit
J - These are the bars preventing the minecart from continuously going round.
K - These are the gears being kept off by the pressure plates E. When all levers are correctly pulled they will be ON and the roller L will be active.
L - This roller sends the minecart down the correct path, toggling M
N - This pressure plate is triggered if not all the gear assemblies at K were ON. It is connected to the bridge circled in white, marked S. This will drop magma into the corridor between the treasure room and my fortress.
M - This pressure plate is connected to Q and opens the treasure vault... long enough to run inside!

Spoiler (click to show/hide)
Diagram 4 shows the particulars of the treasure vault.
O - This is the entrance switch which you must pull to get into the gem window lined corridor leading to the treasure room. It simply toggles the bridge P. Pulling this during system reset can cause a very small amount of magma to wash over your dwarf body bringing a warming glow. (Only possible in fortress mode, this is impossible in adventure mode I think)
P - This is the master lever which toggles Gear assembly F (Diag 2). It will either result in a minecart passing over N or M (diag 3) and opening the vault... or dumping magma on your head. It ALSO raises the bridge behind you sealing you from escape (and preventing magma leakage). Because of Diag 2 pulling this repeatedly in short succession will NOT save you as the mechanisms are attached to pressure plate G not to the lever itself.
Q - This adamantine bridge lowers to allow entrance. It also atom smashes the magma left over from failed attempts (along with O)
R- The levers for pulling
S - Magma bridge.


Logic explanation:
Basically I have 8 Diag 1 machines. I assign them an order 1,2,3,4,5,6,7,8.
Machine 1 has it's D pressure switch connected to gear B on ALL other machines.
Machine 2 has it's D pressure switch connected to gear B on ALL machines with a greater order number
etc, etc.

The end result is that you cannot ever open the vault without pulling the switches in the correct order, as pulling a lower number switch after a higher number one will turn off ALL switches of a higher number than itself. Ideally your logic should look like this in the end (for a four lock)
1111
0111
0011
0001


Possible improvements:
The levers are setup so that you are expected to pull each one once. You can pull each as many as you want but you will quickly end up finding it VERY difficult to get the vault open, even in fortress mode. It also ends up a bit ugly looking if you have a mix of pulled and unpulled levers THEN reset the trap... I don't see any way round this with my setup. Once the trap is reset the state of the levers does not matter, lock will function as expected.

I also need to make two adjustments for adventure mode:
1) Minecarts all need a starting position and an initial, turn the machine on switch (would simply pulse B for each minecart)
2) Exit switch needs to be in treasure vault so you can leave again. (Hooked up to a copy of diagram 2 so it closes behind you)

Reset explanation:
The trap resets after a failed attempt, or if you pull the reset switch in the mechanism room.
Resetting does the following actions:
- All minecarts are put back into closed loops through toggling of B gears
- Vault bridge and bridge O are lowered and raised to atom smash magma, leaving a single 7/7 pool in the middle. This spreads out nicely covering the corridor for a period of time and preventing anyone running through while the bridges are down (I don't actually know if you could go that fast, but I didn't want to leave it to chance).


FINALLY now I've finished my design I can look at everyone else's design and see how I size up against the competition =D[/spoiler]
Congratulations is due for this spectacular design! Added you to the OP, and I must say, you sized up very nicely against the competition. :P
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

Larix

  • Bay Watcher
    • View Profile
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #53 on: August 13, 2013, 08:32:54 am »

Do you get it now :)?


Possibly...
I think i missed the point that one of the rollers in the lock cells is by default on and the other off. It makes more sense with that knowledge, thank you. I must admit i'm not too good at following detailed logic explanations in english.
Logged

Larix

  • Bay Watcher
    • View Profile
Re: [CHALLENGE]Dwarven Combination Locks
« Reply #54 on: August 18, 2013, 06:18:09 pm »

Since i clearly haven't spammed this topic enough, here's a demonstration on how hideously complex purely mechanical locks are:

   

The cart sits on the northern roller, powered via the "evaluation" lever. Once the roller is activated, it is pushed south and passes over the "lock" roller, which only receives power if the six gear assemblies between it and the power connection are all engaged. Each gear assembly is operated by a lever, and they must be put in the positions on-off-on-off-on-on to engage all gearboxes.

If the roller is on (pushing S->N), the cart is diverted west and lands in the western loop, in all other cases in the right loop. The rollers keeping the cart in the loop are switchabe via the reset lever, once they're switched off, the cart leaves the loop and gets routed back to the start position.

The lock is operated from here:


Six gabbro 'lock levers' in the main chamber, the marble 'evaluation lever' all the way to the east. If the lock is open, the microcline door to the west opens, giving access to the two levers enabling variant key combinations. One of these levers is connected to three of the lock gearboxes, the other to four. The resultant key combinations are:
left off/right off: 101011 (as mentioned)
left on/right off: 001101
left off/right on: 110000
left on/right on: 010110

The reset lever is here:


The hatch cover (over a hole) is connected both to the evaluation lever and the reset lever itself - the system can only be reset when the evaluation lever is off and the reset lever must be returned to its 'off' state before you can leave.

But what do the hatch covers and red floor bits mean? In short, nothing. They're supposed to mislead the lock-picker into thinking the order in which levers are pulled is in any way important - when a lock lever is switched from 'off' to 'on', the hatch cover opens and will not close again when you mess with the lever in question. Once all six lock levers have been pulled, the red floor by the evaluation lever will be covered by an olivine hatch cover.

Spoiler: obfuscation machinery (click to show/hide)

EDIT: all designs became a bit untidier than usual because i had no reliable water power on the site and ended up using windmills - six for the actual lock, 13 for the 'no takeback' controller, two for the big NAND gate.

Required installations for a lock with n combination levers:
four rollers
one gear assembly for evaluation
one gear assembly for reset
n gear assemblies connected to the combination levers
20 grids of track
power consumption ~25 + 5n

parts: 4 ropes, 12+4n mechanisms for rollers, gearboxes, levers and linkage.

Linking up another lever to each combination gearbox allows pre-selecting any combination possible. That would inflate the mechanism count by another 3n.
« Last Edit: August 19, 2013, 03:02:17 am by Larix »
Logged
Pages: 1 2 3 [4]