Я работаю над Counter Strike: Глобальное написание текстовых приключений для моего финального проекта на моем курсе по информатике в средней школе.Неожиданная ошибка EOF в приключенческой игре python
Я пробовал все, что задавал многие из моих сверстников, и пропустил визуализатор питона не менее 10 раз, и я просто не могу найти причину моей проблемы.
Пожалуйста, помогите мне найти причину этой ошибки EOF.
###############################################################################################################################################
# Programmer: Ethan
# Date: 29/5/15
# File name: CS-GO.py
# Description: This is a text based adventure game following the format and style of Counter Strike Global Offensive.
###############################################################################################################################################
import time
import math
import random
CT=1
T=2
money=800
hp=500
Round=1
class Players():
def __init__(self,name,accuracy,hs,phrase):
self.name=name
self.accuracy=accuracy
self.hs=hs
self.phrase=phrase
def __str__(self):
return str(self.name)+" \t"+str(self.accuracy)+" \t\t"+str(self.hs)
player_1=Players("Ethan",45,82,"3...2.....1..... REKT")
player_2=Players("Adam",21,13,"Rush kitty kat MEOW MEOW!")
player_3=Players("Anson",3,5,"Ugh.......NO NO NO NO!")
player_4=Players("Greg",22,25,"HEIN SITZIZEN")
player_5=Players("Connor",30,50,"Some of my fingers are on a trackpad..... the others.... well, you'll just have to ask your mother.")
##############
#Main Program#
##############
while True:
try:
print ("Welcome to text based CS:GO")
time.sleep(2)
print ("Please choose from one of the following players")
time.sleep(.5)
print ("## Name \tAccuracy\tHS%:")
print("#1",player_1)
print("#2",player_2)
print("#3",player_3)
print("#4",player_4)
print("#5",player_5)
player=int(input("Enter the corresponding #: "))
if player ==1:
ac=45
hs=82
elif player ==2:
ac=21
hs=13
elif player ==3:
ac=3
hs=5
elif player ==4:
ac=22
hs=25
elif player ==5:
ac=30
hs=50
game_mode=int(input("\nPlease press 1 in order to start a matchmaking game. \nYou can also press 2 to try your luck at some cases: "))
if game_mode==1:
print ("\nwelcome to matchmaking! Please follow the prompts in order to start your game")
time.sleep(2)
Map=int(input("\nHere at Volvo INC we run the standard competitive map pool.\nPlease press 1 for Dust 2 \nPlease press 2 for Inferno \nPlease press 3 for Mirage \nPlease press 4 for Cache \nPlease press 5 for Cobblestone \nPlease press 6 for Overpass: "))
print ("\n Thank you for choosing Dust 2 ;)")
time.sleep(.5)
print ("\n Finding other silvers for you to play with")
time.sleep(.5)
print ("\n Finding the best potato('Server' for you to play on")
time.sleep(.5)
print ("\n Confirming match")
time.sleep(2)
print ("\n Starting game")
time.sleep(5)
Side=random.randint(0,2)
if Side==1:
Team=CT
print ("\nWelcome to the Counter Terrorists")
time.sleep(1.5)
while hp >0:
print ("It is round #",Round)
print ("You have",money,"dollars")
menu=int(input("Would you like to buy something? y/n"))
if menu ==y:
print ("reky")
elif menu ==n:
print ("Ok then!")
else:
print ("that was an incorrect entry")
else:
Team=T
print ("\nWelcome to the Terrorists")
elif game_mode==2:
print ("we both know you're not getting shit")
Как насчет сообщения об ошибке? – browskie
Немного другой совет: я бы снял профанацию и шутки вашей мамы, прежде чем представлять это как проект CS средней школы. – jayelm
блок 'try' ожидает' except' или 'finally'. У вас его нет, поэтому он попадает в EOF – Dannnno