Skip to content

Instantly share code, notes, and snippets.

@bolverk
Created June 29, 2022 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bolverk/80aedb3a241621d84c8d3d11753fb031 to your computer and use it in GitHub Desktop.
Save bolverk/80aedb3a241621d84c8d3d11753fb031 to your computer and use it in GitHub Desktop.
A demonstration of pdb's interact command with the Dormammu scene from Dr. Strange
from fake_typing import fake_typing
class Dormammu:
def __init__(self):
self.name = 'Dormammu'
self.counter = 0
def consider(self):
responses = [
'You’ve come to die. Your world is now my world, like all worlds.',
'You’ve come to die. Your world is now my world...What is this? Illusion?',
'You cannot do this forever.',
'End this!',
'You will never win.',
'STOP! MAKE THIS STOP!!!!'
'...what do you want?']
fake_typing(f'{self.name}: {responses[self.counter]}')
satisfied = self.counter==len(responses)-1
self.counter += 1
assert satisfied, f"Killed by {self.name}"
dormammu = Dormammu()
import sys
from time import sleep
sys.tracebacklimit = 0
def fake_typing(text):
for char in text:
sleep(0.1)
sys.stdout.write(char)
sys.stdout.flush()
print()
from fake_typing import fake_typing
class DrStrange:
def __init__(self):
pass
def bargain_with(self, opponent):
fake_typing(f'Dr Strange: {opponent.name}! I\'ve come to bargain!')
opponent.consider()
dr_strange = DrStrange()
from kamar_taj import dr_strange
from dark_dimension import dormammu
print('Scenario started\n')
dr_strange.bargain_with(dormammu)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment