The Circular Train Puzzle

preview_player
Показать описание
You are trapped in a circular train. What is the best method for figuring out how many train cars there are?
Рекомендации по теме
Комментарии
Автор

A modest change to your final alternating direction method might be to continue walking in the same direction for your planned Check(n) number (n=1, 2, 4, 8, 6 etc.), UNLESS the last car is an unlighted car, in which case you should extend the walk in that direction until you find a lighted car. If that ends up taking 10 steps in one direction instead of your planned 8, you can use 10 as your number to double for the next application of Check(n). In this way, we might go one car past the end on our next-to-last check, but we're able to slightly reduce the number of back and forth trips for very long trains.

JustAnotherEngineer
Автор

Super easy. Since there is no mention the cars are moving, we can assume they are fixed in space. Using a compass, note your starting point relative to the compass. Proceed through the cars counting until you have reached your original point on the compass. Done.

blackops
Автор

Please do not use "exponentially" when you know it is quadratic.

NisJrgensen
Автор

Since one of the assumptions is a circular train, can you take advantage of the fact that the minumum train length is 3? A one car train cannot have its right exit adjacent to its left entrance. Also, a two car train would not be able to connect its exits and entrances. A three car train would be more like an equilateral triangle, but it would approximate a circular train.

JDAddelston
Автор

A simple improvement is moving forward after going 2n places until you reach a car in the same state as the first car before doubling back. Therefore growing n a little quicker.

Jeremy-The-Bullfrog
Автор

Won't the people in the train cars get upset if your go around turning the lights off? What if they turn them back on?

soltup
Автор

Not sure if this is more efficient, but i think there's a number of ways to go about solving this puzzle by using alternating on/offs to count.
For example, the most primitive one would be to just walk the length of the train and turn everything on, then alternately switch off the lights and count the number of switches you've pressed, and once you reach a car-oh
just realized if the train has an even number of cars you're sorta stuck
and also how do you even know when to stop doing the switch everything on in the first place?
LMAO there goes the whole thing
welp, fun puzzle tho

ManekaAgarwal
Автор

I very appreciate how much effort you put into

p-productions
Автор

I wonder if by setting the cars you've gone through to a specific pattern you might be able to grow n quicker.

I suspect turning on powers of 2 only may have utility.

Or only turning on one.

Jeremy-The-Bullfrog
Автор

Efficient? Turning all these lights on is going to really increase energy consumption! :D

TomDeGreyt
Автор

Can you reexplain the back and forth method? Wouldn't have cars at both ends of the train with lights off be confusing? For example with a two car train you turn on your starting car, take one step and leave it off, then turnaround 1 step back to the starting car then the next step you're on the other side, but you don't know if it's off because it's a different car that started off or the actual case that it's car 2 that you turned off, right?

Also, is starting with check(1) just default for an unbound range? Why not start with check (2) or check (8) or something higher?

kcolloran
Автор

what if i just count the light switches? would that count?

jezreelbernabe