Skip to content

Instantly share code, notes, and snippets.

@yu-lu
yu-lu / LuYU426.Games.Snake.py
Last active December 15, 2015 01:39
This is a 99 lines snake game written upon IronPython. This simple game is tested with both MacOS and Windows, code is slightly different, see comment inline. This is intended to fit in 99 lines, so code is neither well formatted nor well read, please don't blame me on this :P
import os, time, random
from collections import defaultdict
from System import Console, ConsoleColor, ConsoleKey
from System.Threading import Thread, ThreadStart
class Screen(object):
red = ConsoleColor.Red; green = ConsoleColor.Green; blue = ConsoleColor.Blue;black = ConsoleColor.Black
dimension = (21,39)
def __update_input(self):
mapping = defaultdict(lambda: None,