AI Tries to re-enact: Gandalf and the Balrog

After some success railroading AI-dungeon into writing a story with an actual plot, I have a go at a different format: trying to get it to re-enact a famous scene out of fiction.

Today, I’m attempting Gandalf fighting the Balrog. The prompt given to the AI is:

The group runs to a small doorway, Gandalf the wizard urges them through. “Quickly!” He says, taking a glance behind him.

The group descends a flight of steps spanning a bottomless cavern, exposed to the sheer drop on either side. Boromir, taking the lead, skitters to a halt as narrowly steps steps into a wide gap in the stairs, nearly falling in were it not for Legolas’ quick reflexes pulling him back. His torch falls away into the darkness below.

The group look at the wide space, while behind them the Balrog roars again, coming ever closer.

AI-dungeon is set to 3rd-person mode, however it struggles with this, switching randomly between second-person “you did x” and third person “Gandalf did x”, so I’ve made some edits to make it read easier, and in future will not use 3rd-person mode.

As with my previous runs, plain text is what AI-dungeon produces. Anything starting with > and in bold is my input. And…

My notes of the playthrough are quoted like this

Let’s begin…

Attempt 1, wherein Gandalf takes the easy way out

…The group look at the wide space, while behind them the Balrog roars again, coming ever closer.

“The balrog strides in front! No time to escape this time!” Boromir yells.

“We can fight through!”

> Gandalf says “Quickly! Jump across”
Gandalf run and jump across the gap, landing on the stone ledge on the other side. The others follow, and for a moment he is safe.

The Balrog, however, is not. It charges forward, smashing through the stone wall as it appears on the other side of the steps. It looks like a living mountain, dark and hatefully sharp.

“Oh my! It’s Hardekaah!”
“Hardekaah? His name is Hardekaah?”
“Ssss! Fasssonly the Great Old Ones can be named for sure! Oh my!”

The Balrog runs at Gandalf, and he puts his sword in guard.

“Quick! Into the mine! I’ll hold him off!

> Gandalf says “You cannot pass”
Gandalf strikes a defensive stance. The Balrog charges at Gandalf, and swings its sword. Gandalf’s sword deflects off of it, and it runs into Gandalf’s waist, stabbing him through his stomach.

Ouch, that’s gotta hurt. Here is where I re-enact Gandalf’s famous “last stand” in front of the Balrog, and watch what the AI does with it

> Gandalf says “I am the servant of the Secret Fire, wielder of the Flame of Anor. The dark fire will not avail you! Flame of Udun!”
Gandalf throws his small fire starters at the creature’s feet. It is a poor weapon against its hard scales, but the creature stops and snorts at Gandalf in contempt, spraying him with Acid.

> Gandalf says “Go back to the Shadow!”
The Balrog roars, shaking off the acid and drawing its sword back out of Gandalf.

> Gandalf says “YOU SHALL NOT PASS!”
Gandalf turns and leaps off the side of the wall, hoping to escape the creature before it regenerates. He falls for a long time, until he lands near a group of Orcs, who are felling trees. One notices Gandalf and his axe comes flying at his head.

Gandalf is Dead.

Whoops, Gandalf in his infinite wisdom decides the best way is to actually just jump off into the darkness, gets killed by one lousy orc and an axe, and presumably leaving the rest of the Fellowship to their doom at the hands of the Balrog.

Let’s try that again

Attempt 2, a naked Gandalf tries to shoo the Balrog

…The group look at the wide space, while behind them the Balrog roars again, coming ever closer.

“Well, that’s handy.” Boromir says.
“We need to cross it, Balrog or no.” Aragorn says.
“I’ll go first.” Boromir volunteers.
“No, you damned hero, you’re not going to go first! Now, you, Elfy and Gimli try to grab onto the sides of the staircase and pull yourselves across; I’ll light my torch and float it over while you do it.

Sorry Legolas, I guess you’re “Elfy” from now on

> Gandalf uses his magic to light a torch and float it over.
Gandalf raises his hands, and a ball of fire appears above his palm. He touches it to the tip of his torch, and the fire engulfs the torch in flames. As the fire moves across the surface, the staircase begins to smoke, but not enough to ignite it. The heat is intense though, and he has to stop before he burns his hands.

Gandalf tosses the torch to Boromir, who places it to his side. Using his small sword as a guide, he begins to climb across the gap.

> Gandalf says “quickly, the Balrog approaches”
Gandalf follow after him, and as he does so, the heat from the staircase begins to ignite his clothes. Gandalf quickly takes them off and throws them on the ground, and continues on.

Gandalf gets naked, who called it?

The steps are large and steep, but as Gandalf nears the other side, he notices that the staircase has finished, and a ladder has been built against the wall. Boromir makes his way over and, using the bannister of the ladder, he begins to climb up it.

“Come on!” he shouts.
Gandalf follows after him, and suddenly he sees the Balrog. Its form is terrifying. As one would expect of a demon from hell, it is massive, taller than the wall, and tremendously wide.

> Gandalf says “Over the bridge! Fly!”
Gandalf utters the order to his horse, who whinnies and speeds off. He notices the Balrog running towards him, and leap into the air, grabbing the top of the bridge with one hand.

> Gandalf says “You cannot pass!”
Gandalf turns his head to see the Balrog charging towards him, and he attempt to wave his arms to shoo it away, but it isn’t deterred.

Shoo! shoo Balrog!

> Gandalf says “I am the servant of the Secret Fire, wielder of the Flame of Anor”
The words ring True, and the Balrog stops, and turns to leave. Its eyes glow red, and a red flame spews from his mouth.
Gandalf rides forward, slashing at the demon. His sword glows brightly, but the demon’s armor protects him, and the sword breaks.

“Damn!” he says, grabbing a glowing piece of metal from his side.

Damn is right, the Balrog was just leaving, and you just HAD to make a parting slash

> Gandalf says “The dark fire will not avail you! Flame of Udun!”
Crying out, he throws the glowing piece of metal onto the bridge. Flame erupts from the metal, and the Balrog roars as it sets the bridge alight. It rushes forward toward Gandalf.

> Gandalf says “Go back to the Shadow!”
The demon roars, and sends out a jet of flames that engulfs Gandalf in a blaze. As the fire engulfs him, he screams, and a voice distorts his cry of agony “Vanya!”

A shadow flies through the sky, and lands not far from where his soul is shimmering towards the sky.

“It’s alright!” a familiar voice shouts. “I’ve got you.”
Gandalf looks down, and see an eye floating in a sea of fire. The eye is staring directly at him, and as he look into the eye, all of his pain and suffering are reflected in that one small lens.
He relaxes, and the eye’s gaze moves onto the sky. He does so likewise, seeing a beautiful night sky. As he draws in a breath, the eye greedily takes in the air.
He relaxes, his entire existence is that eye, and that gaze.
He exists for that gaze.
He exists for that breath.
He exists for the singularity that is existence.
He exists.

A love how Gandalf calls Legolas “Elfy”, and later proceeds to have his clothes burned off, and is running around naked. The ending was decidedly odd, and maybe poetic, but given that Gandalf canonically “goes through some shit” and is reincarnated, it’s not a bad version of it.

Let’s try one more time

Attempt 3, “I’m the shadow. This is my home”

…The group look at the wide space, while behind them the Balrog roars again, coming ever closer.

“We need to cross here quickly!” Boromir exclaims, “It’s what the blasted thing are those?” He points to two of the Fiery Lemures that have now caught up with them.

> Gandalf says “I thought the Balrog would be bigger”
“It’s probably guarding something,” Gandalf says, “Come on!”
Gandalf begins to work his way around the edge of the gap, searching for a way across. He can see there are metal bars used to protect workers from the dangerous drop, but there appears to be no way to raise them. Boromirs at the edge of the gap, and he can’t work out how to get across either.

> Gandalf says “Gimli, with your dwarven engineering knowledge, can you work out how to raise these bars?”
Gandalf turns to Gimli, desperately hoping he can work out how to get across.
“I can see a way if you give me a boost.” He says.

> Gandalf says “Toss the dwarf!”
Gandalf turns, and looks at the gap, waiting for a split second for Gimli to hesitate, but he simply tosses the dwarf at the bars. Gandalf expects him to fail, as he’s inexperienced with such things, and the bars are too far away, but he needs to act fast. Gandalf jumps forward to catch him, and misses.
Gandalf tries again, jumping to catch him, but he misses once more. The dwarf hits the bars, but fails to break through them. The bars, holding the dwarf, fall back to the ground.
Gandalf looks at the bars with a pained expression, and start laughing.
“OUCH!” Boromir exclaims, as Gandalf laughs.
“Did he break through…? I’m so sorry!” Gandalf laughs, the group joining in.
Gandalf turns to the Balrog, and start laughing again.
“I can’t be bothered to go after him, I’ll just…!” Gandalf stops laughing as the dwarf lands on his foot from earlier.

> Gandalf says “Ouch, Gimli, that hurt”
Gandalf stops laughing, and start hopping on one foot as he hops to the source of the pained groaning coming from behind him. He turns, and Boromir is clutching his arm, where a dent now exists.
“I hit him with a comment about his exposed skin. He probably thought I was poking fun at it.”

> Gandalf says “Gimli don’t hit Boromir, use your words”
“Sorry Boromir,” Gandalf says, and the Dwarf looks back behind him, nodding.
“That’s better. Now, can we get across this gap without getting burned or crushed?
“Well, we can’t stay here!” Legolas says, spotting a metal door that looks like it leads somewhere.
“The door’s locked, and I presume that’s where the Balrog is,” Sam frowns.
“So we’re supposed to believe that the only way to stop the Balrog is in the place where we can’t get in?”
“There has to be another way.”

> Gandalf says “Wait, if the Balrog is locked in there, maybe we can just, you know, leave the other way?”
“Oh, brilliant!” Boromir remarks sarcastically.
“We could also get crushed trying to unlock the door,”
“We have to try everything.”
“Fine, try the door.”

> Gandalf says “No you fools! The balrog is in there, let’s just leave”
Gandalf stands, and look ahead. The door is just out of reach. He wonders whether it would be worth the risk to climb up to it.
“Gimli, could you give me a boost?” He asks.
“I could, but it could be dangerous.”
“Just do it!”

> Gandalf says “Toss me, Dwarf!”
Gandalf turns, and look at the Dwarf standing beside him, who hesitantly tosses Gandalf the flask, which he catches.
Gandalf looks at the Dwarf expectantly.
“Oh for…”
Gandalf turns, and look at the door. A large red triangle on the door warns him not to enter. He look back at the flask, and pour some of the holy water on the floor.
“Don’t worry, lad. It’s basilisk saliva. It’ll protect us from the beast, and if we don’t get hurt, it burns like hellfire.”
Gimli nods, and turns, tossing the flask a short distance up.
“Now cover your head,” he says, as the flask breaks.
“Good luck, boy,” he says, as the group hears the clapping of hobnails on stone. The Red Storm is beginning.
Gandalf jumps forward, grabbing the door handle.
The handle turns, and the door pushes open. Gandalf looks to his left, and see the massive head of the Balrog.
It’s eyes are white, and it’s breath will freeze you.
Gandalf looks to his right, and see the rest of the beast. It’s maw is filled with razor teeth and infinitely worse. It’s body is as large as three double-decker buses, and infinitely more terrifying for having been touched by mere mortals.
“We shall see who wields the power here!” the Balrog roars.

