def live_day(self): for comm in ["salt", "cybrous"]: for i in range(10): if self.i[comm] <= 2: break cog_min = min(Populous.Population, key=lambda c: c.i[comm]) amount = 1 price_per_unit = 5 terms = (amount, comm, price_per_unit * amount, "dollars") self.trade(cog_min, terms) Cog.live_day(self)
def __init__(self, min_cables, name='anonymous', level=0): """ Initialize the level, defining the dimensions of its cogs """ self.max_cables = int(2**np.ceil(np.log2(min_cables))) self.max_cables_per_cog = 8 self.max_bundles_per_cog = 4 self.max_cogs = self.max_cables / self.max_bundles_per_cog self.max_bundles = self.max_cogs * self.max_bundles_per_cog self.name = name self.level = level ziptie_name = ''.join(('ziptie_', self.name)) self.ziptie = ZipTie(self.max_cables, self.max_cogs, max_cables_per_bundle=self.max_cables_per_cog, mean_exponent=-2, name=ziptie_name) self.cogs = [] # TODO: only create cogs as needed for cog_index in range(self.max_cogs): self.cogs.append( Cog(self.max_cables_per_cog, self.max_bundles_per_cog, max_chains_per_bundle=self.max_cables_per_cog, name='cog' + str(cog_index), level=self.level)) self.cable_activities = np.zeros((self.max_cables, 1)) self.hub_cable_goals = np.zeros((self.max_cables, 1)) self.fill_fraction_threshold = .7 self.ACTIVITY_DECAY_RATE = 1. # real, 0 < x < 1 # Constants for adaptively rescaling the cable activities self.max_vals = np.zeros((self.max_cables, 1)) self.min_vals = np.zeros((self.max_cables, 1)) self.RANGE_DECAY_RATE = 10**-5
def live_day(self): if self.employer != None: relevant_i = self.employer.i else: relevant_i = self.i if relevant_i["salt"] < relevant_i["cybrous"]: comm = "salt" else: comm = "cybrous" v = self.mine(comm) if self.employer != None: print(v, comm) self.trade(self.employer, (v, comm, 3, "dollars")) Cog.live_day(self)
def live_day(self): ## buy from richest for comm in ["salt", "cybrous"]: cog_max = max(Populous.Population, key=lambda c: c.i[comm]) amount = 6 price_per_unit = 1 terms = (price_per_unit * amount, "dollars", amount, comm) self.trade(cog_max, terms) ## sell to poorest for comm in ["salt", "cybrous"]: cog_min = min(Populous.Population, key=lambda c: c.i[comm]) amount = 2 price_per_unit = 5 terms = (amount, comm, price_per_unit * amount, "dollars") self.trade(cog_max, terms) Cog.live_day(self)
def __init__(self): """ Constructor: Creates our Game Controller. - Creates the toontown map (Graph) - Sets current location of the toon to Toontown Central - Starts the cog in Bossbot Headquarters - Picks three random (non playground) spots for bananas - Picks another three different spots for black holes """ self.map = Toontown_Map() self.toon = Toon(self.map.get_vertex('Toontown Central')) self.cog = Cog(self.map.get_vertex( 'Bossbot Headquarters')) # This is where the cog will start off self.banana_locations = set(self.map.get_random_nodes(3)) # print(''.join([str(x) for x in self.banana_locations])) # Uncomment to see where bananas are put self.black_hole_locations = set( self.map.get_random_nodes(3, _exclude=self.banana_locations)) # print(''.join([str(x) for x in self.black_hole_locations])) # Uncomment to see where black holes are put # Number of rounds till the cog moves. self.ROUNDS_TO_MOVE_COG = 5
def __init__(self, min_cables, name='anonymous', level=0): """ Initialize the level, defining the dimensions of its cogs """ self.max_cables = int(2**np.ceil(np.log2(min_cables))) self.max_cables_per_cog = 16 self.max_bundles_per_cog = 8 self.max_cogs = self.max_cables / self.max_bundles_per_cog self.max_bundles = self.max_cogs * self.max_bundles_per_cog self.name = name self.level = level ziptie_name = ''.join(('ziptie_', self.name)) self.ziptie = ZipTie(self.max_cables, self.max_cogs, max_cables_per_bundle=self.max_cables_per_cog, name=ziptie_name, in_gearbox=True) self.cogs = [] # TODO: only create cogs as needed for cog_index in range(self.max_cogs): self.cogs.append( Cog(self.max_cables_per_cog, self.max_bundles_per_cog, max_chains_per_bundle=self.max_cables_per_cog, name='cog' + str(cog_index), level=self.level)) self.cable_activities = np.zeros((self.max_cables, 1)) self.bundle_activities = np.zeros((self.max_bundles, 1)) self.raw_cable_activities = np.zeros((self.max_cables, 1)) self.previous_cable_activities = np.zeros((self.max_cables, 1)) self.hub_cable_goals = np.zeros((self.max_cables, 1)) self.fill_fraction_threshold = 0. self.step_multiplier = int(2**self.level) self.step_counter = 1000000 # The rate at which cable activities decay (float, 0 < x < 1) self.ACTIVITY_DECAY_RATE = 1. # Constants for adaptively rescaling the cable activities self.max_vals = np.zeros((self.max_cables, 1)) self.min_vals = np.zeros((self.max_cables, 1)) self.RANGE_DECAY_RATE = 10**-3
def __init__(self): Cog.__init__(self) self.name = "Church"
def __init__(self): Cog.__init__(self) self.name = "boss "+self.name self.workers = []
def __init__(self): Cog.__init__(self) self.name = "mr "+self.name
def __init__(self): Cog.__init__(self) self.name = "farmer "+self.name self.employer = None
class Game_Controller: def __init__(self): """ Constructor: Creates our Game Controller. - Creates the toontown map (Graph) - Sets current location of the toon to Toontown Central - Starts the cog in Bossbot Headquarters - Picks three random (non playground) spots for bananas - Picks another three different spots for black holes """ self.map = Toontown_Map() self.toon = Toon(self.map.get_vertex('Toontown Central')) self.cog = Cog(self.map.get_vertex( 'Bossbot Headquarters')) # This is where the cog will start off self.banana_locations = set(self.map.get_random_nodes(3)) # print(''.join([str(x) for x in self.banana_locations])) # Uncomment to see where bananas are put self.black_hole_locations = set( self.map.get_random_nodes(3, _exclude=self.banana_locations)) # print(''.join([str(x) for x in self.black_hole_locations])) # Uncomment to see where black holes are put # Number of rounds till the cog moves. self.ROUNDS_TO_MOVE_COG = 5 def round_generator(self): """ A generator method. Each time this method is called a new round of the game is started. (I.e. allows player to make another move). """ # Prime the counter till we move our cog. rounds_till_cog_moves = self.ROUNDS_TO_MOVE_COG while True: print('') print("You are in {}.".format(self.toon.get_location().get_name())) # Check if we are near a cog. near_cog = self.check_near_cog() # Check if we are near a banana. near_banana = self.check_near_banana() # Check if we are near a black hole. near_hole = self.check_near_black_hole() print("Where would you like to go?") print(self.info_tip()) # Wait for a valid input while True: # The next three lines are for tab auto completion completer = MyCompleter( [x.get_name() for x in self.toon.get_location().neighbors]) readline.set_completer(completer.complete) readline.parse_and_bind('tab: complete') location = input("Enter Location (Ex: {}): ".format( next(iter(self.toon.get_location().neighbors)).get_name())) # If location is not within the number of locations we have. next_location = self.map.get_vertex(location) if next_location: break print("This location is not valid.") print("Please try again.") if near_cog: next_location = self.cog_logic( next_location) # If we hit a cog we get a new location if near_banana: if self.banana_logic( next_location): # If we went sad from to many bananas break if near_hole: if self.black_hole_logic( next_location): # If we hit a black whole break self.toon.set_location( next_location) # Move our location to the picked spot # ------------------------------------------------------------ # Handle moving the cog every few rounds. # ------------------------------------------------------------ if rounds_till_cog_moves is 0: # If it is time to move the cog self.change_cog_location() rounds_till_cog_moves = self.ROUNDS_TO_MOVE_COG # Reprime counter else: rounds_till_cog_moves -= 1 yield # Return to main method def check_near_cog(self): """ Checks if the toon is one tunnel away from a cog. """ if self.cog.location in self.toon.get_location().neighbors: print("WARNING: A cog is nearby.") return True return False def cog_logic(self, _next_location): """ Handles the input and output logic if for dealing with a cog. """ print('') print( "Would you like to throw a pie in the tunnel incase there is a cog?" ) print("You have {} pies left.".format(self.toon.pies)) while True: completer = MyCompleter([]) readline.set_completer(completer.complete) readline.parse_and_bind('tab: complete') confirmation = input("Throw Pie? (y or n): ") # If location is not within the number of locations we have. if confirmation is 'y' or confirmation is 'n': break print("Not a valid input.") print("Please try again.") print('') if confirmation is 'y' and self.toon.throw_pie(): if _next_location is self.cog.location: print("You hit the cog.") self.change_cog_location() elif confirmation is 'y': print("You were out of pies") if _next_location is self.cog.location: print("There was a cog there.") print("You got sent back to the last playground.") _next_location = self.toon.last_playground else: if _next_location is self.cog.location: print("There was a cog there.") print("You got sent back to the last playground.") _next_location = self.toon.last_playground return _next_location def check_near_banana(self): """ Checks if the toon is one tunnel away from a banana. """ if self.toon.get_location().neighbors.isdisjoint( self.banana_locations): return False else: print("WARNING: A banana is nearby.") return True def banana_logic(self, _next_location): """ Handles the input and output logic if for dealing with a banana. """ # If our next location is a banana location. if _next_location in self.banana_locations: print("You hit a banana!") print("Your laff has been reduced by 9.") left, total = self.toon.take_damage(9) # Take damage print("Current laff {}/{}".format(left, total)) if left is 0: # If we have no laff left. print("You ran out of laff and went sad.") print("Better luck next time!") return True return False def check_near_black_hole(self): """ Checks if the toon is one tunnel away from a balck hole. """ if self.toon.get_location().neighbors.isdisjoint( self.black_hole_locations): return False else: print("WARNING: A black hole is nearby.") print("If you hit a black hole it will be game over.") return True def black_hole_logic(self, _next_location): """ Handles the input and output logic if for dealing with a black hole. """ if _next_location in self.black_hole_locations: print("You hit a black hole and logged off!") print("Better luck next time!") return True return False def change_cog_location(self): """ Move the cog to a different non playground location. """ new_location = self.map.get_random_nodes()[0] self.cog.change_location(new_location) # print("Moving cog to {}.".format(new_location)) # Comment out to watch when and where cog moves def info_tip(self): """ Returns the info tip for the current location. Such as where the player can go or what they can do. """ return "Options {}".format(self.toon.get_location().get_info_tip())
def __init__(self): #Define variables and file path locations self.currentScreen = 0 self.name = 'New Cog' self.currentDirectory = os.path.abspath(sys.path[0]) self.pandaDirectory = Filename.fromOsSpecific( self.currentDirectory).getFullpath() #Define UI Background self.UIBackground = loader.loadModel( self.pandaDirectory + '/resources/gui/tt_m_gui_ups_panelBg.bam') self.UIBackground.reparentTo(aspect2d) self.UIBackground.setPos(-0.75, 0, 0) self.UIBackground.setScale(1, 1, 1.75) #Set the title text self.remingtonFont = loader.loadFont( self.pandaDirectory + '/resources/gui/vtRemingtonPortable.ttf') self.instructionText = OnscreenText(pos=(0, 0.35), wordwrap=10, font=self.remingtonFont, parent=self.UIBackground, mayChange=True) #Establish where the buttons are located self.buttonMaps = loader.loadModel( self.pandaDirectory + '/resources/gui/tt_m_gui_mat_mainGui.bam') #Define the head selector, its title text, and its scroll buttons self.headSelector = OnscreenImage( image=self.buttonMaps.find('**/tt_t_gui_mat_shuffleFrame'), parent=self.UIBackground, scale=(0.7, 1, 0.5), pos=(0, 0, 0.18)) self.headSelectorText = OnscreenText(text='Head', parent=self.headSelector, pos=(0, -0.04), scale=(0.15, 0.15), fg=(255, 255, 255, 1), font=self.remingtonFont) self.headLeftButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.headSelector, pos=(-0.33, 0, 0), command=self.headLeftClick) self.headRightButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.headSelector, pos=(0.33, 0, 0), scale=(-1, 1, 1), command=self.headRightClick) self.headSelector.hide() #Define the body selector, its title text, and its scroll buttons self.bodySelector = OnscreenImage( image=self.buttonMaps.find('**/tt_t_gui_mat_shuffleFrame'), parent=self.UIBackground, scale=(-0.7, 1, 0.5), pos=(0, 0, 0)) self.bodySelectorText = OnscreenText(text='Body', parent=self.bodySelector, pos=(0, -0.04), scale=(-0.15, 0.15), fg=(255, 255, 255, 1), font=self.remingtonFont) self.bodyLeftButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.bodySelector, pos=(0.33, 0, 0), scale=(-1, 1, 1), command=self.bodyLeftClick) self.bodyRightButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.bodySelector, pos=(-0.33, 0, 0), command=self.bodyRightClick) self.bodySelector.hide() #Define the department selector, its title text, and its scroll buttons self.deptSelector = OnscreenImage( image=self.buttonMaps.find('**/tt_t_gui_mat_shuffleFrame'), parent=self.UIBackground, scale=(0.7, 1, 0.5), pos=(0, 0, -0.18)) self.deptSelectorText = OnscreenText(text='Dept.', parent=self.deptSelector, pos=(0, -0.04), scale=(0.15, 0.15), fg=(255, 255, 255, 1), font=self.remingtonFont) self.deptLeftButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.deptSelector, pos=(-0.33, 0, 0), command=self.deptLeftClick) self.deptRightButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.deptSelector, pos=(0.33, 0, 0), scale=(-1, 1, 1), command=self.deptRightClick) self.deptSelector.hide() #Define the name input self.nameEntryBackground = OnscreenImage( image=loader.loadModel(self.pandaDirectory + "/resources/gui/ChatPanel.bam"), parent=self.UIBackground, scale=(0.6, 1, 0.1), pos=(-0.3, 0, 0.2)) self.nameEntry = DirectEntry(parent=self.nameEntryBackground, relief=None, text='', width=5.5, numLines=2, entryFont=self.remingtonFont, scale=(0.2, 1, 0.4), pos=(-0.05, 0, -0.35), command=self.enterName, focusOutCommand=self.entryUnfocused, focus=False) self.nameEntryBackground.hide() #Define the screen changing buttons self.nextButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_nextUp'), self.buttonMaps.find('**/tt_t_gui_mat_nextDown')), relief=None, command=self.nextButtonClick, parent=self.UIBackground, scale=(0.4, 1, 0.25), pos=(0.3, 0, -0.35)) self.backButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_nextUp'), self.buttonMaps.find('**/tt_t_gui_mat_nextDown')), relief=None, command=self.backButtonClick, parent=self.UIBackground, scale=(-0.4, 1, 0.25), pos=(-0.3, 0, -0.35)) self.backButton.hide() #Call the Cog class to establish the Actor self.cog = Cog() #Change the current UI screen self.screenDirector()
class ConstructACogGUI(): def __init__(self): #Define variables and file path locations self.currentScreen = 0 self.name = 'New Cog' self.currentDirectory = os.path.abspath(sys.path[0]) self.pandaDirectory = Filename.fromOsSpecific( self.currentDirectory).getFullpath() #Define UI Background self.UIBackground = loader.loadModel( self.pandaDirectory + '/resources/gui/tt_m_gui_ups_panelBg.bam') self.UIBackground.reparentTo(aspect2d) self.UIBackground.setPos(-0.75, 0, 0) self.UIBackground.setScale(1, 1, 1.75) #Set the title text self.remingtonFont = loader.loadFont( self.pandaDirectory + '/resources/gui/vtRemingtonPortable.ttf') self.instructionText = OnscreenText(pos=(0, 0.35), wordwrap=10, font=self.remingtonFont, parent=self.UIBackground, mayChange=True) #Establish where the buttons are located self.buttonMaps = loader.loadModel( self.pandaDirectory + '/resources/gui/tt_m_gui_mat_mainGui.bam') #Define the head selector, its title text, and its scroll buttons self.headSelector = OnscreenImage( image=self.buttonMaps.find('**/tt_t_gui_mat_shuffleFrame'), parent=self.UIBackground, scale=(0.7, 1, 0.5), pos=(0, 0, 0.18)) self.headSelectorText = OnscreenText(text='Head', parent=self.headSelector, pos=(0, -0.04), scale=(0.15, 0.15), fg=(255, 255, 255, 1), font=self.remingtonFont) self.headLeftButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.headSelector, pos=(-0.33, 0, 0), command=self.headLeftClick) self.headRightButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.headSelector, pos=(0.33, 0, 0), scale=(-1, 1, 1), command=self.headRightClick) self.headSelector.hide() #Define the body selector, its title text, and its scroll buttons self.bodySelector = OnscreenImage( image=self.buttonMaps.find('**/tt_t_gui_mat_shuffleFrame'), parent=self.UIBackground, scale=(-0.7, 1, 0.5), pos=(0, 0, 0)) self.bodySelectorText = OnscreenText(text='Body', parent=self.bodySelector, pos=(0, -0.04), scale=(-0.15, 0.15), fg=(255, 255, 255, 1), font=self.remingtonFont) self.bodyLeftButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.bodySelector, pos=(0.33, 0, 0), scale=(-1, 1, 1), command=self.bodyLeftClick) self.bodyRightButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.bodySelector, pos=(-0.33, 0, 0), command=self.bodyRightClick) self.bodySelector.hide() #Define the department selector, its title text, and its scroll buttons self.deptSelector = OnscreenImage( image=self.buttonMaps.find('**/tt_t_gui_mat_shuffleFrame'), parent=self.UIBackground, scale=(0.7, 1, 0.5), pos=(0, 0, -0.18)) self.deptSelectorText = OnscreenText(text='Dept.', parent=self.deptSelector, pos=(0, -0.04), scale=(0.15, 0.15), fg=(255, 255, 255, 1), font=self.remingtonFont) self.deptLeftButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.deptSelector, pos=(-0.33, 0, 0), command=self.deptLeftClick) self.deptRightButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowUp'), self.buttonMaps.find('**/tt_t_gui_mat_shuffleArrowDown')), relief=None, parent=self.deptSelector, pos=(0.33, 0, 0), scale=(-1, 1, 1), command=self.deptRightClick) self.deptSelector.hide() #Define the name input self.nameEntryBackground = OnscreenImage( image=loader.loadModel(self.pandaDirectory + "/resources/gui/ChatPanel.bam"), parent=self.UIBackground, scale=(0.6, 1, 0.1), pos=(-0.3, 0, 0.2)) self.nameEntry = DirectEntry(parent=self.nameEntryBackground, relief=None, text='', width=5.5, numLines=2, entryFont=self.remingtonFont, scale=(0.2, 1, 0.4), pos=(-0.05, 0, -0.35), command=self.enterName, focusOutCommand=self.entryUnfocused, focus=False) self.nameEntryBackground.hide() #Define the screen changing buttons self.nextButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_nextUp'), self.buttonMaps.find('**/tt_t_gui_mat_nextDown')), relief=None, command=self.nextButtonClick, parent=self.UIBackground, scale=(0.4, 1, 0.25), pos=(0.3, 0, -0.35)) self.backButton = DirectButton( geom=(self.buttonMaps.find('**/tt_t_gui_mat_nextUp'), self.buttonMaps.find('**/tt_t_gui_mat_nextDown')), relief=None, command=self.backButtonClick, parent=self.UIBackground, scale=(-0.4, 1, 0.25), pos=(-0.3, 0, -0.35)) self.backButton.hide() #Call the Cog class to establish the Actor self.cog = Cog() #Change the current UI screen self.screenDirector() def headLeftClick(self): #switch to the previous head self.cog.previousHead() def headRightClick(self): #switch to the next head self.cog.nextHead() def bodyLeftClick(self): #switch to the previous body self.cog.previousBody() def bodyRightClick(self): #switch to the next body self.cog.nextBody() def deptLeftClick(self): #switch to the previous department self.cog.previousDept() def deptRightClick(self): #switch to the next department self.cog.nextDept() def enterName(self, text): #Assign the entry text to name, then switch to the next screen self.name = text self.currentScreen = 3 #Change the current UI screen self.screenDirector() def setEntryFocus(self): #Determine if to focus or unfocus the DirectEntry depending if the screen is visible if self.currentScreen == 2: self.nameEntry['focus'] = True else: self.nameEntry['focus'] = False self.entryUnfocused() self.nameEntry.setFocus() def entryUnfocused(self): #Set whatever is currently in the box to the name variable self.name = self.nameEntry.get() def nextButtonClick(self): #Add 1 to the currentScreen, then switch to the new screen self.currentScreen += 1 #Constrain current screen to always be less than 3 if self.currentScreen > 3: self.currentScreen = 3 return #Set the focus of the text entry box self.setEntryFocus() #Change the current UI screen self.screenDirector() def backButtonClick(self): #Subtract 1 from the currentScreen, then switch to the new screen self.currentScreen -= 1 #Constrain current screen to always be greater than 0 if self.currentScreen < 0: self.currentScreen = 0 return #Set the focus of the text entry box self.setEntryFocus() #Change the current UI screen self.screenDirector() def screenDirector(self): #Determine which screen to shift to if self.currentScreen == 0: self.welcomeScreen() elif self.currentScreen == 1: self.cogDesignScreen() elif self.currentScreen == 2: self.namingScreen() elif self.currentScreen == 3: self.finishedScreen() else: raise Exception('UH OH! currentScreen is not between 0 and 3! \ The value of currentScreen is {}'.format(self.currentScreen)) def welcomeScreen(self): #Show/hide respective GUI elements self.instructionText.setText('Salutations, new Cog. \ Click the button below to continue.') self.backButton.hide() self.headSelector.hide() self.bodySelector.hide() self.deptSelector.hide() #Determine whether the cog should exit the scene if its in view already if (self.cog.isInView): self.cog.exitScene() def cogDesignScreen(self): #Show/hide respective GUI elements self.instructionText.setText('Select a design.') self.backButton.show() self.headSelector.show() self.bodySelector.show() self.deptSelector.show() self.nameEntryBackground.hide() #Determine whether the cog should reenter the scene if its in view already if (not self.cog.isInView): self.cog.enterScene() def namingScreen(self): #Show/hide respective GUI elements self.instructionText.setText('Type in a name.') self.nextButton.show() self.headSelector.hide() self.bodySelector.hide() self.deptSelector.hide() self.nameEntryBackground.show() #See if the cog is playing the victory animation and change to keep the animation smooth if self.cog.getAnimPlaying() == 'victory': self.cog.playNeutral() def finishedScreen(self): #Show/hide respective GUI elements self.instructionText.setText('Welcome to COGS, Inc., ' + self.name + '.\ If you wish to make changes, click the back button.') self.nextButton.hide() self.nameEntryBackground.hide() #Have the cog dance self.cog.playVictory()