Bay 12 Games Forum

Please login or register.

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

Author Topic: I'm gonna make a calculator!  (Read 4018 times)

w

  • Bay Watcher
    • View Profile
    • http://www.whitehouse.gov/president/
Re: I'm gonna make a calculator!
« Reply #30 on: December 07, 2006, 08:05:00 pm »

Also, just a little suggestion:

If we're going to do binary operations (which I agree is a good idea), I think it would be best to try either "nand" or "nor".

This is because, unlike the other possible operations (including "and"), either of them, by itself, can be used to define all other binary operations.

So once we have "nand" (or "nor"), we have everything.

Logged

Disruptive Idiot

  • Bay Watcher
    • View Profile
    • http://www.relicnews.com
Re: I'm gonna make a calculator!
« Reply #31 on: December 07, 2006, 10:45:00 pm »

w, I think you just pointed out the Halting Problem o.O
Logged

Disruptive Idiot

  • Bay Watcher
    • View Profile
    • http://www.relicnews.com
Re: I'm gonna make a calculator!
« Reply #32 on: December 07, 2006, 11:00:00 pm »

I think all problems would be solved if we could asynchronize floodgates attached to the same lever. It would allow us to easily realize most types of logic gates, yes?
Logged

Disruptive Idiot

  • Bay Watcher
    • View Profile
    • http://www.relicnews.com
Re: I'm gonna make a calculator!
« Reply #33 on: December 07, 2006, 11:23:00 pm »

Ah, I have it!

code:

X1  X1
|   |
|   |
X2||X3
 |
 |
 D

X1 floodgates are the 'power' switch. The left one is connected to magma, the right one is connected to water. At the end of the channel is a chained dog.

First you set your inputs, X2, X3, then you hit the switch X1.

If the dog survives, the result is true, otherwise, false.

code:

X1 X2 Result
0  0  1     (Nothing Happens)
1  0  0     (Dog melts)
0  1  0     (Dog drowns)
1  1  0     (Dog steamed)

This is a NOR gate, yes?

Truth is represented by an open floodgate, by the way.

[ December 07, 2006: Message edited by: Disruptive Idiot ]

[ December 07, 2006: Message edited by: Disruptive Idiot ]

Logged

Gigalith

  • Bay Watcher
    • View Profile
    • O and H Books
Re: I'm gonna make a calculator!
« Reply #34 on: December 07, 2006, 11:56:00 pm »

I'll answer your second point first, as it relates to my answer for your first.

A and B does not output both 1 and 0. The cage traps behind each plate prevent the elephants from triggering the other. It is possible for the elephant to go back and forth until an antman ambush manages to trigger both cage traps, it is exceedingly unlikely, especially if the "ElephAND" gate is behind several layers of traps. And, to use a real life example, an AND gate could be struck by lightning, causing it to output a 1 when both of it's inputs are 0. Complex electronic devices, however, are designed under the assumption that, barring unforseen cirumtances, AND gates will work as intendent.

With the first, it is impossible, barring external events, for the elephant to reach the other plate, once it has triggered one. Thus, an output of 0 can be taken to mean that 1 will not later be outputted.

You are quite right that elephants can take an infinite time to reach either plate due to their [MEANDERER] flag. Before I read this, I was thought of other problems with an elephant powered calcuator. For one, it requires two elephant per logic gate. A full adder requiring 25 logic gate would require 50 elephants. And the more elephants you need to capture, the bigger chance of them taking offence and reducing your puny dwarfs in to dwarf chuncks[6].

A more effeciant way to do it would be this:

code:

######
#.!..#
#A#ab#
#B#..#
#1#0##
#^.^##
##.###


All you need is a creature with the following three requirements:

* It must be wild, hostile, or beserk.
* It must not have [BUILDINGDESTROYER:2], [MEANDERER], [LOCKPICKER], [FLIER], or [TRAPAVOID].
* It must be able to move

Other than that, anything will do. You can even use insane nobles if you want.

Logged
Check out my books at O and H Books

w

  • Bay Watcher
    • View Profile
    • http://www.whitehouse.gov/president/
Re: I'm gonna make a calculator!
« Reply #35 on: December 08, 2006, 08:52:00 am »

quote:
Originally posted by Disruptive Idiot:
<STRONG>Ah, I have it!

code:

X1  X1
|   |
|   |
X2||X3
 |
 |
 D

X1 floodgates are the 'power' switch. The left one is connected to magma, the right one is connected to water. At the end of the channel is a chained dog.

First you set your inputs, X2, X3, then you hit the switch X1.

If the dog survives, the result is true, otherwise, false.

code:

X1 X2 Result
0  0  1     (Nothing Happens)
1  0  0     (Dog melts)
0  1  0     (Dog drowns)
1  1  0     (Dog steamed)

This is a NOR gate, yes?</STRONG>


This is, indeed, a nor gate.  Excellent job! The "power switch" was a great insight.

Although I would suggest a chained noble instead of a chained dog.

Logged

w

  • Bay Watcher
    • View Profile
    • http://www.whitehouse.gov/president/
Re: I'm gonna make a calculator!
« Reply #36 on: December 08, 2006, 09:08:00 am »

quote:
Originally posted by Gigalith:
<STRONG>I'll answer your second point first, as it relates to my answer for your first.

A and B does not output both 1 and 0. The cage traps behind each plate prevent the elephants from triggering the other.</STRONG>


I really don't see that.

I'm not saying that, if you pull both A and B, the elephant on the left will trigger 1, then walk over to 0 and trigger it, too.

I'm saying that pulling both A and B will release both the elephant on the left and the elephant on the right.

The fact that the elephant on the left gets caught after triggering plate 1 is not relevant to the fact that the elephant on the right will trigger plate 0.

 

quote:
<STRONG>And, to use a real life example, an AND gate could be struck by lightning, causing it to output a 1 when both of it's inputs are 0. Complex electronic devices, however, are designed under the assumption that, barring unforseen cirumtances, AND gates will work as intendent.</STRONG>

The problem that I was pointing out was not merely that it outputs 1 and 0 simultaneously as a particular intended output.  There's nothing inherently wrong with that.

The problem was the combination of (A) that, (B) the fact that another intended output is just zero, and (C) there is no finite time within which you can know that it will be done calculating.

The combination of those three things -- not just the first -- is the issue.  You cannot tell whether a "zero" means "the answer is zero" or "it's not done calculating yet".  All you can do is say, hey, a year has passed, and "one" hasn't been triggered - the answer probably is zero.

And that's true even if it functions as designed - ant men and lightning strikes and blah blah blah are not even in the picture.

 

quote:
<STRONG>
code:

######
#.!..#
#A#ab#
#B#..#
#1#0##
#^.^##
##.###

</STRONG>

No, this is even worse.

What happens if you pull both the A and B levers?

The path to both the 1 and the 0 plates open up.

Which means that the elephant might decide to go to the 1 plate or the 0 plate.  In response to the exact same question.

Which is not good.

[ December 08, 2006: Message edited by: w ]

Logged

w

  • Bay Watcher
    • View Profile
    • http://www.whitehouse.gov/president/
Re: I'm gonna make a calculator!
« Reply #37 on: December 08, 2006, 09:18:00 am »

Okay, so now that Disruptive Idiot has created a NOR gate, the dwarves can do any calculation that any computer ever could do.  They could, for example, play Dwarf Fortress.

However, they would have to do so very manually: Test one calculation, remember the answer, test another, remember the answer, feed the two answers into a third calculation.

The next challenge, therefore, is to hook up NOR gates to each other, to do more complicated calculations in a single shot, without requiring the dwarves to remember intermediate calculations.

In case I'm not being clear here, I'll be a little more explicit:

The output of a calculation (the dog living or dying) cannot be used as input to another calculation (a lever being pulled) without manual intervention from the dwarves.

[ December 08, 2006: Message edited by: w ]

