Live data from Hacker News

Here's a puzzle game. I call it Reverse the List of Integers

mathstodon.xyz

81–90 of 188 posts

Re: Here's a puzzle game. I call it Reverse the List of Integers

#81
post #46

I thought the game was cool so I built a little version of it here: https://blaise.gg/number_game/index.html

Thought the same, you beat me to it! Really like the tree-like view, might steal that idea later :-) https://bewelge.github.io/aNumberGame/ (does not format well on mobile) Code: https://github.com/Bewelge/aNumberGame

I like that all possible moves are shown at once. Would it be possible to have the sequence be other than [7, 5, 3]?

Re: Here's a puzzle game. I call it Reverse the List of Integers

#82
Squinting at this... Feels like there is some relationship to asking if you can tile a triangle into integer-length non isoceles triangles.

It feels like it is typically going to be impossible. Most puzzles will seem to have only a few legal moves at a time, all of which will either loop back to wehre they are or lead to victory.Generally speaking though,odd numbers are useful.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#83
post #37
post #35

Earlier quoted context omitted.

Yeah, the problem is slightly underspecified, though it’s pretty obvious that you’re not allowed to do swaps as that obviously makes the problem trivial.

Not trivial - I do not see how to solve [3, 2, 1] without this kind of swapping. Perhaps we need to clarify the rules for a starting point first.

Learn Forth. Consequent swappings will reverse an stack.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#84

I hate little puzzles like this when presented in isolation, my brain just bounces off them. If the EXACT same puzzle was presented as part of a real problem with context and reasons, my brain would be all over it and I'd work out a solution. As another comment says, it will inevitably show up as a coding interview, one that I would likely fail!

Yeah, I agree I tried doing leetcode for a while but basically just get bored of it My brain is wired to solve problems and puzzles, but not in isolation. Removed of context I just can't convince myself there's any value in it and I bounce off just as you describe

Yep, the best solution to a puzzle is to just not do it as far as my brain is concerned!

Re: Here's a puzzle game. I call it Reverse the List of Integers

#85

Earlier quoted context omitted.

No, not at all. In a Towers of Hanoi model, this is a completely trivial game. You'd reverse [7, 5, 3] by picking four discs off the first peg and putting them back down on the third peg. The rules here only allow you to move stuff a single peg away from its origin.

In Towers of Hanoi, you're only allowed to pick up one disc at a time, so it's not completely trivial. It's simply operation intensive... kinda like Reverse the List of Integers [1] https://en.wikipedia.org/wiki/Tower_of_Hanoi

They're not suggesting picking up multiple discs at a time:

        [3,2,1][][]
    =>  [3,2][][1]
    =>  [3][][1,2]
    =>  [][][1,2,3]
In effect, they're just observing that the algorithm "while x := A.pop(): B.push(x)" reverses A onto B.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#87

I thought the game was cool so I built a little version of it here: https://blaise.gg/number_game/index.html

Would be nice if you allowed users to define their own puzzle. I had to set a break point at the right location and call startNew([..my array]) to do so.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#89

Coming soon to a coding interview near you!

My thoughts exactly. It would 100% fit in with the interviews I've had in the past year.

Geez. I mean, I could do this, but probably not in a 45 minute interview without knowing how to solve the problem ahead of time.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#90
post #80

Earlier quoted context omitted.

What do you mean by that exactly and why would it be 'dynamic programming' ?

"Dynamic programming" is jargon from competitive programming. It sounds a lot more sophisticated than it is. In reality, it is nothing more than memoization of function calls into an array.

Memoization is just caching so I'm not sure how that would make any difference here.
Post reply on HN