Skip to content

Instantly share code, notes, and snippets.

View hjohnsen's full-sized avatar

H Johnsen hjohnsen

  • Sunnyvale, CA
View GitHub Profile
@hjohnsen
hjohnsen / modified_snake.py
Created March 24, 2018 19:32
I had a dream about a game that was kind of like mariokart meets snake. You had to move towards the food/target while also running away from an enemy. I modified the code from https://gist.github.com/sanchitgangwar/2158089 to make this game.
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
# Adapted from https://gist.github.com/sanchitgangwar/2158089
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint, choice
def update_anim(snake, key, symbol):
# Calculates the new coordinates of the head of the snake.