def enter(self, story_tag, action_tag): "displays the victory message for the text adventure game Into the Dalek" # Description of room scene story_tag.delete(1.0, END) Victory_story = """You tumble out of the Dalek... ...and find yourself back in the control room of the 'Aristotle.' The Doctor stares intensely at the 'good' Dalek. You can tell - He is disturbed... The Dalek only saw darkness inside him. You try to reassure him that it all worked out anyways. 'But it would have been nice if we could have made a good Dalek...' The good Dalek sends a signal to his mothership. He tells the rest of the Dalek force: 'The 'Aristotle' has been destroyed.' The rebels can now operate completely under the Dalek radar. You leave them with a new soldier -- the good Dalek. You hop on the Tardis and turn the key. A new adventure awaits... """ story_tag.insert(1.0, Victory_story) # game over message in the action screen clear_window(action_tag) game_over = "GAME OVER. YOU WIN. PLEASE PLAY AGAIN." over_lab = Label(action_tag, text=game_over) over_lab.config(bg='orange', fg='navy') over_lab.pack(side=TOP, fill=X, pady=5)
def enter(self, story_tag, action_tag): "starts the Consciousness Link scene of the game Into the Dalek" clear_window(action_tag) # Description of room scene story_tag.delete(1.0, END) ConsciousnessLink_story = """You find yourself inside a giant dome. Images, moving pictures, are all around you. Most are horrific images of war, carnage, violence. The Doctor explains that these are the Dalek's memories. He urges you to look away. They will only destroy your soul. But you see one memory that is shockingly beautiful... You move in closer.... The Doctor explains that you're watching the creation of a star. This could be it. This could be the memory you're looking for... 'I need to form a link to the Dalek brain...', the Doctor explains. 'I need him to think he is seeing this again for the first time.' The Doctor has an idea. 'Quick. Tell us a joke. If we both laugh...' '...I may be able to sync up with his brain.'""" story_tag.insert(1.0, ConsciousnessLink_story) # You must link the Doctor's brain with the Dalek's return self.tell_joke(story_tag, action_tag)
def crack_code(self, story_tag, action_tag): """You must crack a simple code to advance to the next part of the Dalek""" clear_window(action_tag) # create the game directions story_tag.delete(1.0, END) dirs = """There's a simple keypad lock on the Dalek's centeral vault. 'Good news!' The Doctor says. 'Only 3 digits... ...And the Daleks only know 1s and 0s. 'This should be fairly easy to crack...' 'But we only get 5 tries, before it shuts down for 24 hours.'""" story_tag.insert(1.0, dirs) # create the input box to enter a possible code and button to check answer code_info = Label(action_tag, bg='orange', fg='navy') code_info.pack(side=TOP, expand=YES, fill=X, pady=5) code_frm = Frame(action_tag, bg='orange') code_lbl = Label(code_frm, text='[KEYPAD=>]') code_lbl.config(bg='white', fg='navy') code_lbl.pack(side=LEFT, padx=120, pady=5) code_var = StringVar() code_ent = Entry(code_frm, textvariable=code_var) code_ent.config(bg='SkyBlue3', fg='white') code_ent.pack(side=LEFT, pady=5) code_frm.pack(side=TOP, expand=YES, fill=BOTH) code_but = Button(action_tag, text='ENTER CODE') code_but.config(command=(lambda: self.check_code(code_var.get(), code_info, story_tag, action_tag))) code_but.pack(side=TOP, fill=X)
def logic_quiz(self, story_tag, action_tag): "you must solve a simple logic puzzle to discover the good Dalek" # clear the action box clear_window(action_tag) # create the game directions logic_dirs = """The rebel officers step aside. Two Daleks are wheeled into the center of the room. One is the 'good' Dalek. The other is evil. The officers will let you choose one Dalek... But upon doing so you must release it from its chains. You can ask one Dalek one question. You assume, as is the case with all Daleks... ...that the real Dalek will only lie. The good Dalek must only tell the truth. What question do you ask?""" story_tag.delete(1.0, END) story_tag.insert(1.0, logic_dirs) # create the input box to answer question logic_var = StringVar() logic_ent = Entry(action_tag, textvariable=logic_var) logic_ent.config(bg='orange', fg='navy') logic_ent.pack(side=TOP, fill=X) # create the button to check the answer logic_but = Button(action_tag, text='ASK') logic_but.config(command=( lambda: self.check_answer(logic_var.get(), story_tag, action_tag))) logic_but.pack(side=TOP, fill=X)
def crack_code(self, story_tag, action_tag): """You must crack a simple code to advance to the next part of the Dalek""" clear_window(action_tag) # create the game directions story_tag.delete(1.0, END) dirs = """There's a simple keypad lock on the Dalek's centeral vault. 'Good news!' The Doctor says. 'Only 3 digits... ...And the Daleks only know 1s and 0s. 'This should be fairly easy to crack...' 'But we only get 5 tries, before it shuts down for 24 hours.'""" story_tag.insert(1.0, dirs) # create the input box to enter a possible code and button to check answer code_info = Label(action_tag, bg='orange', fg='navy') code_info.pack(side=TOP, expand=YES, fill=X, pady=5) code_frm = Frame(action_tag, bg='orange') code_lbl = Label(code_frm, text='[KEYPAD=>]') code_lbl.config(bg='white', fg='navy') code_lbl.pack(side=LEFT, padx=120, pady=5) code_var = StringVar() code_ent = Entry(code_frm, textvariable=code_var) code_ent.config(bg='SkyBlue3', fg='white') code_ent.pack(side=LEFT, pady=5) code_frm.pack(side=TOP, expand=YES, fill=BOTH) code_but = Button(action_tag, text='ENTER CODE') code_but.config(command=(lambda: self.check_code( code_var.get(), code_info, story_tag, action_tag))) code_but.pack(side=TOP, fill=X)
def logic_quiz(self, story_tag, action_tag): "you must solve a simple logic puzzle to discover the good Dalek" # clear the action box clear_window(action_tag) # create the game directions logic_dirs = """The rebel officers step aside. Two Daleks are wheeled into the center of the room. One is the 'good' Dalek. The other is evil. The officers will let you choose one Dalek... But upon doing so you must release it from its chains. You can ask one Dalek one question. You assume, as is the case with all Daleks... ...that the real Dalek will only lie. The good Dalek must only tell the truth. What question do you ask?""" story_tag.delete(1.0, END) story_tag.insert(1.0, logic_dirs) # create the input box to answer question logic_var = StringVar() logic_ent = Entry(action_tag, textvariable=logic_var) logic_ent.config(bg='orange', fg='navy') logic_ent.pack(side=TOP, fill=X) # create the button to check the answer logic_but = Button(action_tag, text='ASK') logic_but.config(command=(lambda: self.check_answer(logic_var.get(), story_tag, action_tag))) logic_but.pack(side=TOP, fill=X)
def check_code(self, guess, info_tag, story_tag, action_tag): "checks the entered code" # count the guesses self.count += 1 self.guessed_codes.append(guess) print(self.code) # if guess == code: if guess == self.code: # clears action box clear_window(action_tag) # creates next button next_win_but = Button(action_tag, text="NEXT") next_win_but.config(command=( lambda: self.move_on(next_var, story_tag, action_tag))) next_win_but.pack(side=TOP, fill=X) # display win state story_tag.delete(1.0, END) win_text = """POP! The Dalek vault opens. Journey Blue steps forward and sticks her hand inside. 'Wrong move,' says the Doctor. You watch as the Dalek unleashes an attack force... It is a squadron of super-fast autonomic antibodies. They attack what is giving them pain... They surround Journey Blue and they EXTERMINATE. The Doctor shouts, 'We have to find somewhere unguareded! Run!'""" story_tag.insert(1.0, win_text) # proceed to the next room next_var = 'waste_center' return next_var # if there are 5 strikes: elif self.count == 5: # clears action box clear_window(action_tag) # creates next button next_loss_but = Button(action_tag, text="NEXT") next_loss_but.config(command=( lambda: self.move_on(next_var, story_tag, action_tag))) next_loss_but.pack(side=TOP, fill=X) # display loss state story_tag.delete(1.0, END) loss_text = """Oh no. The Dalek vault shuts down.... Journey Blue gets out her grapple hook and shoots it. 'Wrong move,' says the Doctor. You watch as the Dalek unleashes an attack force... It is a squadron of super-fast autonomic antibodies. They attack what is giving them pain... They surround you all and they EXTERMINATE.""" story_tag.insert(1.0, loss_text) # DIE next_var = 'death' return next_var # or ask for another entry else: miss_text = """BZZZZZZ. Incorrect. Try again. {} guess(es) remaining. You've tried the codes: {}""".format((5 - self.count), self.guessed_codes) info_tag.config(text=miss_text)
def check_code(self, guess, info_tag, story_tag, action_tag): "checks the entered code" # count the guesses self.count += 1 self.guessed_codes.append(guess) print(self.code) # if guess == code: if guess == self.code: # clears action box clear_window(action_tag) # creates next button next_win_but = Button(action_tag, text="NEXT") next_win_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_win_but.pack(side=TOP, fill=X) # display win state story_tag.delete(1.0, END) win_text = """POP! The Dalek vault opens. Journey Blue steps forward and sticks her hand inside. 'Wrong move,' says the Doctor. You watch as the Dalek unleashes an attack force... It is a squadron of super-fast autonomic antibodies. They attack what is giving them pain... They surround Journey Blue and they EXTERMINATE. The Doctor shouts, 'We have to find somewhere unguareded! Run!'""" story_tag.insert(1.0, win_text) # proceed to the next room next_var = 'waste_center' return next_var # if there are 5 strikes: elif self.count == 5: # clears action box clear_window(action_tag) # creates next button next_loss_but = Button(action_tag, text="NEXT") next_loss_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_loss_but.pack(side=TOP, fill=X) # display loss state story_tag.delete(1.0, END) loss_text = """Oh no. The Dalek vault shuts down.... Journey Blue gets out her grapple hook and shoots it. 'Wrong move,' says the Doctor. You watch as the Dalek unleashes an attack force... It is a squadron of super-fast autonomic antibodies. They attack what is giving them pain... They surround you all and they EXTERMINATE.""" story_tag.insert(1.0, loss_text) # DIE next_var = 'death' return next_var # or ask for another entry else: miss_text = """BZZZZZZ. Incorrect. Try again. {} guess(es) remaining. You've tried the codes: {}""".format((5 - self.count), self.guessed_codes) info_tag.config(text=miss_text)
def chooseToHelp(self, action, story_tag, action_tag): "gives you a choice to act" clear_window(action_tag) if action == "No": no_text = "You are shoved back in your Tardis and released into space." story_tag.delete(1.0, END) story_tag.insert(1.0, no_text) game_over(action_tag) else: return self.logic_quiz(story_tag, action_tag)
def check_throw(self, hand, story_tag, action_tag): "checks the results of a game of rock paper scissors" story_tag.delete(1.0, END) # wins if self.dr_hand == 'Paper' and hand == 'Scissors' or self.dr_hand == 'Scissors' and hand == 'Rock' or self.dr_hand == 'Rock' and hand == 'Paper': rps_win = """{}, {}: You win! No garbage for you. Unfortunately, that means the second you walk out the door... ... you are attacked and killed.""".format(hand, self.dr_hand) story_tag.insert(1.0, rps_win) clear_window(action_tag) # DIE next_var = 'death' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=( lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # lose elif self.dr_hand == 'Rock' and hand == 'Scissors' or self.dr_hand == 'Paper' and hand == 'Rock' or self.dr_hand == 'Scissors' and hand == 'Paper': rps_loss = """{}, {}: You lose! You take a deep breath.... ...And cover yourself in garbage. You step outside. It works! The Dalek ignores you. Now... You must follow the source of the radiation... ...and stop the leak in order to complete your quest. You make a run for the Power Center.""".format(hand, self.dr_hand) story_tag.insert(1.0, rps_loss) clear_window(action_tag) # proceed to the next room, the Power Center next_var = 'power_center' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=( lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # draw elif self.dr_hand == 'Rock' and hand == 'Rock' or self.dr_hand == 'Paper' and hand == 'Paper' or self.dr_hand == 'Scissors' and hand == 'Scissors': rps_tie = """{}, {}: It's a draw. Go again.""".format(hand, self.dr_hand) self.dr_hand = self.moves[randint(0, 2)] story_tag.insert(1.0, rps_tie)
def enter(self, story_tag, action_tag): # clears the screen story_tag.delete(1.0, END) clear_window(action_tag) # chooses a death quip at random from the above list of quips death_quip = Death.quips[randint(0, len(self.quips) - 1)] story_tag.insert(1.0, death_quip) # tells us the game is over game_over = "Extermination Successful. GAME OVER. The human race is dead." death_lab = Label(action_tag, text=game_over) death_lab.config(bg='orange', fg='navy') death_lab.pack(side=TOP, fill=X, pady=5)
def enter(self, story_tag, action_tag): # clears the screen story_tag.delete(1.0, END) clear_window(action_tag) # chooses a death quip at random from the above list of quips death_quip = Death.quips[randint(0, len(self.quips)-1)] story_tag.insert(1.0, death_quip) # tells us the game is over game_over = "Extermination Successful. GAME OVER. The human race is dead." death_lab = Label(action_tag, text=game_over) death_lab.config(bg='orange', fg='navy') death_lab.pack(side=TOP, fill=X, pady=5)
def check_throw(self, hand, story_tag, action_tag): "checks the results of a game of rock paper scissors" story_tag.delete(1.0, END) # wins if self.dr_hand == 'Paper' and hand == 'Scissors' or self.dr_hand == 'Scissors' and hand == 'Rock' or self.dr_hand == 'Rock' and hand == 'Paper': rps_win = """{}, {}: You win! No garbage for you. Unfortunately, that means the second you walk out the door... ... you are attacked and killed.""".format(hand, self.dr_hand) story_tag.insert(1.0, rps_win) clear_window(action_tag) # DIE next_var = 'death' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # lose elif self.dr_hand == 'Rock' and hand == 'Scissors' or self.dr_hand == 'Paper' and hand == 'Rock' or self.dr_hand == 'Scissors' and hand == 'Paper': rps_loss = """{}, {}: You lose! You take a deep breath.... ...And cover yourself in garbage. You step outside. It works! The Dalek ignores you. Now... You must follow the source of the radiation... ...and stop the leak in order to complete your quest. You make a run for the Power Center.""".format(hand, self.dr_hand) story_tag.insert(1.0, rps_loss) clear_window(action_tag) # proceed to the next room, the Power Center next_var = 'power_center' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # draw elif self.dr_hand == 'Rock' and hand == 'Rock' or self.dr_hand == 'Paper' and hand == 'Paper' or self.dr_hand == 'Scissors' and hand == 'Scissors': rps_tie = """{}, {}: It's a draw. Go again.""".format(hand, self.dr_hand) self.dr_hand = self.moves[randint(0, 2)] story_tag.insert(1.0, rps_tie)
def enter(self, story_tag, action_tag): "starts the scene inside the power center" # Description of room scene clear_window(action_tag) story_tag.delete(1.0, END) PowerCenter_story = """You find yourself inside what looks to be the guts of a central computer. Wires, links and gauges are everywhere. The Doctor swings his sonic screwdriver around... 'There!' He shouts, pointing to a large ray of light. The radiation leak!' You must plug the leak so you can continue your quest. The Doctor hands you his sonic screwdriver. 'You shoot while I twist the right wires!' he orders.""" story_tag.insert(1.0, PowerCenter_story) # You must use the sonic screwdriver to stop the radiation leak return self.seal_crack(story_tag, action_tag)
def check_power(self, your_power, story_tag, action_tag): "checks to see if you have loaded the gun with enough power" # you seal the crack story_tag.delete(1.0, END) if len(your_power) >= 10: clear_window(action_tag) zap_win = """Everything goes quiet. You look to the Doctor. 'It worked,' he says. 'It is sealed.' ...However, you know... something is very, very wrong... By stopping the leak, you 'fixed' the Dalek. He reverts to his old evil ways and contacts the main Dalek ship. You only have a few moments before a large scale Dalek attack hits... 'Quick!' The Doctor yells. 'We must find his consciousness!' '...we must discover what made him believe he was GOOD...'""" story_tag.insert(1.0, zap_win) # progress to the next room, the Consciousness link next_var = 'consciousness_link' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=( lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # you don't seal the crack in time elif len(your_power) > 5 and len(your_power) < 10: clear_window(action_tag) zap_loss = """It's not enough! You need more power! You must try again! ...But you're too weak! You can't press the button! You feel yourself fading away...""" story_tag.insert(1.0, zap_loss) # DIE next_var = 'death' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=( lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var else: story_tag.delete(1.0, END) zap_again = "It's not enough! Try again! Press 's' to load and fire!" story_tag.insert(1.0, zap_again)
def check_power(self, your_power, story_tag, action_tag): "checks to see if you have loaded the gun with enough power" # you seal the crack story_tag.delete(1.0, END) if len(your_power) >= 10: clear_window(action_tag) zap_win = """Everything goes quiet. You look to the Doctor. 'It worked,' he says. 'It is sealed.' ...However, you know... something is very, very wrong... By stopping the leak, you 'fixed' the Dalek. He reverts to his old evil ways and contacts the main Dalek ship. You only have a few moments before a large scale Dalek attack hits... 'Quick!' The Doctor yells. 'We must find his consciousness!' '...we must discover what made him believe he was GOOD...'""" story_tag.insert(1.0, zap_win) # progress to the next room, the Consciousness link next_var = 'consciousness_link' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # you don't seal the crack in time elif len(your_power) > 5 and len(your_power) < 10: clear_window(action_tag) zap_loss = """It's not enough! You need more power! You must try again! ...But you're too weak! You can't press the button! You feel yourself fading away...""" story_tag.insert(1.0, zap_loss) # DIE next_var = 'death' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var else: story_tag.delete(1.0, END) zap_again = "It's not enough! Try again! Press 's' to load and fire!" story_tag.insert(1.0, zap_again)
def check_answer(self, answer, story_tag, action_tag): "checks the answer given to the logic question" # cleans and clears field answer.lower() story_tag.delete(1.0, END) clear_window(action_tag) # creates a next button next_but = Button( action_tag, text="NEXT", command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) # process answer if "other" in answer: # display win message solve_text = """You turn away from that Dalek and point to the other one. You tell the guards to release him. They unlock the chains. You all hold your breath... The Dalek does not kill you. It's a miracle. A good Dalek does exist. The Doctor asks, 'Do you have a shrink ray on board?' Journey Blue answers, 'Of course!' The Doctor explains his plan: you'll use the shrink ray. You will journey into the good Dalek's mind. You wait patiently while the shrink ray warms up... 5... 4... 3... 2... 1...""" story_tag.insert(1.0, solve_text) # proceed to the next room, the Cortex Vault next_var = 'cortex_vault' return next_var else: miss_text = """You tell the guards to release the Dalek. They unlock the chains. You all hold your breath... The Dalek opens fire...""" story_tag.insert(1.0, miss_text) # play Death scene next_var = 'death' return next_var
def check_answer(self, answer, story_tag, action_tag): "checks the answer given to the logic question" # cleans and clears field answer.lower() story_tag.delete(1.0, END) clear_window(action_tag) # creates a next button next_but = Button(action_tag, text="NEXT", command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) # process answer if "other" in answer: # display win message solve_text = """You turn away from that Dalek and point to the other one. You tell the guards to release him. They unlock the chains. You all hold your breath... The Dalek does not kill you. It's a miracle. A good Dalek does exist. The Doctor asks, 'Do you have a shrink ray on board?' Journey Blue answers, 'Of course!' The Doctor explains his plan: you'll use the shrink ray. You will journey into the good Dalek's mind. You wait patiently while the shrink ray warms up... 5... 4... 3... 2... 1...""" story_tag.insert(1.0, solve_text) # proceed to the next room, the Cortex Vault next_var = 'cortex_vault' return next_var else: miss_text = """You tell the guards to release the Dalek. They unlock the chains. You all hold your breath... The Dalek opens fire...""" story_tag.insert(1.0, miss_text) # play Death scene next_var = 'death' return next_var
def enter(self, story_tag, action_tag): "starts the scene inside the waste center" clear_window(action_tag) # Description of room scene story_tag.delete(1.0, END) WasteCenter_story = """The waste center looks like the inside of a giant garbage dumpster. While you clean off your shoes, the Doctor whips out his sonic screwdriver. He takes some atmospheric readings. He confirms -- this area is unguarded. But something very nearby is emitting a very high degree of radiation. You cannot stay inside this area for long... You must leave. You must find the source of radiation. But how can you camouflage yourself? The Doctor suggests you rub just enough garbage on yourself... "...to cover the smell." Yuck. You don't want to. The Doctor suggests you solve the impasse with a game of RPS. Rock Paper Scissors? He can't be serious. He is.""" story_tag.insert(1.0, WasteCenter_story) # starts a game of Rock Paper Scissors return self.rps(story_tag, action_tag)
def start_game(self, story_tag, action_tag): "calls the first scene of the game" clear_window(action_tag) at = Aristotle() at.enter(story_tag, action_tag)
def result_joke(self, joke, story_tag, action_tag): "checks the results of the joke told" clear_window(action_tag) story_tag.delete(1.0, END) # Dalek laughs, Doctor doens't. Fail. if joke == 'a': joke_loss = """The Dalek starts to laugh. 'I know this one!' he says. 'An apple a day... Keeps the Doctor away!' 'HA HA HA HA HA!' You look at the Doctor. He isn't amused. The link fails. The Daleks attack!""" story_tag.insert(1.0, joke_loss) # DIE next_var = 'death' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # Doctor laughs, Dalek doesn't. Fail. elif joke == 'b': joke_loss2 = """'I know this one!' the Doctor says. 'EXFOLIATE!' The Doctor cracks up and smacks his knee. 'HA HA HA HA HA!' You look around the inside of the Dalek. You can both tell. He isn't amused. The link fails. The Daleks attack!""" story_tag.insert(1.0, joke_loss2) # DIE next_var = 'death' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var # Doctor and Dalek laugh. Link succeeds. elif joke == 'c': joke_win = """'To exterminate humanity!' The Doctor and the Dalek yell at the same time. 'HA HA HA HA HA!' The ship fills with laughter. Then something wonderful happens. All the images around you become the star being born. It's beautiful. Mesmerizing. You are transported. ...And so are the Doctor and the Dalek. The Dalek tears up. 'How could you destroy when creation is so wonderful?' he says. He is good again.""" story_tag.insert(1.0, joke_win) # win next_var = 'victory' # creates a next button next_but = Button(action_tag, text="NEXT") next_but.config(command=(lambda: self.move_on(next_var, story_tag, action_tag))) next_but.pack(side=TOP, fill=X) return next_var