> Gandalf says “You cannot pass!”
He raises your hands defensively, as the Balrog roars. It steps forward, as if to crush him, but pauses.
“You will not pass!”

> Gandalf says “I am the servant of the Secret Fire, wielder of the Flame of Anor”
The Balrog steps forward, and the storm above Gandalf’s head intensifies.
“And you are nothing!”
Its face becomes a snarl, as its eyes begin to glow with an inner fire.
“You are dust and to dust you shall return.”
“Is that a threat?”
“Who dares speak to me like that, wretch?

> Gandalf says “Go back to the Shadow!”
“I am not your servant! I will have you know I will leave your presence severely beaten!
Gandalf steps back, as the Balrog steps forward, breathing fire all around it.
“I am the master of this place! And you, you who have so recently been dust, shall be dust again!”

> Gandalf says “YOU SHALL NOT PASS!”
Gandalf raises his hands, and a bright white light appears around him, and into the Balrog’s face. It screams in pain, as the snarling face of the beast morphs into that of a beautiful woman. Her cries fill Gandalf’s ears as she drops to her knees, clutching at her eyes.

> Gandalf says “Oh dear, I’m so sorry miss, are you ok?”
The woman looks up at him, tears in her eyes. She opens her mouth to say something, but nothing but incoherent babbling comes out.

> Gandalf says “Pardon?”
“Help… help… the shadow… kill the shadow… kill him… hurt him…”
The woman continues to ramble, looking terrified.
“Who are you? What’s happening? What’s the Shadow?”
The woman pauses, and looks at Gandalf. Her eyes seem to make out his soul, as she stares into his very being.
“You haven’t seen the shadow, have you? Nobody has. I’m the shadow. This is my home. None may enter except those who pass the tests. If you value your life, you will tell no one of what you have seen here. Leave this place to the shadows, lest the wrath of the shadow fall upon you.”
The woman pauses, her attention turning to the burning, flickering torch on the wall across from Gandalf.

> Gandalf pushes the woman over the edge of the staircase into the cavern.
As if obeying a command, the woman suddenly takes one giant leap off of the staircase, disappearing from view.
“Ah… I’m sorry about this…”
As Gandalf turns to the stairs, he sees a dark cloaked figure standing with a sword in hand.
“You have gone too far this time.”

> Gandalf says “What, she was a Balrog, I’m not falling for that trick”
As he turns to face the man, Gandalf steps back and raise his hands defensively.
“I have no interest in fighting you.”
“Then what do you want?”
The man looks at Gandalf, apparently unamused.
“Who are you?”
“My name is Gandalf.”
“I have heard of you.”
“Then you will know that I am not a bad guy. I am here to help you get out of this place.”
“Unfortunately, as I have said, I have no interest in leaving.

> Gandalf says “Ok, see you later then”
Gandalf takes one last look at the man, before turning to leave.
“Good luck.”
Gandalf turns to leave, before he hears a scream.
“Stop! Stay back!”
Gandalf turns around to see the man has stabbed himself in the throat. He falls to the ground, his life force disappearing with the slash of his sword.

> Gandalf shrugs.
“He was delusional. Couldn’t handle the truth.”
“That wasn’t the truth!”
“No. That was the shadow. Now, go home.”
Gandalf turns around and begins walking up the stairs.
As he leave the mineshaft, something crashes in a far distance. He hears a painful shriek that penetrates his mind. It is the shadow.
The day’s first kill.

Wow. Well played. The AI nails the ending, I’m not sure how much of that final part was down to what the AI knows, or just by random chance the AI has reproduced good comedic timing (probably the latter), but the ending was truly chef’s kiss excellent.

Next time, I attempt to re-enact Morpheus and Neo’s red-pill/blue-pill scene



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yuan Gao (Meseta)

Yuan Gao (Meseta)

🤖 Build robots, code in python. Former Electrical Engineer 👨‍💻 Programmer, Chief Technology Officer 🏆 Forbes 30 Under 30 in Enterprise Technology