Last active
August 19, 2020 19:06
-
-
Save katef/9a8e7a176bd43839a6461f5247f4e92b to your computer and use it in GitHub Desktop.
The Knightmare Challenge (Choose your own adventure), in Graphviz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The Knightmare Challenge (Choose your own adventure) | |
* ISBN 0-552-52540-5 | |
* | |
* Transcribed to graphviz by Kate. I had originally used record | |
* nodes with ports describing each choice, but the result was | |
* illegible. What a way to spend an evening. | |
*/ | |
digraph Knightmare { | |
node [ fontname=verdana, splines=true, shape=plaintext ]; | |
/* nodes with multiple choices */ | |
1 -> { 57; 20; 80; }; | |
2 -> { 27; 34; 41; 65 }; | |
3 -> { 91; 66; }; | |
5 -> { 104; 7; }; | |
9 -> { 75; 23; }; | |
16 -> { 96; 25; }; | |
17 -> { 33; 10; 97; }; | |
29 -> { 21; 17; }; | |
30 -> { 26; 43; }; | |
33 -> { 36; 81; }; | |
37 -> { 75; 45; }; | |
38 -> { 105; 15; }; | |
44 -> { 12; 82; 75; }; | |
48 -> { 89; 78; }; | |
51 -> { 77; 63; 69; }; | |
56 -> { 35; 72; 99; }; | |
57 -> { 13; 25; 46; 68; }; | |
61 -> { 54; 14; }; | |
68 -> { 82; 97; }; | |
69 -> { 50; 37; }; | |
74 -> { 21; 31; 87; }; | |
76 -> { 5; 104; 7; }; | |
80 -> { 84; 100; }; | |
84 -> { 71; 49; }; | |
86 -> { 28; 67; }; | |
88 -> { 24; 59; 55; 97; }; | |
93 -> { 13; 32; 50; }; | |
94 -> { 98; 83; }; | |
95 -> { 11; 63; 19; }; | |
96 -> { 29; 25; }; | |
101 -> { 92; 76; }; | |
103 -> { 4; 22; }; | |
/* nodes where you may answer correctly or incorrectly */ | |
6 -> { 64; 52; }; | |
32 -> { 62; 52; }; | |
58 -> { 8; 52; }; | |
72 -> { 39; 18; }; | |
/* nodes with right or left choices */ | |
20 -> { 93; 42; }; | |
22 -> { 4; 94; } | |
46 -> { 58; 40; } | |
60 -> { 102; 2; } | |
62 -> { 25; 88; } | |
90 -> { 40; 3; } | |
/* nodes passing straight on */ | |
8 -> 16; | |
10 -> 33; // written 330 in the book! I assume they meant 33 | |
12 -> 90; | |
14 -> 74; | |
15 -> 73; | |
19 -> 70; | |
26 -> 38; | |
31 -> 79; | |
35 -> 72; | |
39 -> 51; | |
43 -> 38; | |
47 -> 85; | |
49 -> 6; | |
55 -> 48; | |
64 -> 61; | |
65 -> 95; | |
67 -> 60; | |
73 -> 44; | |
79 -> 86; | |
81 -> 101; | |
85 -> 103; | |
89 -> 30; | |
91 -> 9; | |
104 -> 56; | |
/* nodes where you win */ | |
23 [ fontcolor=blue ]; | |
45 [ fontcolor=blue ]; | |
83 [ fontcolor=blue ]; | |
23 -> 80; | |
45 -> 20; | |
/* nodes where you might die */ | |
27 [ fontcolor=red ]; | |
34 [ fontcolor=red ]; | |
40 [ fontcolor=red ]; | |
41 [ fontcolor=red ]; | |
70 [ fontcolor=red ]; | |
99 [ fontcolor=red ]; | |
27 -> 65; | |
34 -> 65; | |
40 -> 82; | |
41 -> 65; | |
70 -> { 53; 47; }; | |
99 -> 35; | |
/* nodes where you will die */ | |
4 [ fontcolor=red ]; | |
7 [ fontcolor=red ]; | |
11 [ fontcolor=red ]; | |
13 [ fontcolor=red ]; | |
18 [ fontcolor=red ]; | |
21 [ fontcolor=red ]; | |
24 [ fontcolor=red ]; | |
25 [ fontcolor=red ]; | |
28 [ fontcolor=red ]; | |
36 [ fontcolor=red ]; | |
40 [ fontcolor=red ]; | |
42 [ fontcolor=red ]; | |
50 [ fontcolor=red ]; | |
52 [ fontcolor=red ]; | |
53 [ fontcolor=red ]; | |
54 [ fontcolor=red ]; | |
59 [ fontcolor=red ]; | |
63 [ fontcolor=red ]; | |
66 [ fontcolor=red ]; | |
71 [ fontcolor=red ]; | |
75 [ fontcolor=red ]; | |
77 [ fontcolor=red ]; | |
78 [ fontcolor=red ]; | |
82 [ fontcolor=red ]; | |
87 [ fontcolor=red ]; | |
92 [ fontcolor=red ]; | |
97 [ fontcolor=red ]; | |
98 [ fontcolor=red ]; | |
100 [ fontcolor=red ]; | |
102 [ fontcolor=red ]; | |
105 [ fontcolor=red ]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The Knightmare Challenge (Choose your own adventure) | |
* ISBN 0-552-52540-5 | |
* | |
* Transcribed to graphviz by Kate ([email protected]). | |
* | |
* I had originally used record nodes with ports describing | |
* each choice, but the result was illegible. What a way to | |
* spend an evening. | |
* | |
* In this version, I've allowed deaths to be duplicated | |
* at convenient locations (they keep the same labels, so | |
* some death nodes appear multiple times in the output. 82, | |
* for example). This is because the deaths are often dull - | |
* along the lines of "the bomb explodes and you die" - and | |
* essentially unrelated to the story line. I assume they're | |
* reachable from many nodes to save the authors writing | |
* a separate death for each. Especially for the "you are | |
* cheating: game over" node! | |
* | |
* With these duplicated, the linear essence of the story | |
* can clearly be seen. The story starts with node 1 presenting | |
* three choices; of easy, medium and hard difficulty. On | |
* completion of each (the blue nodes), the reader is | |
* given the option to continue. From this graph, it can | |
* clearly be seen that these three skill levels lead on | |
* to one another. So "easy" gives you the option to end | |
* early, and "hard" skips straight to the difficult bits. | |
* | |
* I often got the feeling when reading this story that my | |
* choices had little effect (other than making me die many | |
* times!); usually there was only one way to continue | |
* forward. It can be seen that this is indeed the case; | |
* this is not so much a "choose your own adventure" book as | |
* "stick to the chosen path or die"! | |
*/ | |
digraph Knightmare { | |
node [ fontname=verdana, splines=true, shape=plaintext ]; | |
edge [ fontname=verdana, arrowhead=open, arrowsize=0.6]; | |
/* the start. placing edge labels like this is silly */ | |
1 -> 57 [ taillabel=easy, labeldistance=5 ]; /* 5 what? */ | |
1 -> 20 [ taillabel="medium ", labeldistance=5 ]; | |
1 -> 80 [ taillabel=" hard", labeldistance=4 ]; | |
/* nodes with multiple choices */ | |
2 -> { 27; 34; 41; 65 }; | |
3 -> { 91; 66; }; | |
5 -> { 104; 7; }; | |
9 -> { a75; 23; }; | |
16 -> { 96; a25; }; | |
17 -> { 33; 10; a97; }; | |
29 -> { a21; 17; }; | |
30 -> { 26; 43; }; | |
33 -> { 36; 81; }; | |
37 -> { b75; 45; }; | |
38 -> { 105; 15; }; | |
44 -> { 12; a82; c75; }; | |
48 -> { 89; 78; }; | |
51 -> { 77; a63; 69; }; | |
56 -> { 35; 72; 99; }; | |
57 -> { a13; b25; 46; 68; }; | |
61 -> { 54; 14; }; | |
68 -> { b82; b97; }; | |
69 -> { a50; 37; }; | |
74 -> { b21; 31; 87; }; | |
76 -> { 5; 104; 7; }; | |
80 -> { 84; 100; }; | |
84 -> { 71; 49; }; | |
86 -> { 28; 67; }; | |
88 -> { 24; 59; 55; c97; }; | |
93 -> { b13; 32; b50; }; | |
94 -> { 98; 83; }; | |
95 -> { 11; b63; 19; }; | |
96 -> { 29; c25; }; | |
101 -> { 92; 76; }; | |
103 -> { a4; 22; }; | |
/* nodes where you may answer correctly or incorrectly */ | |
6 -> { 64; a52; }; | |
32 -> { 62; b52; }; | |
58 -> { 8; c52; }; | |
72 -> { 39; 18; }; | |
/* nodes with right or left choices */ | |
20 -> { 93; 42; }; | |
22 -> { b4; 94; } | |
46 -> { 58; a40; } | |
60 -> { 102; 2; } | |
62 -> { d25; 88; } | |
90 -> { b40; 3; } | |
/* nodes passing straight on */ | |
8 -> 16; | |
10 -> 33; // written 330 in the book! I assume they meant 33 | |
12 -> 90; | |
14 -> 74; | |
15 -> 73; | |
19 -> 70; | |
26 -> 38; | |
31 -> 79; | |
35 -> 72; | |
39 -> 51; | |
43 -> 38; | |
47 -> 85; | |
49 -> 6; | |
55 -> 48; | |
64 -> 61; | |
65 -> 95; | |
67 -> 60; | |
73 -> 44; | |
79 -> 86; | |
81 -> 101; | |
85 -> 103; | |
89 -> 30; | |
91 -> 9; | |
104 -> 56; | |
/* nodes where you win */ | |
23 [ fontcolor=blue ]; | |
45 [ fontcolor=blue ]; | |
83 [ fontcolor=blue ]; | |
23 -> 80; | |
45 -> 20; | |
/* nodes where you might die, depending if you have a certian item */ | |
27 [ fontcolor=red ]; | |
34 [ fontcolor=red ]; | |
a40 [ fontcolor=red, label=40 ]; | |
b40 [ fontcolor=red, label=40 ]; | |
41 [ fontcolor=red ]; | |
70 [ fontcolor=red ]; | |
99 [ fontcolor=red ]; | |
27 -> 65; | |
34 -> 65; | |
a40 -> c82; | |
b40 -> d82; | |
41 -> 65; | |
70 -> { 53; 47; }; | |
99 -> 35; | |
/* nodes where you will die */ | |
a4 [ fontcolor=red, label=4 ]; | |
b4 [ fontcolor=red, label=4 ]; | |
7 [ fontcolor=red ]; | |
11 [ fontcolor=red ]; | |
a13 [ fontcolor=red, label=13 ]; | |
b13 [ fontcolor=red, label=13 ]; | |
18 [ fontcolor=red ]; | |
a21 [ fontcolor=red, label=21 ]; | |
b21 [ fontcolor=red, label=21 ]; | |
24 [ fontcolor=red ]; | |
a25 [ fontcolor=red, label=25 ]; | |
b25 [ fontcolor=red, label=25 ]; | |
c25 [ fontcolor=red, label=25 ]; | |
d25 [ fontcolor=red, label=25 ]; | |
28 [ fontcolor=red ]; | |
36 [ fontcolor=red ]; | |
42 [ fontcolor=red ]; | |
a50 [ fontcolor=red, label=50 ]; | |
b50 [ fontcolor=red, label=50 ]; | |
a52 [ fontcolor=red, label=52 ]; | |
b52 [ fontcolor=red, label=52 ]; | |
c52 [ fontcolor=red, label=52 ]; | |
53 [ fontcolor=red ]; | |
54 [ fontcolor=red ]; | |
59 [ fontcolor=red ]; | |
a63 [ fontcolor=red, label=63 ]; | |
b63 [ fontcolor=red, label=63 ]; | |
66 [ fontcolor=red ]; | |
71 [ fontcolor=red ]; | |
a75 [ fontcolor=red, label=75 ]; | |
b75 [ fontcolor=red, label=75 ]; | |
c75 [ fontcolor=red, label=75 ]; | |
77 [ fontcolor=red ]; | |
78 [ fontcolor=red ]; | |
a82 [ fontcolor=red, label=82 ]; | |
b82 [ fontcolor=red, label=82 ]; | |
c82 [ fontcolor=red, label=82 ]; | |
d82 [ fontcolor=red, label=82 ]; | |
87 [ fontcolor=red ]; | |
92 [ fontcolor=red ]; | |
a97 [ fontcolor=red, label=97 ]; | |
b97 [ fontcolor=red, label=97 ]; | |
c97 [ fontcolor=red, label=97 ]; | |
98 [ fontcolor=red ]; | |
100 [ fontcolor=red ]; | |
102 [ fontcolor=red ]; | |
105 [ fontcolor=red ]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: knightmare.png knightmare-rep.png | |
clean: | |
rm -f knightmare.png knightmare-rep.png | |
knightmare.png: knightmare.dot | |
dot -Tpng knightmare.dot > knightmare.png | |
knightmare-rep.png: knightmare-rep.dot | |
dot -Tpng knightmare-rep.dot > knightmare-rep.png |
Author
katef
commented
Aug 17, 2020
knightmare.png | knightmare-rep.png |
---|---|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment