For those new to electronics in TCD what each row in the above example represents is the steps that the game goes through in order to determine the state of the different electronic configurations after they are powered.

To figure out what is powered and what isn't the game runs through numerous "cycles" until the state of the electronics either stabilises or repeats itself. This process occurs every time the player moves or uses a tool. The state of voltage triggered switches and voltage triggered inverted switches (VTIS) in each cycle is determined by whether they were powered from the tile above during the previous cycle. The state of each voltage switch at the start is determined by where they had settled the previous "turn".

In the examples above the leftmost circuit of each column represents the initial state of a circuit before a pressure switch in turned on. The circuits to the right represent each cycle after the button is pressed until it repeats a state. The to the right is shown the final state as it will appear to the player.

Re: Electronics Tutorial?

I realized that my OR circuit also has an issue in combining with other gates. If you, say, want to test both (X OR Y) and (X AND Y) for some reason, using that form of the or gate will mean if X is on, Y will appear to be on as well(since their wires are directly connected), so the AND will pass as true (regardless of what Y is). I've changed that Castle Draft to have the most basic ones on the left side, then the circuits that work with multiple circuits on the right side.

Of course, after I realized this, it didn't really register until I was connecting the wires to the lights on my attempt at a circuit to have a number show up (and increase by 1 each step).

Everything up to that point worked, suprisingly... if you put lights at that bottom right diagonal, one light would light up at a time, in order. I'm actually really surprised I was able to fit all of that in a house - as you can see, it just barely fit. If someone want's a repeating circuit with period 8 and doesn't care about having half of their house, feel free to use this . This, along with my attempt at a button counter (see how many buttons are pressed - again, pretty much completely useless, but interesting all the same), have both been killed because I keep thinking current flows one way =P. If only we had a one-way current tile =P

Re: Electronics Tutorial?

Well, that's the point, really....

I mean, the system already clearly allows for NP-hard stuff to be built, even with full visibility. Partial visibility makes it even worse... combo locks are a great example of this: a 10-bit lock effectively requires 2^10 guesses to guarantee that you find the solution (or 2^9 guesses on average).

The only thing that de-tooths NP hard problems is a limit on the size of the problem space. If something is truly NP-hard, it means that for a problem of size K, there is no algorithm that can solve the problem in polynomial time... meaning polynomial in K. You should be able to scale K up to any value and still have sensible problem instances (a salesman who must visit K cities, where K can be 10 cities or 10,000 cities). If K can never be bigger than a certain value, we're not really playing by the NP-hard rules.

And in our case, K might be something like 32, which is fixed the dimension of the map. It's never bigger than that.

And the difficulty of squeezing electronics into that 32x32 space makes our prospects even better. Yes, you can build full-visibility problems in The Castle Doctrine that are instances of truly NP-hard problems, but these constraints limit you only to the smaller, more trivial instances of those problems.

But in general, the problem instance in TCD is, "Given this house map, what is the optimally cheapest tool set and movement path that will get the robber to the vault without dying?" I'm pretty sure that for NxN maps, that is an NP-hard problem (no polynomial time way to solve it, polynomial in N). Obviously, we know part of the answer already: the cheapest toolset is alwasy $0, because the owner provided us with that 0-tool solution (though this is not the case for reaching the wife, or dealing with a house that has already been partially broken).

Summary: it's good that building complex electronics is quite limited by space constraints!

Re: Electronics Tutorial?

Re: Electronics Tutorial?

Can anyone please explain how the final state is computed if there is a loop in the electronics sub-steps sequence? I read somewhere on the forum that it is about a "lowest state" of the components, but I don't understand exactly what it is.Also, I don't understand Josh's last example from http://castledraft.com/editor/2sP62y (the last 6 diagrams, 2 bottom rows). What is the order in this sequence, row by row or clockwise? And why the switch is off, then on, then off again...The current trend seems to be a loop of electric floors which you can't disconnect because you get instantly fried, which is very counter-intuitive (for example in Morel's house).In order to survive in such houses, you have to know how these sub-steps arecomputed, that means, you have to know how the algorithm is implemented. This electronic stuff is very interesting and allows some funny tricks, but I imagine this can be frustrating for new players.

Re: Electronics Tutorial?

arakira wrote:

Can anyone please explain how the final state is computed if there is a loop in the electronics sub-steps sequence? I read somewhere on the forum that it is about a "lowest state" of the components, but I don't understand exactly what it is.Also, I don't understand Josh's last example from http://castledraft.com/editor/2sP62y (the last 6 diagrams, 2 bottom rows). What is the order in this sequence, row by row or clockwise? And why the switch is off, then on, then off again...The current trend seems to be a loop of electric floors which you can't disconnect because you get instantly fried, which is very counter-intuitive (for example in Morel's house).In order to survive in such houses, you have to know how these sub-steps arecomputed, that means, you have to know how the algorithm is implemented. This electronic stuff is very interesting and allows some funny tricks, but I imagine this can be frustrating for new players.

If it loops, each individual tile goes to the lowest state that it was seen in. This means if a component was switching between powered and unpowered, it will end up unpowered. If a component is part of a looping circuit but is only ever powered then it will stay powered.

The lowest example is a toggle. If you give it a pulse while it is off, then it will turn on. If you give it a pulse when it is on, then it will turn off. I think it's read row by row, the upper row showing the button being pressed while the latch is powered, and the lower row showing the button being pressed while the latch is unpowered.

Re: Electronics Tutorial?

By "lowest state," we mean the state number in the gameElements/houseObjects folder for that object.

Colorfusion is correct that for all objects, their unpowered state happens to be state 0, which is the lowest state. Thus, somewhere in the loop, if the object hits state 0, it will be set to 0 once the loop is detected and dealt with.

Re: Electronics Tutorial?

Re: Electronics Tutorial?

jasonrohrer wrote:

Yeah... some people who play this game are insanely smart!

I am not one of them.

"I just robbed Mr. Rogers." -Ludicrosity "The wood is my desk, and I'm knocking it with my head." -Blip"I'd rather pack 25 meats than 1 crowbar if you know what I mean..." -Jabloko"This is one of the most disturbed things I have seen in quite a while. I blame global warming." -bey bey "that seems like more resources than I'm willing to put into having my kids killed." -cbenny

Re: Electronics Tutorial?

That isn't provable, zed; however, there are some other claims we can make about the Castle Doctrine specifically. Now, sorry if I make a mistake, I mostly do electronics and not computability theory:

There must, by the nature of the game, be some maximum difficulty problem (i.e. house) H, such that no problem designable within the house space can be more difficult than H. H may or may not be NP-Hard.Because H is the most difficult possible problem, it can be assumed from gameplay that there is essentially a single non-tool solution. A non-deterministic Turing machine would then be able to produce a computation tree based on its transition relation (in this case, moves) of left, right, up, and down with both input and output being the position of the player character. Because the house space is finite, there is a upper bound on the size of these trees. (Note that this is under the assumption that moving up and down repeatedly eventually stops being useful, as any pets would have pressed whatever buttons they needed to already.)

As a matter of fact, these trees would obviously be largest for an empty house with the vault in a back corner, at it has the highest possibility for movement. (Again, note that an algorithm would not know if there's a magic dance in the house, and some branches of its computation tree would feature pointless dancing). This problem, of simply finding the vault in an empty house, is clearly in only NP. (This takes some math to prove, but I think I did it right. Again, I not a computability theorist. ) As it would take the more time than solving problem H, H must also be solvable in polynomial time by the same non-detrministric Turing machine, and thus:H is in NP.

Now H could still be NP-hard; it would then be NP-complete. However, either way it can still be solved in polynomial time. It's still really hard though, especially for us stupid humans and our stupid ways; also, a non-deterministic turing machine wouldn't like it when one of its computability tree branches ends in death and all the others get chills.

Re: Electronics Tutorial?

I understand probably about 5% of this. And that prospect to me is exciting, but I'm not sure how to really grasp the material. Is there a more gradual guide than this for those of us who are less electronically / computationally knowledgeable?

---勝兵先勝而後求戰，敗兵先戰而後求勝。"Victorious warriors win first, then go to war; defeated warriors go to war first, then seek to win." - Sun Tzu, The Art of War

Re: Electronics Tutorial?

I just killed myself in a self test and was wondering if there is some kind of delay built into a specific tile or wire type? Seems that I must have changed the wiring around so that power looped back around to activate four steps later than I expected. Didn't use any of the voltage activated or deactivated toggles. Had the picture of a tree in a desert if anyone saw the house.