# [Community puzzle] Inertia ride

This topic is about the puzzle Inertia ride.

Feel free to send your feedback or ask some help here!

I like the idea of this puzzle, but there is a flaw in how it implements physics.

By your rules, if you enter an upward slope with inertia of 1, it gets decreased to -9 and then becomes 9 in the opposite direction. You exit the slope with more momentum than you entered with!

In a \_/ trough this would create an infinite loop of 1-9-8-2-1-9-8-2â€¦ inertia.

To be physically plausible, 1 inertia should only get you 1/10 of the way up a slope. Sliding back down would then gain you 0.9 inertia.

2 Likes

Thatâ€™s a known â€śpropertyâ€ť of this puzzle, that was discussed when it was in staging process in the communiy puzzle queue. At some point we were even trying to make a fun test case out of it.
It was decided it wasnâ€™t really a problem, as:

• the â€śphysicsâ€ť, for better or worse, is well-specified
• loop cases are neither featured in the validators nor made possible by the output format
See it as you would with CSB physics: itâ€™s not the real world, itâ€™s just the way it is.

What could be done OTOH is provide a formal guarantee of no-loop situations. Probably better than the â€śno-Vâ€ť clause, which as you noticed doesnâ€™t protect against much.

PS: thereâ€™s another weird edge case in the physics. Can you find it?

As a science enthusiast, I was quite ashamed when I discovered this physics flaw shortly after submission, but as a game enthusiast I decided to keep the rules as they were since they are easier to understand (always the same gameplay over realism trade off), with the agreement of the community (actually, mostly JBM).

Hint for the second edge case : it is on itself an edge case of the first one.

I wonder if the physical model is well described enough when the car changes direction. I canâ€™t seem to get my model aligned with that of the description and all I can find is:

`If your inertia goes negative, your wagon changes direction (switching back your inertia to its absolute value and reversing ascending and descending tracks).`

So if a coaster goes up a slope with inertia 2 (need to subtract 10), does it come down with inertia 8 or 2?

Sounds very similar to:

Example 2 :
Your wagon is on an ascending track / with an inertia of 8. The inertia is decreased to -2 so your wagon changes direction and move to the previous track with an inertia of 2.

So, to your question:

On the next turn, it moves to the previous track with an inertia of 8.

The physics are not intuitive, but I think that they are adequately explained, especially given the thorough examples at the bottom of the description. If you have any specific recommendations about wording changes, we could consider them.

• danBhentschel

Maybe Iâ€™m doing something wrong but I have loop in the given second V-shape test:

steps:

1. inertia 2, position 0.
2. inertia 1 => position 1.
3. inertia 10 => position 2.
4. inertia 19 => position 3.
5. inertia 28 => position 4.
6. inertia 27 => position 5.
7. inertia 17 => position 6.
8. inertia 7 => position 7.
9. inertia -3 => position 6.
10. inertia -12 => position 5.
11. inertia -21 => position 4.
12. inertia -20 => position 3.
13. inertia -10 => position 2.
14. inertia 0 => position 2.
15. inertia 9 => position 3.
15. inertia 18 => position 4.
16. inertia 17 => position 5.
17. inertia 7 => position 6.
18. inertia -3 => position 5.
19. inertia -12 => position 4.
20. inertia -11 => position 3.
21. inertia -1 => position 2.
23. inertia 9 => position 3.

The step 23 is the same as step 15. Whatâ€™s wrong in my calculations?

What a coincidence, your divergence is precicely a wrong assumption in the other weird edge case in the physics.

Hereâ€™s my log on this test. Iâ€™ll let you figure out your bug on your own

Position 0 inertia 2
Position 1 inertia 1
Position 2 inertia 10
Position 3 inertia 19
Position 4 inertia 28
Position 5 inertia 27
Position 6 inertia 17
Position 7 inertia 7
Position 6 inertia 3
Position 5 inertia 12
Position 4 inertia 21
Position 3 inertia 20
Position 2 inertia 10
Position 2 inertia 0
Position 3 inertia 10
Position 4 inertia 19
Position 5 inertia 18
Position 6 inertia 8
Position 5 inertia 2
Position 4 inertia 11
Position 3 inertia 10
Position 3 inertia 0
Position 4 inertia 10
Position 5 inertia 9
Position 4 inertia 1

