inishchith / 2048.wasm

2048 written in C and compiled to WebAssembly
https://2048.nishchith.com
MIT License
48 stars 3 forks source link

New tiles should not appear if no changes occur #2

Open tcsullivan opened 3 years ago

tcsullivan commented 3 years ago

Nice project, love the game! Going off of other versions of 2048 that I've played (e.g. 2048.io), if an attempted move doesn't slide any tiles then no new tile should spawn. This makes the game a bit more challenging, forcing the player to move tiles each turn.

Looks like the easy fix would be to copy the grid in loop before a key event tries to modify it, then only call add_value if the grid has changed.

inishchith commented 3 years ago

@tcsullivan Good catch.

Feel free to take this up if you are still interested and find time - or else I will some time in the future.

Thanks!