1
0
Fork 0
mirror of https://github.com/Oreolek/gamebookformat.git synced 2024-06-16 23:20:44 +03:00

Disable shuffling replaces setting random seed.

This commit is contained in:
Pelle Nilsson 2013-06-16 21:25:50 +02:00
parent 1d9ed7d7b7
commit 45cbf9ab7f
27 changed files with 563 additions and 563 deletions

View file

@ -15,22 +15,22 @@ readme.html: readme.org
emacs -Q --batch --visit=readme.org --funcall org-export-as-html-batch
%.rtf: %.gamebook *.py templates/rtf/*.rtf
./formatgamebook.py --random=1 $< $@
./formatgamebook.py --no-shuffle $< $@
%.html: %.gamebook *.py templates/html/*.html
./formatgamebook.py --random=1 $< $@
./formatgamebook.py --no-shuffle $< $@
%.tex: %.gamebook *.py templates/tex/*.tex
./formatgamebook.py --random=1 $< $@
./formatgamebook.py --no-shuffle $< $@
%.dot: %.gamebook *.py templates/dot/*.dot
./formatgamebook.py --random=1 $< $@
./formatgamebook.py --no-shuffle $< $@
%.debug: %.gamebook *.py templates/debug/*.debug
./formatgamebook.py --random=1 $< $@
./formatgamebook.py --no-shuffle $< $@
%.txt: %.gamebook *.py templates/txt/*.txt
./formatgamebook.py --random=1 $< $@
./formatgamebook.py --no-shuffle $< $@
%.pdf: %.tex
cd $(dir $<) && pdflatex $(notdir $<) && pdflatex $(notdir $<)

View file

@ -5,12 +5,12 @@ Number of sections: 9
Turn to 1 to begin.
1 (start) - Demonstrating how [COLLECT code]Codewords[/COLLECT] (AKA sightings) can be used. Go to 2.
2 (second) - Got codeword [ADD code]warrior[/ADD]. Simple enough to set a codeword. Turn to 5.
2 (second) - Got codeword [ADD code]warrior[/ADD]. Simple enough to set a codeword. Turn to 9.
3 (the_end) - That was easy.
4 (xortest) - OK, if you have the codeword [HAS code]warrior[/HAS], you may turn to 3 otherwise you may go back to 2. Although we both know you have that codeword. If you have the codeword [HAS code]fun[/HAS] you may turn to 7, without it you can go to 6.
5 (choice) - If you have the codeword [HAS code]warrior[/HAS] you may turn to 3. If you do not have the codeword [HAS NOT code]fun[/HAS NOT], you may turn to 6. If you have the codeword [HAS code]fun[/HAS], you may instead turn to 7. Otherwise see 4.
6 (notsofun) - This is just to demonstrate choices allowed when not having a codeword. Now go on to 8 (autotest) or 4 (xor test).
7 (cheater) - Cheater! There is no way you can have codeword fun.
8 (autotest) - If you have codeword [HAS code]warrior[/HAS] turn to ((automatic))9. Otherwise you can go to the end at 3 or back to 1.
9 (noautotest) - If you have the codeword [HAS code]fun[/HAS] turn to ((automatic))7. Otherwise you can go to the end at 3 or to the xortest at 4.
4 (xortest) - OK, if you have the codeword [HAS code]warrior[/HAS], you may turn to 3 otherwise you may go back to 2. Although we both know you have that codeword. If you have the codeword [HAS code]fun[/HAS] you may turn to 5, without it you can go to 8.
5 (cheater) - Cheater! There is no way you can have codeword fun.
6 (noautotest) - If you have the codeword [HAS code]fun[/HAS] turn to ((automatic))5. Otherwise you can go to the end at 3 or to the xortest at 4.
7 (autotest) - If you have codeword [HAS code]warrior[/HAS] turn to ((automatic))6. Otherwise you can go to the end at 3 or back to 1.
8 (notsofun) - This is just to demonstrate choices allowed when not having a codeword. Now go on to 7 (autotest) or 4 (xor test).
9 (choice) - If you have the codeword [HAS code]warrior[/HAS] you may turn to 3. If you do not have the codeword [HAS NOT code]fun[/HAS NOT], you may turn to 8. If you have the codeword [HAS code]fun[/HAS], you may instead turn to 5. Otherwise see 4.
END DEBUG OUTPUT

View file

@ -1,32 +1,32 @@
digraph gamebook {
1->2
2->5
2->9
4->2
4->5
4->8
4->3
4->6
4->7
5->7
5->4
5->6
5->3
6->4
6->8
8->9
6->3
8->1
6->5
7->6
8->3
7->3
7->1
8->4
8->7
9->3
9->7
9->8
9->5
9->4
}

View file

@ -390,7 +390,7 @@ if (this.gamebook) {
<span class="sectionnumber" id="para2">2</span>
<div class="sectiontext">
Got codeword <span class="add" data-type="code"
data-what="warrior">warrior</span>. Simple enough to set a codeword. Turn to <a class="sectionref enabledlink" data-ref="5">5</a>.
data-what="warrior">warrior</span>. Simple enough to set a codeword. Turn to <a class="sectionref enabledlink" data-ref="9">9</a>.
</div>
</div>
<script>
@ -410,7 +410,7 @@ if (this.gamebook) {
</script><div class="section" id="section4">
<span class="sectionnumber" id="para4">4</span>
<div class="sectiontext">
OK, if you have the codeword <span class="has" data-type="code" data-what="warrior">warrior</span>, you may turn to <span class="xor"></span><a class="sectionref enabledlink" data-ref="3">3</a> otherwise you may go back to <a class="sectionref enabledlink" data-ref="2">2</a>. Although we both know you have that codeword. If you have the codeword <span class="has" data-type="code" data-what="fun">fun</span> you may turn to <span class="xor"></span><a class="sectionref enabledlink" data-ref="7">7</a>, without it you can go to <a class="sectionref enabledlink" data-ref="6">6</a>.
OK, if you have the codeword <span class="has" data-type="code" data-what="warrior">warrior</span>, you may turn to <span class="xor"></span><a class="sectionref enabledlink" data-ref="3">3</a> otherwise you may go back to <a class="sectionref enabledlink" data-ref="2">2</a>. Although we both know you have that codeword. If you have the codeword <span class="has" data-type="code" data-what="fun">fun</span> you may turn to <span class="xor"></span><a class="sectionref enabledlink" data-ref="5">5</a>, without it you can go to <a class="sectionref enabledlink" data-ref="8">8</a>.
</div>
</div>
<script>
@ -420,8 +420,7 @@ if (this.gamebook) {
</script><div class="section" id="section5">
<span class="sectionnumber" id="para5">5</span>
<div class="sectiontext">
If you have the codeword <span class="has" data-type="code" data-what="warrior">warrior</span> you may turn to <a class="sectionref enabledlink" data-ref="3">3</a>. If you do not have the codeword <span class="hasnot" data-type="code"
data-what="fun">fun</span>, you may turn to <a class="sectionref enabledlink" data-ref="6">6</a>. If you have the codeword <span class="has" data-type="code" data-what="fun">fun</span>, you may instead turn to <a class="sectionref enabledlink" data-ref="7">7</a>. Otherwise see <a class="sectionref enabledlink" data-ref="4">4</a>.
Cheater! There is no way you can have codeword fun.
</div>
</div>
<script>
@ -431,7 +430,7 @@ if (this.gamebook) {
</script><div class="section" id="section6">
<span class="sectionnumber" id="para6">6</span>
<div class="sectiontext">
This is just to demonstrate choices allowed when not having a codeword. Now go on to <a class="sectionref enabledlink" data-ref="8">8</a> (autotest) or <a class="sectionref enabledlink" data-ref="4">4</a> (xor test).
If you have the codeword <span class="has" data-type="code" data-what="fun">fun</span> turn to <span class="auto"></span><a class="sectionref enabledlink" data-ref="5">5</a>. Otherwise you can go to the end at <a class="sectionref enabledlink" data-ref="3">3</a> or to the xortest at <a class="sectionref enabledlink" data-ref="4">4</a>.
</div>
</div>
<script>
@ -441,7 +440,7 @@ if (this.gamebook) {
</script><div class="section" id="section7">
<span class="sectionnumber" id="para7">7</span>
<div class="sectiontext">
Cheater! There is no way you can have codeword fun.
If you have codeword <span class="has" data-type="code" data-what="warrior">warrior</span> turn to <span class="auto"></span><a class="sectionref enabledlink" data-ref="6">6</a>. Otherwise you can go to the end at <a class="sectionref enabledlink" data-ref="3">3</a> or back to <a class="sectionref enabledlink" data-ref="1">1</a>.
</div>
</div>
<script>
@ -451,7 +450,7 @@ if (this.gamebook) {
</script><div class="section" id="section8">
<span class="sectionnumber" id="para8">8</span>
<div class="sectiontext">
If you have codeword <span class="has" data-type="code" data-what="warrior">warrior</span> turn to <span class="auto"></span><a class="sectionref enabledlink" data-ref="9">9</a>. Otherwise you can go to the end at <a class="sectionref enabledlink" data-ref="3">3</a> or back to <a class="sectionref enabledlink" data-ref="1">1</a>.
This is just to demonstrate choices allowed when not having a codeword. Now go on to <a class="sectionref enabledlink" data-ref="7">7</a> (autotest) or <a class="sectionref enabledlink" data-ref="4">4</a> (xor test).
</div>
</div>
<script>
@ -461,7 +460,8 @@ if (this.gamebook) {
</script><div class="section" id="section9">
<span class="sectionnumber" id="para9">9</span>
<div class="sectiontext">
If you have the codeword <span class="has" data-type="code" data-what="fun">fun</span> turn to <span class="auto"></span><a class="sectionref enabledlink" data-ref="7">7</a>. Otherwise you can go to the end at <a class="sectionref enabledlink" data-ref="3">3</a> or to the xortest at <a class="sectionref enabledlink" data-ref="4">4</a>.
If you have the codeword <span class="has" data-type="code" data-what="warrior">warrior</span> you may turn to <a class="sectionref enabledlink" data-ref="3">3</a>. If you do not have the codeword <span class="hasnot" data-type="code"
data-what="fun">fun</span>, you may turn to <a class="sectionref enabledlink" data-ref="8">8</a>. If you have the codeword <span class="has" data-type="code" data-what="fun">fun</span>, you may instead turn to <a class="sectionref enabledlink" data-ref="5">5</a>. Otherwise see <a class="sectionref enabledlink" data-ref="4">4</a>.
</div>
</div>
<script>

View file

@ -21,7 +21,7 @@
\b \qc 2
\b0\
\ql Got codeword warrior. Simple enough to set a codeword. Turn to \b 5
\ql Got codeword warrior. Simple enough to set a codeword. Turn to \b 9
\b0
. \
\
@ -37,54 +37,21 @@
\b0
otherwise you may go back to \b 2
\b0
. Although we both know you have that codeword. If you have the codeword fun you may turn to \b 7
. Although we both know you have that codeword. If you have the codeword fun you may turn to \b 5
\b0
, without it you can go to \b 6
, without it you can go to \b 8
\b0
. \
\
\b \qc 5
\b0\
\ql If you have the codeword warrior you may turn to \b 3
\b0
. If you do not have the codeword fun, you may turn to \b 6
\b0
. If you have the codeword fun, you may instead turn to \b 7
\b0
. Otherwise see \b 4
\b0
. \
\ql Cheater! There is no way you can have codeword fun. \
\
\b \qc 6
\b0\
\ql This is just to demonstrate choices allowed when not having a codeword. Now go on to \b 8
\b0
(autotest) or \b 4
\b0
(xor test). \
\
\b \qc 7
\b0\
\ql Cheater! There is no way you can have codeword fun. \
\
\b \qc 8
\b0\
\ql If you have codeword warrior turn to \b 9
\b0
. Otherwise you can go to the end at \b 3
\b0
or back to \b 1
\b0
. \
\
\b \qc 9
\b0\
\ql If you have the codeword fun turn to \b 7
\ql If you have the codeword fun turn to \b 5
\b0
. Otherwise you can go to the end at \b 3
\b0
@ -93,4 +60,37 @@
. \
\
\b \qc 7
\b0\
\ql If you have codeword warrior turn to \b 6
\b0
. Otherwise you can go to the end at \b 3
\b0
or back to \b 1
\b0
. \
\
\b \qc 8
\b0\
\ql This is just to demonstrate choices allowed when not having a codeword. Now go on to \b 7
\b0
(autotest) or \b 4
\b0
(xor test). \
\
\b \qc 9
\b0\
\ql If you have the codeword warrior you may turn to \b 3
\b0
. If you do not have the codeword fun, you may turn to \b 8
\b0
. If you have the codeword fun, you may instead turn to \b 5
\b0
. Otherwise see \b 4
\b0
. \
\
}

View file

@ -50,7 +50,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{2} \end{center}}
\noindent
Got codeword \textbf{warrior}. Simple enough to set a codeword. Turn to \textbf{\autoref{section5}}.
Got codeword \textbf{warrior}. Simple enough to set a codeword. Turn to \textbf{\autoref{section9}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -66,7 +66,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{4} \end{center}}
\noindent
OK, if you have the codeword \textit{warrior}, you may turn to \textbf{\autoref{section3}} otherwise you may go back to \textbf{\autoref{section2}}. Although we both know you have that codeword. If you have the codeword \textit{fun} you may turn to \textbf{\autoref{section7}}, without it you can go to \textbf{\autoref{section6}}.
OK, if you have the codeword \textit{warrior}, you may turn to \textbf{\autoref{section3}} otherwise you may go back to \textbf{\autoref{section2}}. Although we both know you have that codeword. If you have the codeword \textit{fun} you may turn to \textbf{\autoref{section5}}, without it you can go to \textbf{\autoref{section8}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -74,7 +74,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{5} \end{center}}
\noindent
If you have the codeword \textit{warrior} you may turn to \textbf{\autoref{section3}}. If you do not have the codeword \textit{fun}, you may turn to \textbf{\autoref{section6}}. If you have the codeword \textit{fun}, you may instead turn to \textbf{\autoref{section7}}. Otherwise see \textbf{\autoref{section4}}.
Cheater! There is no way you can have codeword fun.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -82,7 +82,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{6} \end{center}}
\noindent
This is just to demonstrate choices allowed when not having a codeword. Now go on to \textbf{\autoref{section8}} (autotest) or \textbf{\autoref{section4}} (xor test).
If you have the codeword \textit{fun} turn to \textbf{\autoref{section5}}. Otherwise you can go to the end at \textbf{\autoref{section3}} or to the xortest at \textbf{\autoref{section4}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -90,7 +90,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{7} \end{center}}
\noindent
Cheater! There is no way you can have codeword fun.
If you have codeword \textit{warrior} turn to \textbf{\autoref{section6}}. Otherwise you can go to the end at \textbf{\autoref{section3}} or back to \textbf{\autoref{section1}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -98,7 +98,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{8} \end{center}}
\noindent
If you have codeword \textit{warrior} turn to \textbf{\autoref{section9}}. Otherwise you can go to the end at \textbf{\autoref{section3}} or back to \textbf{\autoref{section1}}.
This is just to demonstrate choices allowed when not having a codeword. Now go on to \textbf{\autoref{section7}} (autotest) or \textbf{\autoref{section4}} (xor test).
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -106,6 +106,6 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{9} \end{center}}
\noindent
If you have the codeword \textit{fun} turn to \textbf{\autoref{section7}}. Otherwise you can go to the end at \textbf{\autoref{section3}} or to the xortest at \textbf{\autoref{section4}}.
If you have the codeword \textit{warrior} you may turn to \textbf{\autoref{section3}}. If you do not have the codeword \textit{fun}, you may turn to \textbf{\autoref{section8}}. If you have the codeword \textit{fun}, you may instead turn to \textbf{\autoref{section5}}. Otherwise see \textbf{\autoref{section4}}.
\vspace{1em}
\end{document}

View file

@ -7,26 +7,26 @@ Turn to 1 to begin.
Demonstrating how Codewords (AKA sightings) can be used. Go to 2.
2
Got codeword warrior. Simple enough to set a codeword. Turn to 5.
Got codeword warrior. Simple enough to set a codeword. Turn to 9.
3
That was easy.
4
OK, if you have the codeword warrior, you may turn to 3 otherwise you may go back to 2. Although we both know you have that codeword. If you have the codeword fun you may turn to 7, without it you can go to 6.
OK, if you have the codeword warrior, you may turn to 3 otherwise you may go back to 2. Although we both know you have that codeword. If you have the codeword fun you may turn to 5, without it you can go to 8.
5
If you have the codeword warrior you may turn to 3. If you do not have the codeword fun, you may turn to 6. If you have the codeword fun, you may instead turn to 7. Otherwise see 4.
6
This is just to demonstrate choices allowed when not having a codeword. Now go on to 8 (autotest) or 4 (xor test).
7
Cheater! There is no way you can have codeword fun.
6
If you have the codeword fun turn to 5. Otherwise you can go to the end at 3 or to the xortest at 4.
7
If you have codeword warrior turn to 6. Otherwise you can go to the end at 3 or back to 1.
8
If you have codeword warrior turn to 9. Otherwise you can go to the end at 3 or back to 1.
This is just to demonstrate choices allowed when not having a codeword. Now go on to 7 (autotest) or 4 (xor test).
9
If you have the codeword fun turn to 7. Otherwise you can go to the end at 3 or to the xortest at 4.
If you have the codeword warrior you may turn to 3. If you do not have the codeword fun, you may turn to 8. If you have the codeword fun, you may instead turn to 5. Otherwise see 4.

View file

@ -4,15 +4,15 @@ Number of sections: 11
Turn to 1 to begin.
1 (start) - Demonstrating how to manage player [COLLECT item]Inventory[/COLLECT]. You start the book carrying a [ADD item]sword[/ADD] and a [ADD item]shield[/ADD]. Turn to 6.
2 (cut_rope) - OK. That was fun. Turn to 8.
3 (inside) - There is a rope here that can be cut using a [HAS item]sword[/HAS]. If you have one and want to do that, see 2. Otherwise turn to 8.
4 (door) - There is a locked door here. If you have a [HAS item]key[/HAS] you can use that to open the door, see 3. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the [HAS item]sword[/HAS], if you have it, see 5. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see 6.
5 (attempt_break_door_with_sword) - OK. The door is broken, but so is the [DROP item]sword[/DROP]. Turn to 3.
6 (tjunction) - You have reached a t-junction. Here you find a [FOUND item]key[/FOUND] and a [FOUND item]stick[/FOUND]. You can go west to 4, or east to 10.
7 (portal) - A magic portal ahead will only allow you to pass if you did not pick up the [HAS NOT item]cursed bracelet[/HAS NOT], leading you to 11. If you have the [HAS item]cursed bracelet[/HAS] you have to go back to 6 instead. Actually feel free to head back to 6 either way.
8 (won) - Congratulations, you won.
9 (drop_stick) - OK [DROP item]stick[/DROP] dropped. Turn back to 6 to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
10 (curse) - There is a [FOUND item]cursed bracelet[/FOUND] here. You can go on to 7 or go back to 6. You can also drop the [HAS item]stick[/HAS] for no particular reason if you have it, see 9.
11 (treasure) - You found [FOUND item]something valuable[/FOUND], but there is no way forward, so you head back to 6.
1 (start) - Demonstrating how to manage player [COLLECT item]Inventory[/COLLECT]. You start the book carrying a [ADD item]sword[/ADD] and a [ADD item]shield[/ADD]. Turn to 11.
2 (won) - Congratulations, you won.
3 (cut_rope) - OK. That was fun. Turn to 2.
4 (inside) - There is a rope here that can be cut using a [HAS item]sword[/HAS]. If you have one and want to do that, see 3. Otherwise turn to 2.
5 (treasure) - You found [FOUND item]something valuable[/FOUND], but there is no way forward, so you head back to 11.
6 (portal) - A magic portal ahead will only allow you to pass if you did not pick up the [HAS NOT item]cursed bracelet[/HAS NOT], leading you to 5. If you have the [HAS item]cursed bracelet[/HAS] you have to go back to 11 instead. Actually feel free to head back to 11 either way.
7 (drop_stick) - OK [DROP item]stick[/DROP] dropped. Turn back to 11 to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
8 (curse) - There is a [FOUND item]cursed bracelet[/FOUND] here. You can go on to 6 or go back to 11. You can also drop the [HAS item]stick[/HAS] for no particular reason if you have it, see 7.
9 (attempt_break_door_with_sword) - OK. The door is broken, but so is the [DROP item]sword[/DROP]. Turn to 4.
10 (door) - There is a locked door here. If you have a [HAS item]key[/HAS] you can use that to open the door, see 4. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the [HAS item]sword[/HAS], if you have it, see 9. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see 11.
11 (tjunction) - You have reached a t-junction. Here you find a [FOUND item]key[/FOUND] and a [FOUND item]stick[/FOUND]. You can go west to 10, or east to 8.
END DEBUG OUTPUT

View file

@ -1,27 +1,27 @@
digraph gamebook {
1->6
2->8
1->11
3->2
3->8
4->5
4->2
4->3
5->11
6->5
4->6
5->3
6->4
6->10
7->6
6->11
7->11
9->6
8->6
8->11
8->7
9->4
10->9
10->6
10->4
10->7
11->6
10->11
11->10
11->8
}

View file

@ -381,7 +381,7 @@ if (typeof exports !== 'undefined') {
Demonstrating how to manage player <span class="collect" data-type="item"
data-name="Inventory">Inventory</span>. You start the book carrying a <span class="add" data-type="item"
data-what="sword">sword</span> and a <span class="add" data-type="item"
data-what="shield">shield</span>. Turn to <a class="sectionref enabledlink" data-ref="6">6</a>.
data-what="shield">shield</span>. Turn to <a class="sectionref enabledlink" data-ref="11">11</a>.
</div>
</div>
<script>
@ -391,7 +391,7 @@ if (this.gamebook) {
</script><div class="section" id="section2">
<span class="sectionnumber" id="para2">2</span>
<div class="sectiontext">
OK. That was fun. Turn to <a class="sectionref enabledlink" data-ref="8">8</a>.
Congratulations, you won.
</div>
</div>
<script>
@ -401,7 +401,7 @@ if (this.gamebook) {
</script><div class="section" id="section3">
<span class="sectionnumber" id="para3">3</span>
<div class="sectiontext">
There is a rope here that can be cut using a <span class="has" data-type="item" data-what="sword">sword</span>. If you have one and want to do that, see <a class="sectionref enabledlink" data-ref="2">2</a>. Otherwise turn to <a class="sectionref enabledlink" data-ref="8">8</a>.
OK. That was fun. Turn to <a class="sectionref enabledlink" data-ref="2">2</a>.
</div>
</div>
<script>
@ -411,7 +411,7 @@ if (this.gamebook) {
</script><div class="section" id="section4">
<span class="sectionnumber" id="para4">4</span>
<div class="sectiontext">
There is a locked door here. If you have a <span class="has" data-type="item" data-what="key">key</span> you can use that to open the door, see <a class="sectionref enabledlink" data-ref="3">3</a>. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the <span class="has" data-type="item" data-what="sword">sword</span>, if you have it, see <a class="sectionref enabledlink" data-ref="5">5</a>. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see <a class="sectionref enabledlink" data-ref="6">6</a>.
There is a rope here that can be cut using a <span class="has" data-type="item" data-what="sword">sword</span>. If you have one and want to do that, see <a class="sectionref enabledlink" data-ref="3">3</a>. Otherwise turn to <a class="sectionref enabledlink" data-ref="2">2</a>.
</div>
</div>
<script>
@ -421,8 +421,10 @@ if (this.gamebook) {
</script><div class="section" id="section5">
<span class="sectionnumber" id="para5">5</span>
<div class="sectiontext">
OK. The door is broken, but so is the <span class="drop" data-type="item"
data-what="sword">sword</span>. Turn to <a class="sectionref enabledlink" data-ref="3">3</a>.
You found <span class="found enabledlink"
onclick="gamebook.player.add('item', 'something valuable')"
>something valuable</span>
, but there is no way forward, so you head back to <a class="sectionref enabledlink" data-ref="11">11</a>.
</div>
</div>
<script>
@ -432,13 +434,8 @@ if (this.gamebook) {
</script><div class="section" id="section6">
<span class="sectionnumber" id="para6">6</span>
<div class="sectiontext">
You have reached a t-junction. Here you find a <span class="found enabledlink"
onclick="gamebook.player.add('item', 'key')"
>key</span>
and a <span class="found enabledlink"
onclick="gamebook.player.add('item', 'stick')"
>stick</span>
. You can go west to <a class="sectionref enabledlink" data-ref="4">4</a>, or east to <a class="sectionref enabledlink" data-ref="10">10</a>.
A magic portal ahead will only allow you to pass if you did not pick up the <span class="hasnot" data-type="item"
data-what="cursed bracelet">cursed bracelet</span>, leading you to <a class="sectionref enabledlink" data-ref="5">5</a>. If you have the <span class="has" data-type="item" data-what="cursed bracelet">cursed bracelet</span> you have to go back to <a class="sectionref enabledlink" data-ref="11">11</a> instead. Actually feel free to head back to <a class="sectionref enabledlink" data-ref="11">11</a> either way.
</div>
</div>
<script>
@ -448,8 +445,8 @@ if (this.gamebook) {
</script><div class="section" id="section7">
<span class="sectionnumber" id="para7">7</span>
<div class="sectiontext">
A magic portal ahead will only allow you to pass if you did not pick up the <span class="hasnot" data-type="item"
data-what="cursed bracelet">cursed bracelet</span>, leading you to <a class="sectionref enabledlink" data-ref="11">11</a>. If you have the <span class="has" data-type="item" data-what="cursed bracelet">cursed bracelet</span> you have to go back to <a class="sectionref enabledlink" data-ref="6">6</a> instead. Actually feel free to head back to <a class="sectionref enabledlink" data-ref="6">6</a> either way.
OK <span class="drop" data-type="item"
data-what="stick">stick</span> dropped. Turn back to <a class="sectionref enabledlink" data-ref="11">11</a> to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
</div>
</div>
<script>
@ -459,7 +456,10 @@ if (this.gamebook) {
</script><div class="section" id="section8">
<span class="sectionnumber" id="para8">8</span>
<div class="sectiontext">
Congratulations, you won.
There is a <span class="found enabledlink"
onclick="gamebook.player.add('item', 'cursed bracelet')"
>cursed bracelet</span>
here. You can go on to <a class="sectionref enabledlink" data-ref="6">6</a> or go back to <a class="sectionref enabledlink" data-ref="11">11</a>. You can also drop the <span class="has" data-type="item" data-what="stick">stick</span> for no particular reason if you have it, see <a class="sectionref enabledlink" data-ref="7">7</a>.
</div>
</div>
<script>
@ -469,8 +469,8 @@ if (this.gamebook) {
</script><div class="section" id="section9">
<span class="sectionnumber" id="para9">9</span>
<div class="sectiontext">
OK <span class="drop" data-type="item"
data-what="stick">stick</span> dropped. Turn back to <a class="sectionref enabledlink" data-ref="6">6</a> to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
OK. The door is broken, but so is the <span class="drop" data-type="item"
data-what="sword">sword</span>. Turn to <a class="sectionref enabledlink" data-ref="4">4</a>.
</div>
</div>
<script>
@ -480,10 +480,7 @@ if (this.gamebook) {
</script><div class="section" id="section10">
<span class="sectionnumber" id="para10">10</span>
<div class="sectiontext">
There is a <span class="found enabledlink"
onclick="gamebook.player.add('item', 'cursed bracelet')"
>cursed bracelet</span>
here. You can go on to <a class="sectionref enabledlink" data-ref="7">7</a> or go back to <a class="sectionref enabledlink" data-ref="6">6</a>. You can also drop the <span class="has" data-type="item" data-what="stick">stick</span> for no particular reason if you have it, see <a class="sectionref enabledlink" data-ref="9">9</a>.
There is a locked door here. If you have a <span class="has" data-type="item" data-what="key">key</span> you can use that to open the door, see <a class="sectionref enabledlink" data-ref="4">4</a>. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the <span class="has" data-type="item" data-what="sword">sword</span>, if you have it, see <a class="sectionref enabledlink" data-ref="9">9</a>. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see <a class="sectionref enabledlink" data-ref="11">11</a>.
</div>
</div>
<script>
@ -493,10 +490,13 @@ if (this.gamebook) {
</script><div class="section" id="section11">
<span class="sectionnumber" id="para11">11</span>
<div class="sectiontext">
You found <span class="found enabledlink"
onclick="gamebook.player.add('item', 'something valuable')"
>something valuable</span>
, but there is no way forward, so you head back to <a class="sectionref enabledlink" data-ref="6">6</a>.
You have reached a t-junction. Here you find a <span class="found enabledlink"
onclick="gamebook.player.add('item', 'key')"
>key</span>
and a <span class="found enabledlink"
onclick="gamebook.player.add('item', 'stick')"
>stick</span>
. You can go west to <a class="sectionref enabledlink" data-ref="10">10</a>, or east to <a class="sectionref enabledlink" data-ref="8">8</a>.
</div>
</div>
<script>

View file

@ -14,91 +14,91 @@
\
\b \qc 1
\b0\
\ql Demonstrating how to manage player Inventory. You start the book carrying a sword and a shield. Turn to \b 6
\ql Demonstrating how to manage player Inventory. You start the book carrying a sword and a shield. Turn to \b 11
\b0
. \
\
\b \qc 2
\b0\
\ql OK. That was fun. Turn to \b 8
\b0
. \
\ql Congratulations, you won. \
\
\b \qc 3
\b0\
\ql There is a rope here that can be cut using a sword. If you have one and want to do that, see \b 2
\b0
. Otherwise turn to \b 8
\ql OK. That was fun. Turn to \b 2
\b0
. \
\
\b \qc 4
\b0\
\ql There is a locked door here. If you have a key you can use that to open the door, see \b 3
\ql There is a rope here that can be cut using a sword. If you have one and want to do that, see \b 3
\b0
. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the sword, if you have it, see \b 5
\b0
. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see \b 6
. Otherwise turn to \b 2
\b0
. \
\
\b \qc 5
\b0\
\ql OK. The door is broken, but so is the sword. Turn to \b 3
\ql You found something valuable, but there is no way forward, so you head back to \b 11
\b0
. \
\
\b \qc 6
\b0\
\ql You have reached a t-junction. Here you find a key and a stick. You can go west to \b 4
\ql A magic portal ahead will only allow you to pass if you did not pick up the cursed bracelet, leading you to \b 5
\b0
, or east to \b 10
. If you have the cursed bracelet you have to go back to \b 11
\b0
. \
\
\b \qc 7
\b0\
\ql A magic portal ahead will only allow you to pass if you did not pick up the cursed bracelet, leading you to \b 11
\b0
. If you have the cursed bracelet you have to go back to \b 6
\b0
instead. Actually feel free to head back to \b 6
instead. Actually feel free to head back to \b 11
\b0
either way. \
\
\b \qc 8
\b \qc 7
\b0\
\ql Congratulations, you won. \
\
\b \qc 9
\b0\
\ql OK stick dropped. Turn back to \b 6
\ql OK stick dropped. Turn back to \b 11
\b0
to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there). \
\
\b \qc 8
\b0\
\ql There is a cursed bracelet here. You can go on to \b 6
\b0
or go back to \b 11
\b0
. You can also drop the stick for no particular reason if you have it, see \b 7
\b0
. \
\
\b \qc 9
\b0\
\ql OK. The door is broken, but so is the sword. Turn to \b 4
\b0
. \
\
\b \qc 10
\b0\
\ql There is a cursed bracelet here. You can go on to \b 7
\ql There is a locked door here. If you have a key you can use that to open the door, see \b 4
\b0
or go back to \b 6
. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the sword, if you have it, see \b 9
\b0
. You can also drop the stick for no particular reason if you have it, see \b 9
. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see \b 11
\b0
. \
\
\b \qc 11
\b0\
\ql You found something valuable, but there is no way forward, so you head back to \b 6
\ql You have reached a t-junction. Here you find a key and a stick. You can go west to \b 10
\b0
, or east to \b 8
\b0
. \
\

View file

@ -42,7 +42,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{1} \end{center}}
\noindent
Demonstrating how to manage player Inventory. You start the book carrying a \textbf{sword} and a \textbf{shield}. Turn to \textbf{\autoref{section6}}.
Demonstrating how to manage player Inventory. You start the book carrying a \textbf{sword} and a \textbf{shield}. Turn to \textbf{\autoref{section11}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -50,7 +50,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{2} \end{center}}
\noindent
OK. That was fun. Turn to \textbf{\autoref{section8}}.
Congratulations, you won.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -58,7 +58,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{3} \end{center}}
\noindent
There is a rope here that can be cut using a \textit{sword}. If you have one and want to do that, see \textbf{\autoref{section2}}. Otherwise turn to \textbf{\autoref{section8}}.
OK. That was fun. Turn to \textbf{\autoref{section2}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -66,7 +66,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{4} \end{center}}
\noindent
There is a locked door here. If you have a \textit{key} you can use that to open the door, see \textbf{\autoref{section3}}. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the \textit{sword}, if you have it, see \textbf{\autoref{section5}}. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see \textbf{\autoref{section6}}.
There is a rope here that can be cut using a \textit{sword}. If you have one and want to do that, see \textbf{\autoref{section3}}. Otherwise turn to \textbf{\autoref{section2}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -74,8 +74,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{5} \end{center}}
\noindent
OK. The door is broken, but so is the \textit{sword}
. Turn to \textbf{\autoref{section3}}.
You found \textbf{something valuable}, but there is no way forward, so you head back to \textbf{\autoref{section11}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -83,7 +82,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{6} \end{center}}
\noindent
You have reached a t-junction. Here you find a \textbf{key} and a \textbf{stick}. You can go west to \textbf{\autoref{section4}}, or east to \textbf{\autoref{section10}}.
A magic portal ahead will only allow you to pass if you did not pick up the \textit{cursed bracelet}, leading you to \textbf{\autoref{section5}}. If you have the \textit{cursed bracelet} you have to go back to \textbf{\autoref{section11}} instead. Actually feel free to head back to \textbf{\autoref{section11}} either way.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -91,7 +90,8 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{7} \end{center}}
\noindent
A magic portal ahead will only allow you to pass if you did not pick up the \textit{cursed bracelet}, leading you to \textbf{\autoref{section11}}. If you have the \textit{cursed bracelet} you have to go back to \textbf{\autoref{section6}} instead. Actually feel free to head back to \textbf{\autoref{section6}} either way.
OK \textit{stick}
dropped. Turn back to \textbf{\autoref{section11}} to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -99,7 +99,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{8} \end{center}}
\noindent
Congratulations, you won.
There is a \textbf{cursed bracelet} here. You can go on to \textbf{\autoref{section6}} or go back to \textbf{\autoref{section11}}. You can also drop the \textit{stick} for no particular reason if you have it, see \textbf{\autoref{section7}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -107,8 +107,8 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{9} \end{center}}
\noindent
OK \textit{stick}
dropped. Turn back to \textbf{\autoref{section6}} to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
OK. The door is broken, but so is the \textit{sword}
. Turn to \textbf{\autoref{section4}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -116,7 +116,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{10} \end{center}}
\noindent
There is a \textbf{cursed bracelet} here. You can go on to \textbf{\autoref{section7}} or go back to \textbf{\autoref{section6}}. You can also drop the \textit{stick} for no particular reason if you have it, see \textbf{\autoref{section9}}.
There is a locked door here. If you have a \textit{key} you can use that to open the door, see \textbf{\autoref{section4}}. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the \textit{sword}, if you have it, see \textbf{\autoref{section9}}. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see \textbf{\autoref{section11}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -124,6 +124,6 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{11} \end{center}}
\noindent
You found \textbf{something valuable}, but there is no way forward, so you head back to \textbf{\autoref{section6}}.
You have reached a t-junction. Here you find a \textbf{key} and a \textbf{stick}. You can go west to \textbf{\autoref{section10}}, or east to \textbf{\autoref{section8}}.
\vspace{1em}
\end{document}

View file

@ -4,35 +4,35 @@
Turn to 1 to begin.
1
Demonstrating how to manage player Inventory. You start the book carrying a sword and a shield. Turn to 6.
Demonstrating how to manage player Inventory. You start the book carrying a sword and a shield. Turn to 11.
2
OK. That was fun. Turn to 8.
3
There is a rope here that can be cut using a sword. If you have one and want to do that, see 2. Otherwise turn to 8.
4
There is a locked door here. If you have a key you can use that to open the door, see 3. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the sword, if you have it, see 5. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see 6.
5
OK. The door is broken, but so is the sword. Turn to 3.
6
You have reached a t-junction. Here you find a key and a stick. You can go west to 4, or east to 10.
7
A magic portal ahead will only allow you to pass if you did not pick up the cursed bracelet, leading you to 11. If you have the cursed bracelet you have to go back to 6 instead. Actually feel free to head back to 6 either way.
8
Congratulations, you won.
3
OK. That was fun. Turn to 2.
4
There is a rope here that can be cut using a sword. If you have one and want to do that, see 3. Otherwise turn to 2.
5
You found something valuable, but there is no way forward, so you head back to 11.
6
A magic portal ahead will only allow you to pass if you did not pick up the cursed bracelet, leading you to 5. If you have the cursed bracelet you have to go back to 11 instead. Actually feel free to head back to 11 either way.
7
OK stick dropped. Turn back to 11 to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
8
There is a cursed bracelet here. You can go on to 6 or go back to 11. You can also drop the stick for no particular reason if you have it, see 7.
9
OK stick dropped. Turn back to 6 to confirm stick can not be picked up again even if the text says it is there (books work that way, although ideally this dynamic version should provide some hints that it is no longer there).
OK. The door is broken, but so is the sword. Turn to 4.
10
There is a cursed bracelet here. You can go on to 7 or go back to 6. You can also drop the stick for no particular reason if you have it, see 9.
There is a locked door here. If you have a key you can use that to open the door, see 4. Being right before the link should be enough for the formatter to figure out that the key is required to be allowed to follow the link. Else you can try to open with the sword, if you have it, see 9. Hopefully the magic is good enough to pair pre-conditions to links, or more markup must be added later. You could also try to go back to pick up the key, see 11.
11
You found something valuable, but there is no way forward, so you head back to 6.
You have reached a t-junction. Here you find a key and a stick. You can go west to 10, or east to 8.

View file

@ -2,12 +2,12 @@ BEGIN DEBUG OUTPUT
Book title: Gamebook
Number of sections: 400
Introduction
-1 (Introduction) - This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at 1 or the next section at 231.
-1 (Introduction) - This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at 1 or the next section at 400.
Turn to 1 to begin.
1 (start) - This is where the adventure begins. You can go on to the next section, see 231 or try the random selection feature at 208.
1 (start) - This is where the adventure begins. You can go on to the next section, see 400 or try the random selection feature at 399.
2 () - (EMPTY)
3 () - (EMPTY)
4 () - (EMPTY)
@ -199,7 +199,7 @@ Turn to 1 to begin.
190 () - (EMPTY)
191 () - (EMPTY)
192 () - (EMPTY)
193 (altend) - Alternative ending.
193 () - (EMPTY)
194 () - (EMPTY)
195 () - (EMPTY)
196 () - (EMPTY)
@ -214,7 +214,7 @@ Turn to 1 to begin.
205 () - (EMPTY)
206 () - (EMPTY)
207 () - (EMPTY)
208 (random) - [RANDOM]Pick a destination at random[/RANDOM] from 231 or 336 or 193.
208 () - (EMPTY)
209 () - (EMPTY)
210 () - (EMPTY)
211 () - (EMPTY)
@ -237,7 +237,7 @@ Turn to 1 to begin.
228 () - (EMPTY)
229 () - (EMPTY)
230 () - (EMPTY)
231 (next) - This is the next section. Go on to the end at 336.
231 () - (EMPTY)
232 () - (EMPTY)
233 () - (EMPTY)
234 () - (EMPTY)
@ -342,7 +342,7 @@ Turn to 1 to begin.
333 () - (EMPTY)
334 () - (EMPTY)
335 () - (EMPTY)
336 (end) - The end.
336 () - (EMPTY)
337 () - (EMPTY)
338 () - (EMPTY)
339 () - (EMPTY)
@ -403,8 +403,8 @@ Turn to 1 to begin.
394 () - (EMPTY)
395 () - (EMPTY)
396 () - (EMPTY)
397 () - (EMPTY)
398 () - (EMPTY)
399 () - (EMPTY)
400 () - (EMPTY)
397 (end) - The end.
398 (altend) - Alternative ending.
399 (random) - [RANDOM]Pick a destination at random[/RANDOM] from 400 or 397 or 398.
400 (next) - This is the next section. Go on to the end at 397.
END DEBUG OUTPUT

View file

@ -1,12 +1,12 @@
digraph gamebook {
1->231
1->399
1->208
208->231
1->400
399->397
208->336
399->400
208->193
231->336
399->398
400->397
}

View file

@ -367,7 +367,7 @@ if (typeof exports !== 'undefined') {
<div class="section" id="section-1">
<span class="sectionnumber" id="para-1">-1</span>
<div class="sectiontext">
This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at <a class="sectionref enabledlink" data-ref="1">1</a> or the next section at <a class="sectionref enabledlink" data-ref="231">231</a>.
This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at <a class="sectionref enabledlink" data-ref="1">1</a> or the next section at <a class="sectionref enabledlink" data-ref="400">400</a>.
</div>
</div>
<script>
@ -394,52 +394,52 @@ if (this.gamebook) {
<div class="section" id="section1">
<span class="sectionnumber" id="para1">1</span>
<div class="sectiontext">
This is where the adventure begins. You can go on to the next section, see <a class="sectionref enabledlink" data-ref="231">231</a> or try the random selection feature at <a class="sectionref enabledlink" data-ref="208">208</a>.
This is where the adventure begins. You can go on to the next section, see <a class="sectionref enabledlink" data-ref="400">400</a> or try the random selection feature at <a class="sectionref enabledlink" data-ref="399">399</a>.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(1, document.getElementById('section1'));
}
</script><div class="section" id="section193">
<span class="sectionnumber" id="para193">193</span>
<div class="sectiontext">
Alternative ending.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(193, document.getElementById('section193'));
}
</script><div class="section" id="section208">
<span class="sectionnumber" id="para208">208</span>
<div class="sectiontext">
<span class="random enabledlink">Pick a destination at random</span> from <a class="sectionref enabledlink" data-ref="231">231</a> or <a class="sectionref enabledlink" data-ref="336">336</a> or <a class="sectionref enabledlink" data-ref="193">193</a>.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(208, document.getElementById('section208'));
}
</script><div class="section" id="section231">
<span class="sectionnumber" id="para231">231</span>
<div class="sectiontext">
This is the next section. Go on to the end at <a class="sectionref enabledlink" data-ref="336">336</a>.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(231, document.getElementById('section231'));
}
</script><div class="section" id="section336">
<span class="sectionnumber" id="para336">336</span>
</script><div class="section" id="section397">
<span class="sectionnumber" id="para397">397</span>
<div class="sectiontext">
The end.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(336, document.getElementById('section336'));
gamebook.addSection(397, document.getElementById('section397'));
}
</script><div class="section" id="section398">
<span class="sectionnumber" id="para398">398</span>
<div class="sectiontext">
Alternative ending.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(398, document.getElementById('section398'));
}
</script><div class="section" id="section399">
<span class="sectionnumber" id="para399">399</span>
<div class="sectiontext">
<span class="random enabledlink">Pick a destination at random</span> from <a class="sectionref enabledlink" data-ref="400">400</a> or <a class="sectionref enabledlink" data-ref="397">397</a> or <a class="sectionref enabledlink" data-ref="398">398</a>.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(399, document.getElementById('section399'));
}
</script><div class="section" id="section400">
<span class="sectionnumber" id="para400">400</span>
<div class="sectiontext">
This is the next section. Go on to the end at <a class="sectionref enabledlink" data-ref="397">397</a>.
</div>
</div>
<script>
if (this.gamebook) {
gamebook.addSection(400, document.getElementById('section400'));
}
</script> <div id="collections" class="collections">
</div>

View file

@ -17,7 +17,7 @@
\b0\
\ql This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at \b 1
\b0
or the next section at \b 231
or the next section at \b 400
\b0
. \
\
@ -30,39 +30,39 @@
\
\b \qc 1
\b0\
\ql This is where the adventure begins. You can go on to the next section, see \b 231
\ql This is where the adventure begins. You can go on to the next section, see \b 400
\b0
or try the random selection feature at \b 208
or try the random selection feature at \b 399
\b0
. \
\
\b \qc 193
\b0\
\ql Alternative ending. \
\
\b \qc 208
\b0\
\ql Pick a destination at random from \b 231
\b0
or \b 336
\b0
or \b 193
\b0
. \
\
\b \qc 231
\b0\
\ql This is the next section. Go on to the end at \b 336
\b0
. \
\
\b \qc 336
\b \qc 397
\b0\
\ql The end. \
\
\b \qc 398
\b0\
\ql Alternative ending. \
\
\b \qc 399
\b0\
\ql Pick a destination at random from \b 400
\b0
or \b 397
\b0
or \b 398
\b0
. \
\
\b \qc 400
\b0\
\ql This is the next section. Go on to the end at \b 397
\b0
. \
\
}

View file

@ -43,7 +43,7 @@
\subsection*{\begin{center} \textbf{-1} \end{center}}
\noindent
This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at \textbf{\autoref{section1}} or the next section at \textbf{\autoref{section231}}.
This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at \textbf{\autoref{section1}} or the next section at \textbf{\autoref{section400}}.
\vspace{1em}
\vspace{1em}
@ -56,7 +56,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{1} \end{center}}
\noindent
This is where the adventure begins. You can go on to the next section, see \textbf{\autoref{section231}} or try the random selection feature at \textbf{\autoref{section208}}.
This is where the adventure begins. You can go on to the next section, see \textbf{\autoref{section400}} or try the random selection feature at \textbf{\autoref{section399}}.
\vspace{1em}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
@ -249,240 +249,240 @@ Turn to 1 to begin.
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\phantomsection
\refstepcounter{sectionnr}
\label{section193}
\subsection*{\begin{center} \textbf{193} \end{center}}
\noindent
Alternative ending.
\vspace{1em}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\phantomsection
\refstepcounter{sectionnr}
\label{section208}
\subsection*{\begin{center} \textbf{208} \end{center}}
\noindent
Pick a destination at random from \textbf{\autoref{section231}} or \textbf{\autoref{section336}} or \textbf{\autoref{section193}}.
\vspace{1em}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\phantomsection
\refstepcounter{sectionnr}
\label{section231}
\subsection*{\begin{center} \textbf{231} \end{center}}
\noindent
This is the next section. Go on to the end at \textbf{\autoref{section336}}.
\vspace{1em}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\phantomsection
\refstepcounter{sectionnr}
\label{section336}
\subsection*{\begin{center} \textbf{336} \end{center}}
\label{section397}
\subsection*{\begin{center} \textbf{397} \end{center}}
\noindent
The end.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
\label{section398}
\subsection*{\begin{center} \textbf{398} \end{center}}
\noindent
Alternative ending.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
\label{section399}
\subsection*{\begin{center} \textbf{399} \end{center}}
\noindent
Pick a destination at random from \textbf{\autoref{section400}} or \textbf{\autoref{section397}} or \textbf{\autoref{section398}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\refstepcounter{sectionnr}
\label{section400}
\subsection*{\begin{center} \textbf{400} \end{center}}
\noindent
This is the next section. Go on to the end at \textbf{\autoref{section397}}.
\vspace{1em}
\end{document}

View file

@ -2,7 +2,7 @@
Introduction
-1
This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at 1 or the next section at 231.
This gamebook demonstrates simple references between sections. Also notice that an intro section like this one can reference sections, like the start at 1 or the next section at 400.
@ -10,17 +10,17 @@ Introduction
Turn to 1 to begin.
1
This is where the adventure begins. You can go on to the next section, see 231 or try the random selection feature at 208.
This is where the adventure begins. You can go on to the next section, see 400 or try the random selection feature at 399.
193
Alternative ending.
208
Pick a destination at random from 231 or 336 or 193.
231
This is the next section. Go on to the end at 336.
336
397
The end.
398
Alternative ending.
399
Pick a destination at random from 400 or 397 or 398.
400
This is the next section. Go on to the end at 397.

View file

@ -4,9 +4,9 @@ Number of sections: 5
Turn to 1 to begin.
1 (start) - It starts here. You can get to 4.
1 (start) - It starts here. You can get to 5.
2 (seconddummy) - Another fake section that is also ignored.
3 (nothereeither) - You can not get here either, but because it is tagged as fake there will be no warning generated.
4 (here) - You can get here. Congratulations!
5 (nothere) - You can not get here. Verification should warn you about that, if enabled (with the --verify option).
4 (nothere) - You can not get here. Verification should warn you about that, if enabled (with the --verify option).
5 (here) - You can get here. Congratulations!
END DEBUG OUTPUT

View file

@ -1,4 +1,4 @@
digraph gamebook {
1->4
1->5
}

View file

@ -378,7 +378,7 @@ if (typeof exports !== 'undefined') {
<div class="section" id="section1">
<span class="sectionnumber" id="para1">1</span>
<div class="sectiontext">
It starts here. You can get to <a class="sectionref enabledlink" data-ref="4">4</a>.
It starts here. You can get to <a class="sectionref enabledlink" data-ref="5">5</a>.
</div>
</div>
<script>
@ -408,7 +408,7 @@ if (this.gamebook) {
</script><div class="section" id="section4">
<span class="sectionnumber" id="para4">4</span>
<div class="sectiontext">
You can get here. Congratulations!
You can not get here. Verification should warn you about that, if enabled (with the --verify option).
</div>
</div>
<script>
@ -418,7 +418,7 @@ if (this.gamebook) {
</script><div class="section" id="section5">
<span class="sectionnumber" id="para5">5</span>
<div class="sectiontext">
You can not get here. Verification should warn you about that, if enabled (with the --verify option).
You can get here. Congratulations!
</div>
</div>
<script>

View file

@ -14,7 +14,7 @@
\
\b \qc 1
\b0\
\ql It starts here. You can get to \b 4
\ql It starts here. You can get to \b 5
\b0
. \
\
@ -31,12 +31,12 @@
\b \qc 4
\b0\
\ql You can get here. Congratulations! \
\ql You can not get here. Verification should warn you about that, if enabled (with the --verify option). \
\
\b \qc 5
\b0\
\ql You can not get here. Verification should warn you about that, if enabled (with the --verify option). \
\ql You can get here. Congratulations! \
\
}

View file

@ -42,7 +42,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{1} \end{center}}
\noindent
It starts here. You can get to \textbf{\autoref{section4}}.
It starts here. You can get to \textbf{\autoref{section5}}.
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -66,7 +66,7 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{4} \end{center}}
\noindent
You can get here. Congratulations!
You can not get here. Verification should warn you about that, if enabled (with the --verify option).
\vspace{1em}
\phantomsection
\refstepcounter{sectionnr}
@ -74,6 +74,6 @@ Turn to 1 to begin.
\subsection*{\begin{center} \textbf{5} \end{center}}
\noindent
You can not get here. Verification should warn you about that, if enabled (with the --verify option).
You can get here. Congratulations!
\vspace{1em}
\end{document}

View file

@ -4,7 +4,7 @@
Turn to 1 to begin.
1
It starts here. You can get to 4.
It starts here. You can get to 5.
2
Another fake section that is also ignored.
@ -13,8 +13,8 @@ Turn to 1 to begin.
You can not get here either, but because it is tagged as fake there will be no warning generated.
4
You can get here. Congratulations!
5
You can not get here. Verification should warn you about that, if enabled (with the --verify option).
5
You can get here. Congratulations!

View file

@ -69,7 +69,7 @@ def format_gamebook(inputfilenames,
import_default_map_file,
templatedirs,
verify,
seed):
shuffle):
output_format = make_output(outputfilename, templatedirs)
book = sections.Book()
for inputfilename in inputfilenames:
@ -78,7 +78,7 @@ def format_gamebook(inputfilenames,
import_default_nr_map(outputfilename, book)
if verify:
verifygamebook.verify(book)
write_book(book, seed, output_format, outputfilename)
write_book(book, shuffle, output_format, outputfilename)
def parse_file_to_book(inputfile, book):
before_first_section = True
@ -147,8 +147,8 @@ def make_output(outputfilename, templatedirs):
raise Exception("Unsupported or unknown output format for %s."
% outputfilename)
def write_book(book, seed, output_format, outputfilename):
shuffled_sections = book.shuffle(seed)
def write_book(book, shuffle, output_format, outputfilename):
shuffled_sections = book.shuffle(shuffle)
output = open(outputfilename, 'w')
print >> output, output_format.format_begin(book.config),
print >> output, output_format.format_intro_sections(book.introsections,
@ -190,9 +190,9 @@ if __name__ == '__main__':
action='append', help='add custom template dir')
ap.add_argument('-y', '--verify', action='store_true',
help='verify gamebook structure')
ap.add_argument('-r', '--random', action='store', default=None,
metavar='R',
help='random number seed for shuffling sections')
ap.add_argument('-S', '--no-shuffle', action='store_false',
dest='shuffle',
help='do not shuffle sections')
args = ap.parse_args()
templatedirs = ['templates',
os.path.join(os.path.dirname(sys.argv[0]), 'templates')]
@ -204,4 +204,4 @@ if __name__ == '__main__':
args.import_default_map_file,
templatedirs,
args.verify,
args.random)
args.shuffle)

View file

@ -98,7 +98,7 @@ class Book:
if nr > self.config['max']:
self.config['max'] = nr
def shuffle(self, seed=None):
def shuffle(self, reallyshuffle=True):
as_list = [None]
from_nr = {}
shuffled = self.sections[:]
@ -110,8 +110,8 @@ class Book:
for p in self.nr_sections.values():
if p in self.from_name:
shuffled.remove(self.from_name[p])
rnd = random.Random(seed)
rnd.shuffle(shuffled)
if reallyshuffle:
random.shuffle(shuffled)
for nr in range(1, self.config['max'] + 1):
if (self.nr_sections.has_key(nr)
and self.nr_sections[nr] in self.from_name):