안녕하세요 저는 그래픽 기반의 후자로 변환 할 수있는 뷰가있는 간단한 텍스트 기반의 슬롯 머신을 만들려고합니다.Start()가 정의되지 않았습니다.
잘 작동하는 메뉴를 표시하는 것으로 시작했습니다. 그러나 사용자가 필요한 'p'를 입력하여 계속 진행하면 아직 정의하지 않았기 때문에 다음 함수를 호출하지 않습니다.
from time import sleep
from random import shuffle
#Creates the class
class Machine():
#This is the constructor full of attributes
def __init__(self):
self.reel1 = ["Lemon", "Bell", "Cherry"]
self.reel2 = ["Lemon", "Bell", "Cherry"]
self.reel3 = ["Lemon", "Bell", "Cherry"]
firstSlide = self.reel1
secondSlide = self.reel2
thirdSlide = self.reel3
self.currentFunds = "10"
funds = self.currentFunds
f = open('score.txt', 'w')
f.write(funds)
#Dictates all the funds and checks if the user has enough money or needs to add money
def Funds(self):
if self.currentFunds == "0":
print("You are out of credits! :(\n")
Menu()
#Starts the spinning and randomizes the lists
def Start(self, firstSlide, secondSlide, thirdSlide):
shuffle(firstSlide, secondSlide, thirdSlide)
print(firstSlide[0], secondSlide[1], thirdSlide[3])
#Intro Menu to give player stats and options
def Menu(self):
play = ""
m = Machine()
print('*****************\n')
print(' WELCOME! \n')
print('*****************\n')
print('Current Credits: ', m.currentFunds)
if input("Press P to play \n") == "P" or "p":
machine = Start()
machine.Start()
machine = Machine()
while True:
machine.Menu()
아이디어가 있으십니까?
내 편집 보존 된 들여 쓰기 – vaultah
이 줄의 오류는'machine = Start()'또는이 하나의'machine.Start()'입니까? – user2097159