PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'''
Not my code.
For learning purposes only.
source:
https://github.com/TheAILearner/Snake-Game-using-Python-Curses/blob/master/snake_game_using_curses.py
'''
import random
import curses
import time
#initialize screen
sc = curses.initscr()
h, w = sc.getmaxyx()
win = curses.newwin(h, w, 0, 0)
win.keypad(1)
curses.curs_set(0)
# Initial Snake and Apple position
snake_head = [10,15]
snake_position = [[15,10],[14,10],[13,10]]
apple_position = [20,20]
score = 0
# display apple
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run