WAY OFF TOPIC, but I would like some help getting my head around this.

Ok, this is more to do with PROGRAMMING, but here is a good place to ask, becaues it is to do with "definitions" - I think.

Ok:

How far can a dog run into a forest?

Read more: How far can a dog run into a forest? - Answers

Now I don't know of the exact subtle differences between:

How far into a forest can a dog run?

But...

The answer is "half way" because then he is running OUT of the forest.

Now I sort of understand that, but my question is:
If the dog is running "into" the forest, he doesn't know when he is halfway there, so continues to run anyway.

Now, it is said that after "halfway" he is running out, so the answer is "half way". But wouldn't it be "all the way" because as soon as he starts to run "out of the forest" - when he gets halfway there, he is no longer runnning INTO the forest anyway?

You guys being knowledgeable programmers may be able to explain this to me in a way I can understand and help me clear up the confusion with the definitions.

The answer is relative to your frame of reference.

Relative to the dog, the dog has run "all the way" into the forrest when the tip of the dog's tail crosses the forrest boundary.

Relative to the forrest, the dog runs into the forrest "half way". After passing the middle point on the path from forrest boundary to forest boundary the dog is no longer running "in to" but "out of" the forrest.

John,

If I wasn't a bloke as well, I'd give you a big hug for helping me understand that.

It has been haunting me for a long time and I haven't really got a good answer until now.

Thanks much.

johnwasser:
The answer is relative to your frame of reference.

Relative to the forrest, the dog runs into the forrest "half way". After passing the middle point on the path from forrest boundary to forest boundary the dog is no longer running "in to" but "out of" the forrest.

Ok, just one more question though on that last bit.

So the question asks:
How far can a dog run into a forest?

So it is specified INTO.

So although looking at it from the forest's point of view, the dog would still run "all the way" INTO the forest then start to run "all the way" OUT OF it.

So wouldn't the answer still be "all the way"? (With the question worded like that)
Just asking.

A bit Zen for me :slight_smile:

Yeah, but as people here (I hope) have a better understanding of programming and what is defined and what isn't, they may be able to help me with all the terms, declorations and what not.

I have a pretty good understanding of programming but I don't really see a programming question here, like I said it seems more like a Zen-style definition of the word "into". These ambiguities do bite you in the arse in a specification and that's when you have to nail down what the customer means by "into".

And then there's the definition of a dog? Is it the head, nose, tail?

But after that has been properly defined the programming should be the (often simple) implementation of an algorithm.

What if the forest is not circular and the dog changes direction? In an instant it has moved from 50% through to 90% through. Did it travel faster than light or even instantly?

Much as these musings are interesting I cannot yet see a concrete question about "programming and what is defined and what isn't" and "the terms, declarations and what not".


Rob

Yeah, granted Rob.

But as a "noob" I don't know the lingo.

I am saying "declarations" "definitions" etc..... because they are the words I feel best fit my problem.

So excuse me if I am not using the right words and their definitions, only because I don't know better.

So if you don't mind, teach me the meanings of these words as well so I can be smarter - though I won't promise it will work.

One question is about how far the dog runs.

The other question amounts to how far is it to the middle of the forest.

I see where this applies to approach to code, like where you want the code to get versus what the code must do to get there. When time/money is involved, replace code with development and just listen to what people who (think they) know the ends but nothing about the means. It gets real relevant then!

Tee Hee... :wink: :grin:

Yeah, I like that analogy.

As Graynomad mentioned, this is the biggest hurdle in converting requirements into code. Requirements can be of varying levels of ambiguity. There is zero ambiguity in code.

In this case, the phrase 'into the forest' needs to be more specifically defined. Without that definition, any answer is just an interpretation that may or may not be correct. It could be half way, it could be all the way. It could be something else entirely if 'into the forest' has some non-intuitive meaning. For example, it could just as easily mean a single step if 'into the forest' is simply a binary state.

Re declaration and definition, I think you'll have to hit the books but I found this on the web.

In The Definition of a variable space is reserved and some initial value is given to it, whereas a declaration only identifies the type of the variable for the function. Thus definition is the place where the variable is created or assigned storage whereas declaration refers to places where the nature of the variable is stated but no storage is allocated.

I admit I get them confused as well but the following is right I think

void myFunc(void);    // declaration of myFunc() so the compiler knows what to expect if the function is referenced before it is defined
//
// lots of other code
//
void myFunc(void) {   // definition if myFunc, this is the bit that actually has the code
   // some code
}

You need the declaration if you have a forward reference to a function for example

loop () {
   myFunc();
}

void myFunc(void) {   
   // some code
}

Will cause an error because the compiler sees the reference to myFunc() before it knows what the heck it is. One way to fix this is to declare the function first.

void myFunc(void);   // this is also called a "prototype"

loop () {
   myFunc();
}

void myFunc(void) {   
   // some code
}

The declaration (AKA prototype) tells the compiler what myFunc() is so when it sees the reference in the loop() function it's happy in the knowledge that myFunc() exists, the call is correct WRT parameters and return type, and that at some point myFunc() will be defined.

You can also fix this by simply placing myFunc() before any code that references it but often this is not practical.

The Arduino IDE pulls a trick to help beginners with this. It scans the program for forward references and (I think) inserts declarations for you.


Rob

And if a tree falls and there's only the dog in there, does it make a sound?

Ah, the fun of programming.

Ok, again and more off topic, here is an e-mail which I just received which is sort of quaint and long these lines:

There was a bit of confusion at the Sporting goods store this morning. When I was ready to pay for my purchases of gun powder and bullets the cashier said, "Strip down, facing me."
Making a mental note to complain to Harper about the gun registry people running amok, I did just as she had instructed.
When the hysterical shrieking and alarms finally subsided, I found out that she was referring to my credit card.
I have been asked to shop elsewhere in the future.
They need to make their instructions to us seniors a little clearer!

Ya gotta laugh.

Coz if you didn't you would cry.

Probably most of English comedy is based on assumptions and ambiguities. As a programmer I tend to take what someone says literally, as a normal person I usually interpret but I have a habit of doing literally what my missus says just for fun.

For example she may hand me some rubbish and say "Take this out to the bin and throw it out". 3 minutes later I return with the rubbish having thrown the bin out.

She laughs and laughs...sometimes.


Rob

As i see it.

The dog has no clue where or how far.. The most he can go is half way before he heads out so...

But if the dog had a problem solving brain he would stop at the farthest point eg the middle

so ask yourself this.

What's required to work out how far in? Eg a compass. eg how far have you traveled...

or rough calculations how fast roughly does the dog run, how big is the forest? Distance/time = roughly where dog is if traveling in a straight line.. i personaly woukd just use a gps :slight_smile:

And if a tree falls and there's only the dog in there, does it make a sound?

Not if it lands on a big pile of bear poo - if indeed bears do defacate in the forest.

if indeed bears do defacate in the forest.

Is the Pope a Catholic?

(good thing the title for this thread is "WAY OFF TOPIC..." :))


Rob

Asuming the forist is of a finite size and the dog is always moving, then while the dog is in the forest it is both running into and out and out of the forest simutanosly. It exsists in state tha is both. If you had said that while leaving the forest the dog must take the shortest rought then it would be difrent but as you didnt.

Sorry if the spellings off no spell chec on this