Graph analysis of Lone Wolf (Choose you own Adventure)
Justin Pearson
Nov 8, 2007
I loved this book as a kid:
https://www.amazon.com/Flight-Dark-Lone-Wolf-Dever/dp/0425084361
It turns out the late author Joe Denver has generously permitted the text to be posted online at https://www.projectaon.org/en/xhtml-simple/lw/01fftd.htm .
Let’s revisit Lone Wolf.
Import and parse
The story itself is in a single ‘div’. The sections numbers are in ‘h3’ tags followed by ‘p’ tags for the text of the section.
Partition the list by when a “p” (paragraph) is followed by a “h3” (next section):
XMLElement[h3,{},{XMLElement[a,{shape→rect,name→sect1},{1}]}] |
XMLElement[p,{},{You must make haste for you sense it is not safe to linger by the smoking remains of the ruined monastery. The black-winged beasts could return at any moment. You must set out for the Sommlending capital of Holmgard and tell the King the terrible news of the massacre: that the whole élite of Kai warriors, save yourself, have been slaughtered. Without the Kai Lords to lead her armies, Sommerlund will be at the mercy of their ancient enemy, the Darklords.}] |
XMLElement[p,{},{Fighting back tears, you bid farewell to your dead kinsmen. Silently, you promise that their deaths will be avenged. You turn away from the ruins and carefully descend the steep track.}] |
XMLElement[p,{},{At the foot of the hill, the path splits into two directions, both leading into a large wood.}] |
XMLElement[p,{class→choice},{If you wish to use your Kai Discipline of Sixth Sense, ,XMLElement[a,{shape→rect,href→https://www.projectaon.org/en/xhtml-simple/lw/01fftd.htm#sect141},{turn to 141}],.}] |
XMLElement[p,{class→choice},{If you wish to take the right path into the wood, ,XMLElement[a,{shape→rect,href→https://www.projectaon.org/en/xhtml-simple/lw/01fftd.htm#sect85},{turn to 85}],.}] |
XMLElement[p,{class→choice},{If you wish to follow the left track, ,XMLElement[a,{shape→rect,href→https://www.projectaon.org/en/xhtml-simple/lw/01fftd.htm#sect275},{turn to 275}],.}] |
Section numbers
Section links
If an element in ‘links’ is {}, that means you’re dead, except for the last {}, which is where you win. Fix:
Section texts
https://mathematica.stackexchange.com/questions/14598/converting-xmlelement-objects-to-plain-text
Store data in a table
Verify
Check out all the ways you can die
sxn num | sxn links | sxn text |
53 | {DEAD} | 53 A searing pain tears through your right leg as it is twisted and crushed by the weight of your body. Down and down you tumble, until you finally land in a ditch at the base of the hill with such force that the wind is knocked out of you and you lose consciousness. You are awoken by the sharp pain of something stabbing your chest. It proves to be the tip of a Giak spear. You are greeted by the malicious sneer of its owner as he pins your left arm to the ground. Instinctively you reach for your weapon but it is no longer there. Defenceless against the cruel Giaks, the last thing that you see before all light fades is the jagged point of a Giak lance hurtling down towards your throat. Your mission ends here. |
54 | {DEAD} | 54 It would seem that the heavens have not heard your prayers. A spear whistles past your head and embeds itself in the neck of your galloping horse. With a shriek of pain, the horse topples forward and you both roll in a tangled heap on the highway. Dazed and pinned down by the weight of the dead body of your horse, the last thing you remember are the sharp penetrating spearheads of the Giak lances. You have failed in your mission. |
60 | {DEAD} | 60 The last thing you remember before darkness engulfs you is the flash of a long curved steel knife. You have become yet another victim of the Sage and his robber son—the very one who has just slit your throat! Your quest ends here. |
108 | {DEAD} | 108 You fly in an arc through the air towards the opposite roof. Everything seems to be happening in slow motion. You see the teeming crowds below in the street, and a nest of callysparrows in the eaves of a roof to your right. You hear their startled cries as you land with a crash on the other side. But it is the last sound that you will ever hear. The tiles splinter and collapse and you fall through the four floors of the ‘Green Slipper Inn’ breaking your back in several places. Your mission and your life end here. |
127 | {DEAD} | 127 After an hour of marching, the Drakkarim suddenly halt as a large, grey scaly creature approaches along the track. As the beast draws closer, you can smell its fetid breath on your face. It lets out a roar and grabs your head in its powerful webbed hands. The last thing you hear is the sharp crack of your spine snapping. Your quest ends here. |
154 | {DEAD} | 154 You are dizzy from your wound and you stumble through the trees like a blind man. Suddenly you fall forward as if the ground has been snatched from beneath your feet. You have fallen head-first into a hunting pit. As you look up, you can see four Drakkarim levelling their bows at you, evil sneers spreading simultaneously across their ugly faces. As the world darkens, the last things you feel are the black shafts of their arrows deep in your chest. You have failed in your mission. |
185 | {DEAD} | 185 You narrow your eyes and scan the trees for some sign of the hidden archer. Your wait is not a long one, for a moment later a sharp pain tears through your chest and you are thrown back by the force of three arrows. Two of the black shafts have sunk deep into your rib cage, and the third has pierced your thigh. The last thing that you see is the canopy of fern trees above and a large green dragonfly as it settles on your belt buckle. Your life and your mission end here. |
219 | {DEAD} | 219 All that remains of you now is embedded five feet into the stairs on which you were standing, beneath a vast granite block. Your mission and your life end here. |
234 | {DEAD} | 234 You jump clear of the speeding caravan but land very badly and break your ankle. The pain is terrible and you soon lose consciousness. Unfortunately you never wake up, but it may be of interest to you that your head is now adorning the saddle of a Kraan. Your life and your mission end here. |
259 | {DEAD} | 259 The room is getting colder. You gradually notice the smell of sulphur in the air. You can hear chanting in the distance. It sounds as if it is somewhere in another part of this cave. A slit in the stone wall opens, and the end of a black staff begins to appear. Suddenly a bolt of blue lightning leaps from the staff and hits you in the chest. As your life slowly drains away, the last thing you see is an old man dressed in black robes raising a dagger above your throat. Your life and your mission end here. |
271 | {DEAD} | 271 You feel very weak. The poison of the snake has entered your bloodstream and you can feel the muscles of your body involuntarily tightening and relaxing. Your legs suddenly collapse beneath you and you feel the slimy water of the marsh close over your head. Your life ends here. |
286 | {DEAD} | 286 Messengers of death—and ones eager to deliver their news—the Doomwolves surround and then attack you. Valiantly you fight, but it is to no avail for there are too many of them. As your life’s blood seeps away and eternal dark approaches, the last sight you remember is the glint of sunlight on the spires of Holmgard. You have failed in your mission. |
292 | {DEAD} | 292 The last thing that you experience of this life is the feeling of being sucked into the void of darkness. No trace of you remains in this world, for you have passed into a realm of timeless existence. You have become a slave of an ancient evil. Your adventure ends here. |
306 | {DEAD} | 306 The sound of battle gradually fades behind you. Suddenly, you are pulled to the ground. Three Drakkarim have dropped from a tree above. You struggle but it is useless for there are too many of them for you and they are very strong. The last thing that you hear is the vicious snarls of Drakkarim as they raise their spears. Your life and your mission end here. |
309 | {DEAD} | 309 You have taken less than ten paces when the raven squawks a warning to the stranger. Turning to face you, the robed creature utters a piercing screech that freezes your blood and grips your stomach with fear and panic. It is a Vordak, a lieutenant of the Darklords and one of the undead. Within seconds, a host of Giaks appear at its side and attack you. You fight bravely but you are greatly outnumbered. The last thing you remember is the icy grasp of the Vordak’s skeletal fingers as they close around your throat. Your life and your mission end here. |
327 | {DEAD} | 327 Within a few minutes, you can see the Kraan hovering over a hilltop behind you. At a quick count you can make out at least sixteen of these horrible creatures, each of which has at least two Giaks riding upon its back. They are armed with long spears and wear tall pointed helmets of dull bronze. You hear the excited grunts of the Giaks. They have spotted you. You jump for the entrance of the tunnel some twenty-five feet below, but your boot gets caught in a thorny briar and you hang helplessly upside down—weaponless and vulnerable. Fortunately for you the end is swift: As the first Giak lance pierces your heart, death is instantaneous. Your life and your mission end here. |
Graph of Lone Wolf
Note: Annoyingly, although LayeredGraphPlot seems to do the best job of showing a Graph hierarchically, it doesn’t support tooltips in the same way as Graph does.
See https://mathematica.stackexchange.com/questions/88356/why-does-layeredgraphplot-lose-labels-and-renumber-vertices
You should be able to hover the cursor over the squares to read their captions.
Shortest path to DEAD
1 You must make haste for you sense it is not safe to linger by the smoking remains of the ruined monastery. The black-winged beasts could return at any moment. You must set out for the Sommlending capital of Holmgard and tell the King the terrible news of the massacre: that the whole élite of Kai warriors, save yourself, have been slaughtered. Without the Kai Lords to lead her armies, Sommerlund will be at the mercy of their ancient enemy, the Darklords. Fighting back tears, you bid farewell to your dead kinsmen. Silently, you promise that their deaths will be avenged. You turn away from the ruins and carefully descend the steep track. At the foot of the hill, the path splits into two directions, both leading into a large wood. If you wish to use your Kai Discipline of Sixth Sense, turn to 141 . If you wish to take the right path into the wood, turn to 85 . If you wish to follow the left track, turn to 275 . |
275 You have followed this twisting track for about twenty minutes when you hear the beating of wings high above the trees. Looking up you see a large Kraan approaching from the north, its huge black wings casting a gigantic shadow on the trees below. On its back are two creatures armed with long spears. They are Mountain Giaks—small ugly creatures full of hatred and malice. Many centuries ago, their ancestors were used by the Darklords to build the infernal city of Helgedad, which lies in the volcanic wastelands beyond the Durncrag mountain range. The construction of the city was long and torturous, and only the strongest of the creatures survived the heat and poisonous atmosphere of Helgedad. Quickly you dive for the shelter of a large fern tree as the Kraan passes overhead. With heart pounding, you pray that your quick reactions have saved you from being spotted. Pick a number from the Random Number Table . If the number you have picked is 0–4, turn to 345 . If the number is 5–9, turn to 74 . |
74 The Kraan and its riders land on the track barely ten feet from where you are hidden. The Giaks leap from the scaly backs of the Kraan and move towards you, their spears raised to strike. You have been seen. If you decide to fight them, turn to 138 . If you decide to run deeper into the forest without delay, turn to 281 . |
281 As you race through the trees you can hear the horrible cackle of the Giaks close behind you. Soon the trees start to thin out and directly ahead you can see a rocky hillside. If you break cover and climb up the hill, turn to 311 . If you change direction and continue your run through the forest, turn to 77 . |
311 The hillside is steep and the earth is loose and slippery. You chance a swift glance over your shoulder and see the two Giaks emerge from the woods. They start to climb after you. About halfway from the peak of the hill, you spot a cave to your right, almost totally hidden by a landslide. If you have the Kai Discipline of Camouflage, turn to 324 . If you wish to hide in the cave, turn to 279 . If you wish to avoid the cave and continue your climb to the peak, turn to 47 . |
47 Breathless and sweating, you claw your way towards the summit of the hill. Suddenly, a large winged shadow passes across the hillside. You look up to see a Kraan circling the peak above. Behind you the Giaks are gaining ground. Do you stand and fight the Giaks where you are, using the high ground to your advantage? If so, turn to 136 . Or do you grit your teeth and press on towards the peak of the hill? Turn to 322 . |
322 After what seems an eternity of struggling, you reach the peak of the steep hill. Behind you, above the canopy of trees, you can see the still smouldering remains of the monastery. To the north, a column of jet-black smoke rises high into the sky. Small orange tongues of flame flicker at its base. Your heart sinks as you realize that the port of Toran is ablaze. Suddenly, a piercing cry above warns you that a Kraan is about to attack. It is about thirty yards away and diving for the kill. If you are going to stand and fight it as it swoops down, turn to 17 . If you are going to evade its attack and slide down the other side of the hill, away from the Kraan, turn to 89 . |
17 You raise your weapon to strike at the beast as its razor-fanged mouth snaps shut just inches from your head. Buffeted by the beating of its wings you find it difficult to stand. Deduct 1 point from your COMBAT SKILL and fight the Kraan. Kraan: COMBAT SKILL 16 ENDURANCE 24 If you kill the creature, you quickly descend the far side of the hill to avoid the Giaks. Pick a number from the Random Number Table . If you pick 0, turn to 53 . If you pick 1–2, turn to 274 . If you pick 3–9, turn to 316 . |
53 A searing pain tears through your right leg as it is twisted and crushed by the weight of your body. Down and down you tumble, until you finally land in a ditch at the base of the hill with such force that the wind is knocked out of you and you lose consciousness. You are awoken by the sharp pain of something stabbing your chest. It proves to be the tip of a Giak spear. You are greeted by the malicious sneer of its owner as he pins your left arm to the ground. Instinctively you reach for your weapon but it is no longer there. Defenceless against the cruel Giaks, the last thing that you see before all light fades is the jagged point of a Giak lance hurtling down towards your throat. Your mission ends here. |
Shortest path to WIN
1 You must make haste for you sense it is not safe to linger by the smoking remains of the ruined monastery. The black-winged beasts could return at any moment. You must set out for the Sommlending capital of Holmgard and tell the King the terrible news of the massacre: that the whole élite of Kai warriors, save yourself, have been slaughtered. Without the Kai Lords to lead her armies, Sommerlund will be at the mercy of their ancient enemy, the Darklords. Fighting back tears, you bid farewell to your dead kinsmen. Silently, you promise that their deaths will be avenged. You turn away from the ruins and carefully descend the steep track. At the foot of the hill, the path splits into two directions, both leading into a large wood. If you wish to use your Kai Discipline of Sixth Sense, turn to 141 . If you wish to take the right path into the wood, turn to 85 . If you wish to follow the left track, turn to 275 . |
141 Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods. If you wish to head south, turn to 56 . Or if you wish to cut through the heavier foliage towards the northeast, turn to 333 . |
56 You hear the scream of a large winged beast above the trees. It is a Kraan, a deadly servant of the Darklords. Quickly you hide beneath the thick fronds of fern until the horrible shrieks have passed away. Now turn to 222 . |
222 As you go on you discover a forest path that divides at the point you join it. If you wish to use your Kai Discipline of Tracking, turn to 67 . If you wish to take the south fork, turn to 140 . If you wish to take the east fork, turn to 252 . |
252 In the centre of a small clearing you see a group of humans talking excitedly and gesturing wildly with their hands. There are two children, three men, and a woman. Their belongings are wrapped in bundles which they carry slung over their shoulders. Their clothes look well made and expensive but they are dirty and torn. If you wish to approach them and ask who they are, turn to 155 . If you wish to avoid them and continue onwards on your mission, turn to 70 . |
70 You have reached a small bridge. A track follows the stream towards the east. A much narrower path disappears into thick forest towards the south. If you wish to use the Kai Discipline of Sixth Sense, turn to 8 . If you wish to go east, turn to 28 . If you wish to go south, turn to 157 . |
157 The forest begins to thin out until finally you can make out a road through the trees ahead. The highway is full of people heading south. Many are wheeling their possessions along on handcarts. If you wish to join the refugees and perhaps learn more of what has happened in the north, turn to 30 . If you would prefer to continue to move south but under cover of the trees, turn to 167 . |
167 You have been travelling for about a mile when you notice two legs sticking out from behind a large boulder. If you possess and wish to use the Kai Discipline of Sixth Sense, turn to 178 . If you wish to take a closer look, turn to 88 . If you would rather avoid meeting their owner and press on into the forest, turn to 264 . |
264 You have not gone far when you hear the sound of battle to the west. If you wish to follow the sound, turn to 97 . If you would rather continue south, turn to 6 . |
6 In the distance you can hear the sound of horses galloping nearer. You crouch behind a tree and wait as the riders come closer. They are the cavalry of the King’s Guard wearing the white uniforms of His Majesty’s army. If you wish to call them, turn to 183 . If you wish to let them pass and then continue on your way through the forest, turn to 200 . |
200 Night is starting to close in. The shadows of the forest are growing longer and darker. Just as you are about to stop and rest, you see through the trees a line of people moving south along a wide highway. Moving closer, you notice a large merchant’s caravan in the centre of the dusty turnpike. It is drawn by six large horses and is moving much faster than any of the other traffic. This could be your chance to reach the capital as quickly as possible. If you wish to use the Kai Discipline of Camouflage to hide in among the packing cases strapped to the roof, turn to 168 . If you wish to jump onto the caravan, turn to 78 . |
168 You pull yourself to the top of the opulent caravan and nestle among the travelling cases and bags. Night will soon engulf the highway. A chill wind blows from the west and you pull your cloak around yourself to keep warm. You listen to the voices below and you can smell the mouthwatering aroma of spiced meat. It reminds you that you are very hungry and must now take a Meal. The fatigue of your ordeal finally catches up with you and you drift off into a restless sleep. Turn to 64 . |
64 You are awoken by the cries of a Kraan circling above the caravan. It is early morning and the sky is clear and bright. You can see a pack of Doomwolves less than a quarter of a mile away along the highway ahead. They are preparing to attack. You must act quickly. If you decide to gather your equipment and run for the cover of the trees, turn to 188 . If you decide to cut free one of the horses and try to break through the attacking Doomwolves to the clear road beyond, then turn to 16 . |
188 You can see the shadow of the Kraan getting larger all around you. It suddenly strikes, pitching you forward onto your face with the power of its attack. Pick a number from the Random Number Table . If the number you have picked is 0–6, the Kraan has ripped away your Backpack. You have lost the Pack and all the Equipment that was inside it. If the number picked is 7–9, your Backpack is intact but you have been wounded in both arms. Lose 3 ENDURANCE points and run to the trees. Now turn to 303 . |
303 The forest here is sparse and hilly. It does not give much cover from an attack from the air. You move as quickly as you can from tree to tree, to avoid the Kraan but you can hear the sound of Doomwolves close behind. If you have the Kai Discipline of Camouflage, turn to 237 . If you do not, turn to 72 . |
72 You turn to face a sneering Giak and the razor-fanged jaws of its mount. You must fight them as one enemy. Giak + Doomwolf: COMBAT SKILL 15 ENDURANCE 24 If you win, turn to 265 . |
265 You quickly move off into the forest before more Doomwolves or Kraan appear. You have walked for more than an hour when you reach the top of a rocky hill. The sight that befalls you on the other side is one of hope. But there is also a daunting challenge to be faced. Turn to 142 . |
142 You can see the tall grey-white walls and glimmering spires of Holmgard, its banners fluttering from the battlements in the fresh morning breeze. Stretching out towards the west, the River Eledil traces its course from the mountains of the Durncrag Range to the Holmgulf. But from below the mountain peaks you can see a vast black army marching relentlessly on towards the city. To your right you can see the highway heading off over the rolling plain towards Holmgard. At a run you could reach the outer fieldworks of the city defences in an hour, but you would be in the open for most of the time and vulnerable to attack by Kraan. However, ahead of you, a wide and muddy river drifts sluggishly towards the Eledil. You could use the cover of the river banks and swim towards the capital. Or towards your left lies the Graveyard of the Ancients. These tombs and crumbling monuments to a forgotten age would conceal your approach, but it is a forbidden area. Many are the unnamed horrors that lie there in restless sleep, waiting to consume the unwary trespasser. If you will try your luck by the highway, turn to 58 . If you feel that you stand a better chance of reaching the capital via the river, then turn to 135 . Or if you are brave enough to risk the unknown perils of the Graveyard of the Ancients, turn to 102 . |
58 Bracing yourself for the run, you head off down the ridge at a steady pace. To the west, the army of the Darklords looks like a giant pot of black ink that has been spilled between the mountains and is spreading into the land below. You have been running for twenty minutes when you catch sight of a pack of Doomwolves lining a shallow ridge to your right. If you decide to flatten yourself against the rocks along the side of the road and wait until they pass, turn to 251 . If you decide to carry on running, but draw your weapon just in case they attack, turn to 160 . |
251 You are lucky, they do not seem to have spotted you. They slowly move on and have soon disappeared along the far side of the ridge. You continue your run. Turn to 10 . |
10 You are sweating and your legs ache. In the middle distance you can see a group of cottages. If you wish to enter a cottage and rest for a while, turn to 115 . If you wish to press on, turn to 83 . |
83 You have run about a mile when three soldiers appear from beneath a small footbridge. They demand that you halt and drop your weapons and equipment. They are bloodstained and unshaven. Their leader is wearing the tunic of a soldier of the Toran garrison. If you possess the Kai Discipline of Sixth Sense, turn to 45 . If you wish to do as they say, turn to 205 . If you wish to prepare to fight them, turn to 180 . If you demand to know what they want, turn to 232 . |
205 Their leader picks up your discarded Equipment and ushers you along the road ahead. (You must now erase all Weapons and Backpack Items from your Action Chart .) An evil grin spreads across the face of the other two men, and you suddenly realize that they are not soldiers after all. You make a break for it and run away from there, sprinting towards the distant capital. Behind you, the ominous click of a crossbow being primed sends a shiver down your spine. Pick a number from the Random Number Table . If the number you have picked is 0–4, turn to 181 . If the number is 5–9, turn to 145 . |
145 You feel as if you have been run down by a cart or wagon. As you fall forward the last thing that you remember before the darkness overcomes you, is the taste of the sandy road and the terrible pain in your back. Turn to 165 . |
165 You awake in a fever. Images swim before your eyes and then fade completely. The pain in your back is intense and you cry out for relief. You feel a cool, damp cloth placed on your forehead and glimpse the worried face of a young woman. An old man whispers in her ear and then he disappears from view. The girl kneels at your side and comforts you with words of kindness and reassurance, but the light quickly fades and darkness engulfs you once more. Turn to 212 . |
212 When you awake, the pain is but a memory. Restore all lost ENDURANCE points to your original score. A tall man dressed in white robes stands before you, a bowl of herbs in his hands. Placing the leaves into a kettle of boiling water, he then turns to greet you. ‘You have passed close to death and have seen his face, Kai Lord, but the Grey One has not claimed you for his flock. You are healed in body but I sense that you are wounded in spirit. What is it that troubles you so?’ You recognize the man to be one of the King’s senior physicians, for the gold embroidered emblem of a dove upon his sleeve is the sign of his respected vocation. You tell the aged cleric of the events at the monastery and of your perilous journey to the King. Raising you gently from the bed by your arm, he bids you follow him. You notice that you are in a lavishly decorated room which leads out through a long corridor lined with tapestries. It slowly dawns on you just where you are. This is the citadel of Holmgard and you are about to meet the King. Turn to 350 . |
350 You enter the Chamber of State, a magnificent hall decorated lavishly in white and gold. The King and his closest advisers are studying a large map spread upon a marble plinth in the centre of the chamber. Their faces are lined with worry and concentration. A silence fills the hall as you tell of the death of your kinsmen and of your perilous journey to the citadel. As you finish your story, the King approaches and takes your right hand in his. ‘Lone Wolf, you have selfless courage: the quality of a true Kai Lord. Your journey here has been one of great peril and although your news comes as a grievous blow, the spirit of your determination is like a beacon of hope to us all in this dark hour. You have brought great honour to the memory of your Masters, and for that we praise you.’ You receive the praise and heartfelt thanks of the entire hall—an honour that brings a certain redness to your young face. The King raises his hand and all the voices cease. ‘You have done all that Sommerlund could have asked of a loyal son, but she is greatly in need of you still. The Darklords are powerful once more and their ambition knows no bounds. Our only hope lies within Durenor with the power that once defeated the Darklords an age ago. Lone Wolf, you are the last of the Kai—you have the skills. Will you journey to Durenor and return with the Sommerswerd, the sword of the sun? Only with that gift of the gods may we crush this evil and save our land.’ If you wish to accept the quest of the Sommerswerd, begin your adventure with Book 2 of the Lone Wolf adventures: Fire on the Water |
Any cycles?
Most of the cycles seem to involve walking around. I think you can get infinite swords if you do it right.