3 ms·
Another, in Python: https://github.com/darius/sturm/blob/master/2048.py https://github.com/darius/sturm/blob/master/2048.py This one animates the sliding of the
by abecedarius 8y ago
Another, in Python: https://github.com/darius/sturm/blob/master/2048.py https://github.com/darius/sturm/blob/master/2048.py
This one animates the sliding of the pieces.
The terminal input-handling might not work in your OS -- I gave up trying to find a nice cross-platform approach to that.
- hk__2 8y ago> The terminal input-handling might not work in your OS -- I gave up trying to find a nice cross-platform approach to that. I wrote a terminal version of 2048 back in 2014 [1] and the input-handling works on all platforms I know of. You may want to look at the code: https://github.com/bfontaine/term2048/blob/master/term2048/keypress.py https://github.com/bfontaine/term2048/blob/master/term2048/k... [1]: https://github.com/bfontaine/term2048 https://github.com/bfontaine/term2048
- abecedarius 8y agoThanks. I'm not sure yet if that will help with the trouble I was having (I wanted the library to support extra features not needed for 2048), but it's great to see small code to learn from.