<commit_before><!DOCTYPE html>

<!--
   Copyright 2016-2017, <NAME>

   This file is part of Yadrol.

   Yadrol is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   Yadrol is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with Yadrol.  If not, see <http://www.gnu.org/licenses/>.
 -->

<h3>Yadrol Help</h3>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">What is this about?</h4>
	</div>
	<div class="panel-body">
		<p>
		Yadrol simulates dice rolling and presents roll results or
		calculates the distribution of rolling dice many times.
		Yadrol is designed for tabletop role playing games and boardgames
		enthousiasts that want to study existing dice mechanics or
		that want to create new mechanics.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">How does it work?</h4>
	</div>
	<div class="panel-body">
		<p>
		You specify a dice mechanic in the text area above, then Yadrol
		simulates the rolls for you.
		The dice mechanic is written as an expression in a language designed
		to capture the most widely used dice mechanics.
		More on that later.
		</p>
		<p> 
		Yadrol has three simulation modes:
		</p>
		<dl>
			<dt>
				<img height="17ex" src="icons/buttons/dice3.svg">
				&nbsp;Roll
			</dt>
			<dd>
				Yadrol simulates the mechanic once and displays the final
				result on the right.
				The result of an expression is a number.
			</dd>
			<dt>
				<img height="17ex" src="icons/buttons/graph4.svg">
				&nbsp;Sample
			</dt>
			<dd>
				Yadrol simulates the mechanic several times and displays on
				the right a graph that represents the distribution of results.
				By default the simulation is repeated 30,000 times.
			</dd>
			<dt>
				<img height="17ex" src="icons/buttons/dice2.svg">
				&nbsp;Advanced Roll
			</dt>
			<dd>
				This mode works the same way as <em>Roll</em> but it is used
				when the result is not necessarily a number.
			</dd>
		</dl>
		<p>
		<em>Sample</em> is the default mode.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Dice expression basics</h4>
	</div>
	<div class="panel-body">
		<p>
		The core expression to specify a dice is <code>NdX</code>, where <code>N</code>
		is the number of dice to roll, and <code>X</code> is the number of sides
		of each die.
		</p>
		<p>
		For instance <code class="tryit" data-run="true">2d6</code> tells Yadrol to roll two six-sided die.
		</p>
		<p class="well">
		Oh! And by the way, each time you see an expression example, you can click on it to try it on Yadrol.
		</p>
		<p>
		Yadrol can roll any type of dice:
		</p>
		<ul>
			<li>the <code class="tryit" data-run="true">d20</code> used in D&amp;D;</li>
			<li>the <code class="tryit" data-run="true">d100</code> used in BRP;</li>
			<li>the <code class="tryit" data-run="true">d8</code> barely used at all;</li>
			<li>the <code class="tryit" data-run="true">d13</code> that doesn't exist at all, but Yadrol can handle it anyway.</li>
		</ul>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">About the sample output</h4>
	</div>
	<div class="panel-body">
		<p>
		The sample output shows you a graph where the x-axis represent different values obtained by rolling the dice, and the y-axis represent their frequency.
		</p>
		<p>
		By default Yadrol shows the frequency for obtaining <em>at least</em> the value; that is the frequency for obtaining the value <em>or more</em>.
		For instance, if you try rolling <code class="tryit" data-run="true">3d6</code>, the frequency for <em>3 or more</em> is <em>1</em>.
		That makes sense since <em>3</em> is the lowest score you can obtain with 3d6.
		</p>
		<p>
		You can display the curve for <em>exact</em> or <em>at most</em> values with the buttons below the graph.
		</p>
		<p>
		The blue triangle just above the x-axis indicates the weighed mean of the roll.
		You can move this triangle to the <em>mode</em> or the <em>median</em> of the roll with the buttons below the graph.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">About the roll output</h4>
	</div>
	<div class="panel-body">
		<p>
		Blah.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">The dice expression language</h4>
	</div>
	<div class="panel-body">
		<p>
		Yadrol's language for specifying dice rolls is complete, it has been designed to be able to express most of dice mechanics used in table top RPGs and board games.
		The next sections are dedicated to teach you the languages constructs through common mechanics.
		The <a href="XXX">Yadrol language reference</a> is available if you need to know everything about the language.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Select best dice in a roll</h4>
	</div>
	<div class="panel-body">
		<p>
		Roll and keep mechanics can be simulated with the <code>highest</code>/<code>lowest</code> constructs:
		</p>
		<ul>
			<li><code class="tryit" data-run="true">highest of 2d10</code>: rolls two ten-sided dice and keeps the best one.</li>
			<li><code class="tryit" data-run="true">lowest of 2d10</code>: rolls two ten-sided dice and keeps the lowest one.</li>
			<li><code class="tryit" data-run="true">highest 2 of 3d6</code>: rolls three six-sided dice and keeps the two best ones.</li>
			<li><code class="tryit" data-run="true">lowest 2 of 3d6</code>: rolls three six-sided dice and keeps the two best ones.</li>
		</ul>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Count hits in a dice pool</h4>
	</div>
	<div class="panel-body">
		<p>
		<em>Count hits</em> is a type of dice mechanic where one rolls a pool of dice, then counts how many dice shows a result equal or higher than a target value.
		In Yadrol, this can be specified as:
		</p>
		<p>
		<code class="tryit" data-run="true">count (for 6d10 if &gt;= 7)</code>
		</p>
		<p>
		This expression rolls six ten-sided dice and counts how many of them yield seven or more.
		Let's break down this expression and see how it works:
		</p>
		<ul>
		<li>As you already know <code>6d10</code> rolls six ten-sided dice.</li>
		<li>The <code>for</code>-<code>if</code> construct that encloses the dice roll tells Yadrol to apply a condition <em>for each</em> dice.
		The result of the <code>for</code>-<code>if</code> is the set of dice that satisfy the condition.
		In our expression the condition is <code>&gt;= 7</code>, the dice is seven or more.
		</li>
		<li>Finally the <code>count</code> keyword tells Yadrol to count the selected dice.</li>
		</ul>
		<p>
		Now let's count 1s in a pool of six-sided dice:
		</p>
		<p>
		<code class="tryit" data-run="true">count (for 4d6 if == 1)</code>
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Exploding die</h4>
	</div>
	<div class="panel-body">
		<p>
		An exploding die is a die that one rolls again when its result is the highest possible.
		You specify rerolls to Yadrol with the <code>repeat</code> construct:
		</p>
		<p>
		<code class="tryit" data-run="true">repeat d6 if == 6</code>
		</p>
		<p>
		This expression tells Yadrol to roll a six-sided die and repeat the roll <em>if</em> the result is 6.
		If the result of the first die is 6, then the final result of the roll is the sum of both dice.
		</p>
		<p>
		In some games, you keep rerolling while the die shows 6, this is sometimes known as a <em>wild die</em>.
		You can specify it to Yadrol by using the <code>while</code> operator instead of <code>if</code>:
		</p>
		<p>
		<code class="tryit" data-run="true">repeat d6 while == 6</code>
		</p>
		<p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Reroll 1s</h4>
	</div>
	<div class="panel-body">
		<p>
		We will use the very same <code>while</code>-<code>if</code> construct to specify another roll:
		</p>
		<p>
		<code class="tryit" data-run="true">last of (repeat d12 if == 1)</code>
		</p>
		<p>
		As we have seen above, the <code>repeat</code> part will roll a twelve-sided die and roll it again if the result is 1.
		The <code>last of</code> operator tells that we are only interested in the last die rolled.
		This expression means &quot;<em>roll a d12, reroll 1s</em>&quot;.
		</p>
		<p>
		It's starting to get complicated, let's take a break with some other aspects of Yadrol.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Fudge dice</h4>
	</div>
	<div class="panel-body">
		<p>
		Fudge dice are custom six-sided dice used in games like <a href="XXX">Fudge</a> and <a href="XXX">FATE</a>.
		Two sides are marked with a plus sign, two other sides with a minus sign, and the two remaining sides are blank.
		The player usually rolls four dice, count the plus signs and substracts the minus signs.
		</p>
		<p>
		One way to specify this to Yadrol is <code class="tryit" data-run="true">4d[-1, -1, 0, 0, 1, 1]</code>
		</p>
		<p>
		In Yadrol terms, <code>[-1, -1, 0, 0, 1, 1]</code> denotes a collection of values called an <em>array</em>.
		We have filled this array with two <code>-1</code> that represent the sides with a minus sign, two <code>1</code> that represent the sides with a plus sign, and two <code>0</code> that represent blank sides.
		For Yadrol, rolling an array die means randomly picking one element in the array, that is the why the above expression simulates the roll of four Fudge dice.
		</p>
		<p class="well">
		It has not escaped to the statistics-minded people that a Fudge die could be simulated with a shorter array with the same effect.
		Try: <code class="tryit" data-run="true">4d[-1, 0, 1]</code>.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Barbarians of Lemuria combat turn</h4>
	</div>
	<div class="panel-body">
		<p>
		In the excellent Sword &amp; Sorcery game <a href="XXX">Barbarians of Lemuria</a> (BoL), players play sword-to-hire barbarian in search of fortune.
		In the general mechanics of BoL, players roll 2d6 and must beat 9 to succeed.
		During a combat turn, the character's blow is resolved this way.
		If the attack succeeds, then the opponent loses Hit Points depending on the weapon.
		</p>
		<p>
		In this section we will simulate an attack and plot the damage inflicted.
		We will assume the character is using a sword which makes d6 + 1 damage:
		</p>
		<p>
		<code class="tryit" data-run="true">if 2d6 &gt;= 9 then d6 + 1 else 0</code>
		</p>
		<p>
		We introduced here the <code>if</code>-<code>then</code>-<code>else</code> construct.
		Inside the <code>if</code> part, Yadrol rolls 2d6 and tests either the result is 9 or more.
		If the condition is satisfied (the attack is a success), then Yadrol evaluates the <code>then</code> part that simulates the damage of a sword: <code>d6 + 1</code>.
		If the condition is not satisfied (the attack is a failure), then Yadrol evaluates the <code>else</code> part that simulates no damage at all: <code>0</code>.
		</p>
		<p>
		Now BoL is a bit more versatile.
		Players also benefit from a bonus on their roll depending on their character's <em>Melee</em> ability.
		They also suffer a penalty from their opponent's <em>Defense</em> ability.
		The target number is still 9, so assuming a Melee of 2 and an opponent's Defense of 1: 
		</p>
		<p>
		<code class="tryit" data-run="true">if 2d6 + 2 - 1 &gt;= 9 then d6 + 1 else 0</code>
		</p>
		<p>
		This is nice but if we need to simulate attacks for characters and opponents we have to change the values in the expression.
		Let's write this in another way that makes it easier:
		</p>
		<p>
		<code class="tryit" data-run="true">Melee = 2;&#13;
