Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated menu.py for Python 3 #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions menu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import subprocess
import os

Expand All @@ -8,55 +7,55 @@

def printHeader():
os.system('clear')
print 'S N A K E\n'
print('S N A K E\n')

def tutorial():
global state

if state == 0:
printHeader()
print '\nHi there! Welcome to Snake.'
print 'Type snake to launch the game'
print('\nHi there! Welcome to Snake.')
print('Type snake to launch the game')
success = False
while not success:
command = raw_input()
command = input()
if command == 'snake':
print '\nUse the keys to move and Q to quit'
print('\nUse the keys to move and Q to quit')
subprocess.call("sleep 1", shell=True)
print '3...'
print('3...')
subprocess.call("sleep 1", shell=True)
print '2...'
print('2...')
subprocess.call("sleep 1", shell=True)
print '1...'
print('1...')
subprocess.call("sleep 1", shell=True)
subprocess.call("python __main__.py", shell=True)
success = True
state += 1
else:
print 'Type snake to launch the game'
print('Type snake to launch the game')

elif state == 1:
printHeader()
print 'Great game. Now let\'s see what options are available.'
print 'Type snake --help'
print('Great game. Now let\'s see what options are available.')
print ('Type snake --help')
success = False
while not success:
command = raw_input()
command = input()
if command == 'snake --help' or command == 'snake -h':
subprocess.call("python . --help", shell=True)
subprocess.call("sleep 1", shell=True)
success = True
state += 1
else:
print 'Type snake --help'
print('Type snake --help')

elif state == 2:
print '\n\nYou can try different themes for the game'
print 'For example, type snake --theme minimal'
print 'Or type snake --help to get a list of available themes and then snake --theme "name"'
print('\n\nYou can try different themes for the game')
print('For example, type snake --theme minimal')
print('Or type snake --help to get a list of available themes and then snake --theme "name"')
success = False
while not success:
command = raw_input()
command = input()
cmdArray = command.split(' ')
if len(cmdArray) == 3 and \
cmdArray[0] == 'snake --theme' and \
Expand All @@ -69,7 +68,7 @@ def tutorial():
elif command == 'snake --help' or command == 'snake -h':
success = False
else:
print 'Try typying snake --theme minimal'
print('Try typying snake --theme minimal')

def run():
try:
Expand All @@ -78,4 +77,4 @@ def run():
except KeyboardInterrupt:
exit()

run()
run()