

Zapp wrote:well, if you take it literally, then there are unlimited wagons.
assume each wagon is a side of a polygon.
because they are aligned in a circle you would need infinite sides (therefore infinite wagons) to fulfill that requirement

SpikedMath wrote:Zapp wrote:well, if you take it literally, then there are unlimited wagons.
assume each wagon is a side of a polygon.
because they are aligned in a circle you would need infinite sides (therefore infinite wagons) to fulfill that requirement
I think poochon means that you have a fixed number of wagons (say n) and your goal is to determine what n is. Somehow you have to use the light switches while traveling from wagon to wagon (where the wagons are connected in a circle).



ironclaw wrote:Here's a solution.
Name the wagon you start in wagon 1, and name the wagons consecutively from 1 to n. Turn off the light in wagon 1, and execute the following loop:
Suppose that you are in wagon i. Go to wagon i+1. If the light is on, go on to the next wagon, and repeat this loop. If the light is off, turn it on and go back to wagon 1. If the light is on at wagon 1, then there are exactly i wagons. Otherwise, if the light is off at wagon 1, go to wagon i+1 and repeat this loop.

poochon wrote:ironclaw wrote:Here's a solution.
Name the wagon you start in wagon 1, and name the wagons consecutively from 1 to n. Turn off the light in wagon 1, and execute the following loop:
Suppose that you are in wagon i. Go to wagon i+1. If the light is on, go on to the next wagon, and repeat this loop. If the light is off, turn it on and go back to wagon 1. If the light is on at wagon 1, then there are exactly i wagons. Otherwise, if the light is off at wagon 1, go to wagon i+1 and repeat this loop.
NICE! that's the solution i've been looking for
zapp and bmonk, in the solution you had to use only the lights


ironclaw wrote:Here's a solution.
Name the wagon you start in wagon 1, and name the wagons consecutively from 1 to n. Turn off the light in wagon 1, and execute the following loop:
Suppose that you are in wagon i. Go to wagon i+1. If the light is on, go on to the next wagon, and repeat this loop. If the light is off, turn it on and go back to wagon 1. If the light is on at wagon 1, then there are exactly i wagons. Otherwise, if the light is off at wagon 1, go to wagon i+1 and repeat this loop.

SpikedMath wrote:I wonder if there is a shorter solution? Hmm...
A Holocaust Survivor wrote:I will never say anything that couldn't stand as the last thing I ever say.


capncanuck wrote:Well, it's simple enough to program.

hellerbarde wrote:aren't you allowed to look outside the windows? that might make it easier... but only for a number of wagons so that you could still see the other side of the circle

SpikedMath wrote:This is a nice solution! It might take a long time to do if you have to return to wagon 1 all the time. I wonder if there is a shorter solution? Hmm...
ironclaw wrote:SpikedMath wrote:This is a nice solution! It might take a long time to do if you have to return to wagon 1 all the time. I wonder if there is a shorter solution? Hmm...
Here's an outline of a potentially faster solution.Spoiler! :

xander wrote:ironclaw wrote:
Here's an outline of a potentially faster solution.Spoiler! :Spoiler! :
xander

Zapp wrote:xander wrote:ironclaw wrote:
Here's an outline of a potentially faster solution.Spoiler! :Spoiler! :
xanderSpoiler! :

Users browsing this forum: No registered users and 0 guests