Defense = 1;&#13;
if 2d6 + Melee - Defense &gt;= 9 then d6 + 1 else 0
		</code>
		</p>
		<p>
		There are several new notions here.
		First we specified several expressions separated with semicolons (<code>;</code>).
		Yadrol evaluates each one in sequence in the same order.
		Then, in the two first expressions, values are assigned to variables with the equal (<code>=</code>) sign.
		Variable names are at your discretion as long as they do not match Yadrol language reserved words, like <code>highest</code>, <code>lowest</code>, <code>for</code>, <code>repeat</code>, <code>if</code>, <code>then</code>, <code>else</code>, etc.
		Keep in mind that the single letter dee (<code>d</code>) is a reserved word.
		The expression on the right of the equal sign is evaluated, and the result is stored in the variable.
		In this case the expressions are simple constants.
		</p>
		<p>
		With this version of the attack simulation, we just have to change the values of the variables.
		But wait, there's more.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Barbarians of Lemuria combat turn, where we learn about functions</h4>
	</div>
	<div class="panel-body">
		<p>
		In the previous section we have facilitated the reuse of an expression using a sequence of expressions and variable assignments.
		We can go one step further and gather all this in a <em>function</em>:
		</p>
		<p>
		<code>Attack = fun(Melee, Defense) {
		};
		</code>
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Multiple graphs</h4>
	</div>
	<div class="panel-body">
		<p>
		Yadrol allows to compare several roll mechanisms on the same graphs.
		The <code>sample</code> keyword tells Yadroll to add a distribution in the graph.
		For instance <code class="tryit" data-run="true">sample d20</code> tells Yadrol to add to the graph the distribution of one twenty-sided die.
		This is no different than <code class="tryit" data-run="true">d20</code> because by default Yadrol samples the specified expression.
		</p>
		<p>
		Now we can compare two rolls by writing two <code>sample</code> expressions:
		</p>
		<p>
		<code class="tryit" data-run="true">sample d20; sample 3d6</code>
		</p>
	</div>
