News for hackers. Stuff that matters.
Re:Python – Lightweight snake game running in the console by vkjv on Tuesday May 19, 2015 @12:40PM (#9571368)
Nice 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 by Tankenstein on Tuesday May 19, 2015 @04:32PM (#9572944)
Excellent! 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 by coreyja on Tuesday May 19, 2015 @02:22PM (#9572090)
Not 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 by tancredi on Tuesday May 19, 2015 @02:43PM (#9572218)
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 by johnmaguire2013 on Tuesday May 19, 2015 @04:49PM (#9573040)
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...

Re:Python – Lightweight snake game running in the console by coreyja on Tuesday May 19, 2015 @02:46PM (#9572231)
That worked perfectly for me, thanks!
Re:Python – Lightweight snake game running in the console by ben174 on Tuesday May 19, 2015 @02:44PM (#9572221)
Since 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 by stillsut on Tuesday May 19, 2015 @02:30PM (#9572145)
Doesn't work on windows -

    ImportError: No module name fcntl