3 Likes

I finally figured it out but I must admit it was so annoying! Not because the physics is not properly implemented, but because this edge case when you ascend and get inertia=0: I was adding 9 on the next move (sic!!!) because I thought I was descending (seems logical - the wagon starts to move down)! Only thanks to your debug output i noticed that when inertia=0 iâ€™m not instantly on descending track, itâ€™s still ascending (so need to do -10 instead of +9).

1 Like

Yup, this puzzle is really better solved seeing it as an implementation one than a physics one

Yeah I donâ€™t know if I would have solved it without the debug output either. Definitely not intuitive from a logical point of view, but I guess re-reading the rules it is clear that you only change directions on negative so I should have caught that mistake earlier.

Really non intuitive as said in the previous comment

I had the same problem. I was testing inertia so I only knew my current state. I wasnâ€™t keeping track of which direction I was going before I came to a halt, so I ended up making the same assumption.

If you are doing this and just canâ€™t get it to work - check when you come to a complete stop that slopes add 10 inertia. I assumed this would be like falling and only add 9 and ended up spending a couple of hours of trying heaps of different things to try get it to work, when all I needed to do was change a couple of 9s to 10s

I passed all but test 5, where my output is 1 tile away from the correct answer, and test 8, where the program ran into an infinite loop, likely due to the same error. Can someone please point out the very step in which I unknowingly slipped out of the right track?

`````` 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
_  \  \  \  _  _  /  _  /  \  \  \  \  _  /  /  _  /  /  /  /  _
``````
Table
id track inertia diff direction
0 _ 23 -1 1
1 \ 22 9 1
2 \ 31 9 1
3 \ 40 9 1
4 _ 49 -1 1
5 _ 48 -1 1
6 / 47 -10 1
7 _ 37 -1 1
8 / 36 -10 1
9 \ 26 9 1
10 \ 35 9 1
11 \ 44 9 1
12 \ 53 9 1
13 _ 62 -1 1
14 / 61 -10 1
15 / 51 -10 1
16 _ 41 -1 1
17 / 40 -10 1
18 / 30 -10 1
19 / 20 -10 1
20 / 10 -10 0
20 / 0 -9 -1
19 / -9 -9 -1
18 / -18 -9 -1
17 / -27 -9 -1
16 _ -36 1 -1
15 / -35 -9 -1
14 / -44 -9 -1
13 _ -53 1 -1
12 \ -52 10 -1
11 \ -42 10 -1
10 \ -32 10 -1
9 \ -22 10 -1
8 / -12 -9 -1
7 _ -21 1 -1
6 / -20 -9 -1
5 _ -29 1 -1
4 _ -28 1 -1
3 \ -27 10 -1
2 \ -17 10 -1
1 \ -7 10 1
2 \ 3 9 1
3 \ 12 9 1
4 _ 21 -1 1
5 _ 20 -1 1
6 / 19 -10 1
7 _ 9 -1 1
8 / 8 -10 -1
7 _ -2 1 -1
6 / -1 -9 -1
5 _ -10 1 -1
4 _ -9 1 -1
3 \ -8 10 1
4 _ 2 -1 1
5 _ 1 -1 0

It looks like you missed this part in the statement?

â€˘ If your inertia goes negative, your wagon changes direction (switching back your inertia to its absolute value and reversing ascending and descending tracks).

Hi,

In your table, your id 0 should be â€ś_â€ť, the entry position, by the time you reach the first â€ś\â€ť the inertia has dropped to 22, in your case the inertia is 22 only when reaching the second â€ś\â€ť.

That was another bug in the debugging process, which cause the track column to represent the upcoming tracks and not the current ones. I edited the table; it should have no effect on any other values.

20 / 0 -9 -1
19 / -9 -9 -1
18 / -18 -9 -1

Your error is here, with an inertia of 0 the direction hasnâ€™t changed yet (direction changes after it goes negative) so â€ś/â€ť is still decreasing the inertia by 10. You are reaching the position 19 with an inertia of -10 and not -9 and at this point the direction has changed so after that you move to position 18 with an inertia of -19 (this time itâ€™s only 9)

Thanks. Iâ€™ve finished the puzzle.