</div>


<!-- 

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title"></h4>
	</div>
	<div class="panel-body">
		<p>
		</p><commit_msg>removed stuff found on Recipes<commit_after><!DOCTYPE html>

<!--
   Copyright 2016-2017, <NAME>

   This file is part of Yadrol.

   Yadrol is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   Yadrol is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with Yadrol.  If not, see <http://www.gnu.org/licenses/>.
 -->

<h3>Yadrol Help</h3>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">What is this about?</h4>
	</div>
	<div class="panel-body">
		<p>
		Yadrol simulates dice rolling and presents roll results or
		calculates the distribution of rolling dice many times.
		Yadrol is designed for tabletop role playing games and boardgames
		enthousiasts that want to study existing dice mechanics or
		that want to create new mechanics.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">How does it work?</h4>
	</div>
	<div class="panel-body">
		<p>
		You specify a dice mechanic in the text area above, then Yadrol
		simulates the rolls for you.
		The dice mechanic is written as an expression in a language designed
		to capture the most widely used dice mechanics.
		More on that later.
		</p>
		<p> 
		Yadrol has three simulation modes:
		</p>
		<dl>
			<dt>
				<img height="17ex" src="icons/buttons/dice3.svg">
				&nbsp;Roll
			</dt>
			<dd>
				Yadrol simulates the mechanic once and displays the final
				result on the right.
				The result of an expression is a number.
			</dd>
			<dt>
				<img height="17ex" src="icons/buttons/graph4.svg">
				&nbsp;Sample
			</dt>
			<dd>
				Yadrol simulates the mechanic several times and displays on
				the right a graph that represents the distribution of results.
				By default the simulation is repeated 30,000 times.
			</dd>
			<dt>
				<img height="17ex" src="icons/buttons/dice2.svg">
				&nbsp;Advanced Roll
			</dt>
			<dd>
				This mode works the same way as <em>Roll</em> but it is used
				when the result is not necessarily a number.
			</dd>
		</dl>
		<p>
		<em>Sample</em> is the default mode.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Dice expression basics</h4>
	</div>
	<div class="panel-body">
		<p>
		The core expression to specify a dice is <code>NdX</code>, where <code>N</code>
		is the number of dice to roll, and <code>X</code> is the number of sides
		of each die.
		</p>
		<p>
		For instance <code class="tryit" data-run="true">2d6</code> tells Yadrol to roll two six-sided die.
		</p>
		<p class="well">
		Oh! And by the way, each time you see an expression example, you can click on it to try it on Yadrol.
		</p>
		<p>
		Yadrol can roll any type of dice:
		</p>
		<ul>
			<li>the <code class="tryit" data-run="true">d20</code> used in D&amp;D;</li>
			<li>the <code class="tryit" data-run="true">d100</code> used in BRP;</li>
			<li>the <code class="tryit" data-run="true">d8</code> barely used at all;</li>
			<li>the <code class="tryit" data-run="true">d13</code> that doesn't exist at all, but Yadrol rolls dice in hyperspace.</li>
		</ul>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">About the sample output</h4>
	</div>
	<div class="panel-body">
		<p>
		The sample output shows you a graph where the x-axis represent different values obtained by rolling the dice, and the y-axis represent their frequency.
		</p>
		<p>
		By default Yadrol shows the frequency for obtaining <em>at least</em> the value; that is the frequency for obtaining the value <em>or more</em>.
		For instance, if you try rolling <code class="tryit" data-run="true">3d6</code>, the frequency for <em>3 or more</em> is <em>1</em>.
		That makes sense since <em>3</em> is the lowest score you can obtain with 3d6.
		</p>
		<p>
		You can display the curve for <em>exact</em> or <em>at most</em> values with the buttons below the graph.
		</p>
		<p>
		The blue triangle just above the x-axis indicates the weighed mean of the roll.
		You can move this triangle to the <em>mode</em> or the <em>median</em> of the roll with the buttons below the graph.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">About the roll output</h4>
	</div>
	<div class="panel-body">
		<p>
		Blah.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">The dice expression language</h4>
	</div>
	<div class="panel-body">
		<p>
		Yadrol's language for specifying dice rolls is complete, it has been designed to be able to express most of dice mechanics used in table top RPGs and board games.
		The next sections are dedicated to teach you the languages constructs through common mechanics.
		The <a href="XXX">Yadrol language reference</a> is available if you need to know everything about the language.
		</p>
	</div>
</div>

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title">Multiple graphs</h4>
	</div>
	<div class="panel-body">
		<p>
		Yadrol allows to compare several roll mechanisms on the same graphs.
		The <code>sample</code> keyword tells Yadroll to add a distribution in the graph.
		For instance <code class="tryit" data-run="true">sample d20</code> tells Yadrol to add to the graph the distribution of one twenty-sided die.
		This is no different than <code class="tryit" data-run="true">d20</code> because by default Yadrol samples the specified expression.
		</p>
		<p>
		Now we can compare two rolls by writing two <code>sample</code> expressions:
		</p>
		<p>
		<code class="tryit" data-run="true">sample d20; sample 3d6</code>
		</p>
	</div>
</div>


<!-- 

<div class="panel panel-primary">
	<div class="panel-heading">
		<h4 class="panel-title"></h4>
	</div>
	<div class="panel-body">
		<p>
		</p>
{'fraction_non_alphanumeric': 0.12691889849322185, 'fraction_numerical': 0.011572433989891833, 'mean_word_length': 3.631809232115511, 'pattern_counts': {'":': 0, '<': 638, '<?xml version=': 0, '>': 636, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5509272', 'n_tokens_mistral': 7663, 'n_tokens_neox': 6941, 'n_words': 2854}