News for hackers. Stuff that matters.
Re:Show HN: 1024, a 2048 Puzzle Game by selectnull on Wednesday August 10, 2022 @06:48AM (#32409984)
Just like few others here, I wanted keyboard shortcuts so I just hacked it quickly. Will break if DOM classes change, but author should implement something better.

Cool game.

```

const rotate = (direction) => { const directions = {counterclockwise: 0, clockwise: 1}; const buttons = Array.from(document.querySelector('.mt-16.flex.items-center.justify-between.w-72.h-12.px-2').querySelectorAll('div')).filter(el => el.className === ''); buttons[directions[direction]].click(); }

document.addEventListener('keydown', (ev) => { switch (ev.key) { case 'ArrowLeft': rotate('counterclockwise'); break; case 'ArrowRight': rotate('clockwise'); break; } });

```

Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Wednesday August 10, 2022 @07:15AM (#32410152)
Thanks a lot! I just added the keyboard shortcuts :)
Re:Show HN: 1024, a 2048 Puzzle Game by pphysch on Wednesday August 10, 2022 @12:49PM (#32414998)
It is neat that the modern browser, for all its flaws, is so easily hackable
Re:Show HN: 1024, a 2048 Puzzle Game by beeforpork on Wednesday August 10, 2022 @08:15AM (#32410645)
Nice game! Thanks!

Some proposals to improve usability:

The game should notice a stalemate and tell you that you lost (no matter how you rotate: no more progress is possible).

The game should accept a hit of 'Return' to start the new game (it currently seems to insist of mouse interaction).

The game should have a 'fast' mode with less animation so that I can play faster. A single move takes too long! I am impatient! :-)

Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Wednesday August 10, 2022 @08:38AM (#32410910)
Thanks a lot! Will add all these good ideas :)
Re:Show HN: 1024, a 2048 Puzzle Game by eganist on Tuesday August 09, 2022 @09:02PM (#32406728)
You have a pause in there where the tiles take a moment. Please let us use that pause to rotate a second time before the tiles fall so we can also get the pieces to move across the board rather than just slide parallel.
Re:Show HN: 1024, a 2048 Puzzle Game by NackerHughes on Wednesday August 10, 2022 @03:37AM (#32408834)
I think both modes would make for interesting gameplay - one where you can rotate 180 degrees, and one where you're restricted to 90 degrees at a time (kind of like those Game & Watch games with 'Game A' and 'Game B').

Very fun take on the old 2048 concept, but I'd better stop playing now otherwise I'll be on it all morning!

My only suggestion is to add control by cursor keys in addition to mouse.

Re:Show HN: 1024, a 2048 Puzzle Game by xmprt on Wednesday August 10, 2022 @02:41AM (#32408472)
I think the restrictions make the game more interesting. However the pause is a bit annoying. If you make a move before the animation finished then it should either speed up the animation or skip it.
Re:Show HN: 1024, a 2048 Puzzle Game by eastbound on Wednesday August 10, 2022 @01:35PM (#32415712)
And if you spin very rapidly, centrifugal force applies.
Re:Show HN: 1024, a 2048 Puzzle Game by eganist on Wednesday August 10, 2022 @01:42PM (#32415801)
I'd be down as heck for a 2D physx/femfx-accelerated 2048.

I have no idea what it would look like, but it'd open the pool for strat on solving the puzzles I think. May need to play around a bit with the shapes and materials to make it more interesting though.

Re:Show HN: 1024, a 2048 Puzzle Game by chii on Wednesday August 10, 2022 @08:22AM (#32410710)
but if you allow that, what's the difference really between this game and the original 2048?
Re:Show HN: 1024, a 2048 Puzzle Game by nextaccountic on Wednesday August 10, 2022 @09:30AM (#32411574)
Well the original 2048 has new tiles popping up constantly, this one doesn't. But indeed, with 180 degrees rotation this one would just be an easier 2048
Re:Show HN: 1024, a 2048 Puzzle Game by eganist on Wednesday August 10, 2022 @12:49PM (#32414987)
Different input, but functionally you're right.
Re:Show HN: 1024, a 2048 Puzzle Game by justinator on Tuesday August 09, 2022 @07:45PM (#32406141)
That was fun! But I was able to solve the puzzle by continually rotating the same direction.

I bet this was tried, but what's play like with the same game mechanics of this version, but with the original game play, where each move gives you a new block?

Re:Show HN: 1024, a 2048 Puzzle Game by eyelidlessness on Tuesday August 09, 2022 @09:28PM (#32406901)
> But I was able to solve the puzzle by continually rotating the same direction.

I’m not gonna ruin the original game’s mechanics for anyone who hasn’t already had them ruined, but I will say I recently tried exactly this strategy in the original and it gets you surprisingly far. But it’s definitely not a winning strategy.

Re:Show HN: 1024, a 2048 Puzzle Game by agileAlligator on Wednesday August 10, 2022 @03:18AM (#32408711)
I've spent unhealthy amounts of time playing 2048, and so far the best strategy I have come up with is never swipe up unless absolutely necessary and even then swiping up will likely cause the game to end in the next few moves (unless you get lucky and resolve the stuck block in some way)
Re:Show HN: 1024, a 2048 Puzzle Game by phkahler on Wednesday August 10, 2022 @09:29AM (#32411565)
In 2048 I find alternating between right and down swipes goes really far. Or any other 2 adjacent directions. I know I made it to 8192 at least once and perhaps 16384 - not by just alternating swipes of course.
Re:Show HN: 1024, a 2048 Puzzle Game by scoot on Tuesday August 09, 2022 @07:48PM (#32406183)
2048 was similarly flawed (cycle up, right, down, left to win), so I doubt a new block on each turn will solve the issue any more than it did for the original.
Re:Show HN: 1024, a 2048 Puzzle Game by ironchest on Wednesday August 10, 2022 @01:46AM (#32408166)
I just tried this a few times, I don't win. I get to 256, even tried on different implementations.
Re:Show HN: 1024, a 2048 Puzzle Game by eps on Wednesday August 10, 2022 @04:31AM (#32409239)
Threes, which is what 2048 was ripped from, is not solvable this way.
Re:Show HN: 1024, a 2048 Puzzle Game by justinator on Tuesday August 09, 2022 @10:32PM (#32407278)
Well, shit.
Re:Show HN: 1024, a 2048 Puzzle Game by kenjackson on Wednesday August 10, 2022 @03:19AM (#32408715)
Just tried it and it didn’t work.
Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Tuesday August 09, 2022 @07:52PM (#32406219)
Mhh it could be tried yes! It is a small idea I need to improve! Normally, you would not have the best solution if you rotate in the same direction, but yes it's not really fun to win even doing that :/ Thanks!
Re:Show HN: 1024, a 2048 Puzzle Game by cheschire on Tuesday August 09, 2022 @09:49PM (#32407035)
Sure that solves the puzzle in 27 moves. So try to solve it in less moves.
Re:Show HN: 1024, a 2048 Puzzle Game by justinator on Tuesday August 09, 2022 @10:33PM (#32407287)
It doesn't feel very engaging - it just becomes a game of golf.
Re:Show HN: 1024, a 2048 Puzzle Game by justinator on Tuesday August 09, 2022 @10:36PM (#32407303)
Or more like a lock combination. I wasn't aware the blocks weren't random.
Re:Show HN: 1024, a 2048 Puzzle Game by donatj on Tuesday August 09, 2022 @11:45PM (#32407648)
Are there any keyboard shortcuts to this I'm not finding? Really needs keyboard shortcuts.
Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Wednesday August 10, 2022 @07:15AM (#32410155)
Just added them! Thanks for the feedback!
Re:Show HN: 1024, a 2048 Puzzle Game by eyelidlessness on Tuesday August 09, 2022 @09:23PM (#32406872)
Thanks, I love and hate it!

I’ve been obsessively playing another 2048 variant which was a recent Show HN[1], and has confounded me since. Yours has a much gentler learning curve and obviously isn’t designed to be unbeatable. Rotating the whole board will probably continue confounding me in entirely different ways.

1: https://www.adversarial2048.com/

Re:Show HN: 1024, a 2048 Puzzle Game by metadat on Tuesday August 09, 2022 @09:37PM (#32406966)
Fiendishly masochistic, thanks for sharing.
Re:Show HN: 1024, a 2048 Puzzle Game by dalmo3 on Tuesday August 09, 2022 @08:32PM (#32406515)
I don't get it. The numbers add up to 128. Then what?
Re:Show HN: 1024, a 2048 Puzzle Game by dalmo3 on Tuesday August 09, 2022 @10:51PM (#32407386)
Okay, there's a victory screen now, which didn't show the first time I played.
Re:Show HN: 1024, a 2048 Puzzle Game by nextaccountic on Wednesday August 10, 2022 @09:37AM (#32411692)
it should be called 128 then, or at least add some blocks when 1028 is formed to eventually get to 1024

2048 is called that way because you need a 2048 block to win

Re:Show HN: 1024, a 2048 Puzzle Game by notRobot on Tuesday August 09, 2022 @09:28PM (#32406903)
To get to 128 with the least number of moves.
Re:Show HN: 1024, a 2048 Puzzle Game by eyelidlessness on Tuesday August 09, 2022 @09:34PM (#32406949)
Then you have to play 7 more times.
Re:Show HN: 1024, a 2048 Puzzle Game by armchairhacker on Tuesday August 09, 2022 @07:19PM (#32405906)
Suggestion: make it so that arrow keys (left, right) rotate the board.
Re:Show HN: 1024, a 2048 Puzzle Game by KMnO4 on Tuesday August 09, 2022 @07:32PM (#32406038)
Even more abstract suggestion: rotate the board with the device accelerometer.
Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Tuesday August 09, 2022 @07:50PM (#32406207)
Ahah it could be a settings thanks for the idea!
Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Wednesday August 10, 2022 @07:16AM (#32410157)
Just did it, thanks a lot!
Re:Show HN: 1024, a 2048 Puzzle Game by fuegoio on Tuesday August 09, 2022 @07:50PM (#32406203)
Will add for sure thanks!
Re:Show HN: 1024, a 2048 Puzzle Game by valbaca on Tuesday August 09, 2022 @07:44PM (#32406128)
Neat!! but please, please support left-and-right keys and better mobile (swipe left and swipe right)
Re:Show HN: 1024, a 2048 Puzzle Game by eps on Wednesday August 10, 2022 @04:19AM (#32409160)
Excellent.

Is each board guaranteed to be solvable?

For playing on mobile - it's be nice to be able to rotate by swiping vertically down the empty space on the left or on the right of the board.

Re:Show HN: 1024, a 2048 Puzzle Game by djbusby on Tuesday August 09, 2022 @07:52PM (#32406221)
You have been hugged to death. I'm getting 503s and other errors from Netlify. Congratulations!

Edit: now intermittent errors

Re:Show HN: 1024, a 2048 Puzzle Game by noduerme on Tuesday August 09, 2022 @11:38PM (#32407630)
I feel like a more interesting piece of code would be one that generated random (but solvable) puzzles and showed what the minimum number of moves was to solve them.
Re:Show HN: 1024, a 2048 Puzzle Game by Humphrey on Wednesday August 10, 2022 @12:09AM (#32407761)
I initially tried to rotate my phone. It look me a while to notice the buttons. Good 5 mins of fun!
Re:Show HN: 1024, a 2048 Puzzle Game by btutal on Friday August 12, 2022 @04:33PM (#32443549)
I couldn't do less than 12 but definitely fun to play!
Re:Show HN: 1024, a 2048 Puzzle Game by nwsm on Tuesday August 09, 2022 @09:31PM (#32406925)
Ouch, I wasn't expecting to get in a stalemate position by turn 15
Re:Show HN: 1024, a 2048 Puzzle Game by t_a_v_i_s on Wednesday August 10, 2022 @10:30AM (#32412606)
Fun! My best score is 13. Do you plan on randomizing the start?