Python – Lightweight snake game running in the console
1–9 of 9 posts
Re: Python – Lightweight snake game running in the console
#2Nice work! IMHO, Snake is one of the best games to get your feet wet programming. I have very fond memories of writing a snake game on the TI-83. IIRC, my event loop was so slow that I didn't even need any wait states to make the game playable.
Re: Python – Lightweight snake game running in the console
#3Not working for me in OSX 10.10. Here is a PasteBin of the error I'm getting. http://pastebin.com/CicWMAc2
Re: Python – Lightweight snake game running in the console
#4Doesn't work on windows -
ImportError: No module name fcntlRe: Python – Lightweight snake game running in the console
#5Not working for me in OSX 10.10. Here is a PasteBin of the error I'm getting. http://pastebin.com/CicWMAc2
Try to use with maximised window - it's a bug that happens when trying to draw on a window that's too small
Re: Python – Lightweight snake game running in the console
#6Since this is a snake game, and it's python, you really should switch to snake_case rather than camelCase :)
Re: Python – Lightweight snake game running in the console
#7Re: Python – Lightweight snake game running in the console
#8Excellent! Just as a tip, when writing curses it's best to run everything in a curses wrapper, so wrap your main function in curses.wrapper(main) basically. If you don't do so, crashing messes up the terminal.
Re: Python – Lightweight snake game running in the console
#9Not working for me in OSX 10.10. Here is a PasteBin of the error I'm getting. http://pastebin.com/CicWMAc2
Try to use with maximised window - it's a bug that happens when trying to draw on a window that's too small
Regarding this, does anyone have tips on how best to do curses layouts that support different window sizes? I'm working on a procedurally generated console game in my free time, using Python + curses, and this is an issue I run into as well.
I've been considering taking some time to try to write some sort of "fluid" or "dynamic" layout framework for curses (i.e. specify percents for width / height, and have it automatically expand). Seems like a giant pain though...