Logged

segmose

  • Bay Watcher
    • View Profile
Re: I'm gonna make a calculator!
« Reply #38 on: December 08, 2006, 10:19:00 am »

The levers need to have an opposit setting for some of their gates which cant be made at the moment.
Logged

w

  • Bay Watcher
    • View Profile
    • http://www.whitehouse.gov/president/
Re: I'm gonna make a calculator!
« Reply #39 on: December 08, 2006, 12:44:00 pm »

quote:
Originally posted by segmose:
<STRONG>The levers need to have an opposit setting for some of their gates which cant be made at the moment.</STRONG>

That might be true, but I'm not completely convinced of it.

What is certainly true is that if gates with different states could be hooked up to the same lever, it would be easy to accomplish this stuff.

But that's not the same thing as "we need gates with different states to be  able to be hooked up to the same lever".

EDIT: I just mean to say that this whole "channel, floodgate, lever" thing is not necessarily the only possible solution.  

For example, perhaps something could be worked out using dwarves who are set up to be the only dwarves who can accomplish certain tasks, which are queued by the task manager.  But, those dwarves are locked in particular rooms, which will become unlocked only upon certain particular results of other calculations.

[ December 08, 2006: Message edited by: w ]

Logged

Gigalith

  • Bay Watcher
    • View Profile
    • O and H Books
Re: I'm gonna make a calculator!
« Reply #40 on: December 08, 2006, 02:08:00 pm »

Now I've figured out what you're saying.

You're thinking that the A and a doors are connected to the same lever. They aren't. A is connected to lever A, and a is connected to lever a. Before the cages are opened, A is flipped if you wish to input a 1, and a is flipped if you wish to input a 0. For what you are describing to happen requires indecriminately flipping both levers. This is also true of B and b too.

I'm sorry if this wasn't clear, but it's how it's intended to be used.

EDIT: The use of pressure plates, by the way,  
allows automation, as the plates can open/close doors at the end.

[ December 08, 2006: Message edited by: Gigalith ]

Logged
Check out my books at O and H Books

Disruptive Idiot

  • Bay Watcher
    • View Profile
    • http://www.relicnews.com
Re: I'm gonna make a calculator!
« Reply #41 on: December 08, 2006, 03:00:00 pm »

code:

X1  X1
|   |
|   |
X2||X3  
   |  
   |  
<PX1DX1P>

P's are pressure plates.
<leads> leads to an animal pile.

Two dwarves, one an animal hauler, the other a refuse hauler on either side.

If the dog dies, the refuse hauler will trigger the left plate, if it doesn't die, the animal hauler will trigger the right plate. Hook these up to other NOR gate inputs.

All you have to do is modify the set-up so that the dog can be hauled if it doesn't die.

Edit: Incidentally, the pressure plates emulate a conditioned disjunct [p,q,r] where the value of <is> is r, and the trigger of the plate action is q, in this case, the dog's value.

[ December 08, 2006: Message edited by: Disruptive Idiot ]

Logged

GrimmSweeper

  • Bay Watcher
  • Tome of Knowledge
    • View Profile
Re: I'm gonna make a calculator!
« Reply #42 on: December 08, 2006, 05:38:00 pm »

A small flaw in your process is that dwarves can't set off their own traps. :/
Logged

Disruptive Idiot

  • Bay Watcher
    • View Profile
    • http://www.relicnews.com
Re: I'm gonna make a calculator!
« Reply #43 on: December 08, 2006, 08:30:00 pm »

That's a shame =)
Logged

w

  • Bay Watcher
    • View Profile
    • http://www.whitehouse.gov/president/
Re: I'm gonna make a calculator!
« Reply #44 on: December 09, 2006, 10:00:00 am »

quote:
Originally posted by Gigalith:
<STRONG>You're thinking that the A and a doors are connected to the same lever. They aren't.</STRONG>

Ohhhhhhhhhhhhhh. Thanks.  Sorry for the misunderstanding.

Logged
Pages: 1 2 [3] 4