/
snake_main.py
32 lines (22 loc) · 924 Bytes
/
snake_main.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
29
30
31
32
"""
Filename: snake_main.py
Author: Kyle Cookerly
Description: Console-based Snake clone, written in Python 3.5.1
using the curses module.
"""
import curses # For terminal control
from game import Game
from game_state_screens import draw_start_window, draw_game_over_window, draw_option_select_window
curses.initscr() # Starts screen
curses.noecho() # Hides the keyboard input from the terminal
curses.curs_set(0)
def main():
draw_start_window()
game_mode = draw_option_select_window() # Draws the option screen and assigns the value received to game_mode
snake_game = Game(game_mode)
while not snake_game.is_game_over():
snake_game.run_game()
snake_game.end_window()
draw_game_over_window(snake_game.get_game_score())
if __name__ == "__main__":
main()