<<run Config.passages.nobr = true>>
<<set $defence = "">>
<<run setup.initGame()>>
<<run State.variables.judgeUnreasonability = 50>>
<<run State.variables.freedVerbs = []>><!-- Judge cooldown between trials -->
<<silently>>
<<set $judgeUnreasonability = Math.max(0, $judgeUnreasonability - 3)>>
<</silently>>
<!-- Generate random elements for this trial -->
<<silently>>
<!-- Pick accused and random words -->
<<set $accused = setup.names.random()>>
<<set _v1 = setup.verbs.random()>>
<<set _v2 = setup.verbs.random()>>
<<set _n1 = setup.nouns.random()>>
<<set _n2 = setup.nouns.random()>>
<<set $mainVerb = _v1>>
<!-- Generate legal boilerplate and date -->
<<set _boiler = setup.randomBoilerplate()>>
<<set _day = random(1, 28)>>
<<set _ord = [1, 21].includes(_day) ? "st" : [2, 22].includes(_day) ? "nd" : [3, 23].includes(_day) ? "rd" : "th">>
<<set _date = "on or about the " + _day + _ord + " day of " + setup.months.random()>>
<<set _statute = "Section " + random(1, 999) + "(" + setup.letters.random() + ")">>
<!-- Randomly assemble the charge from four possible structures -->
<<set _form = random(1, 4)>>
<<if _form is 1>>
<<set $charge = _v1 + " " + _n1 + " while " + _v2>>
<<elseif _form is 2>>
<<set $charge = _v1 + " " + _n1>>
<<elseif _form is 3>>
<<set $charge = _v1>>
<<else>>
<<set $charge = _v1 + " " + _n1 + " while " + _v2 + " " + _n2>>
<</if>>
<!-- Generate the defence option that echoes the charge -->
<<set _defence1 = "My client was " + setup.verbs.random() + ", not " + $charge + ".">>
<</silently>>
<!-- Display the courtroom scene -->
<img src="http://www.eric-kerr.com/images/lawyer.png" width="395" height="480" alt="Lawyer. Credit to Clker-Free-Vector-Images."><br>
<!-- Read the charge -->
THE CLERK: $accused stands accused of, _date, _boiler, $charge, in contravention of _statute of the Random Crimes Act.<br>
<br>
THE CLERK: How does the defence respond?<br>
<br>
<!-- Defence options available to the player -->
<<link `_defence1` "Verdict">><<set $defence = _defence1>><</link>><br>
<<link "The defence rests without comment." "Verdict">><<set $defence = "">><</link>><!-- Initialize variables if not yet set -->
<<silently>>
<<if not $accused>>
<<set $accused = setup.names.random()>>
<</if>>
<<if not $mainVerb>>
<<set $mainVerb = setup.verbs.random()>>
<</if>>
<<if $defence is undefined>>
<<set $defence = "">>
<</if>>
<<if not $judgeUnreasonability>>
<<set $judgeUnreasonability = 50>>
<</if>>
<!-- Determine verdict: 50% guilty, 50% other verdicts -->
<<if random(1, 2) is 1>>
<<set _verdict = "Guilty">>
<<else>>
<<set _otherVerdicts = ["Not guilty", "Not proven", "Nolle prosequi", "Acquitted on a technicality", "Charge found irrelevant", "Case dismissed", "Mistrial", "Retrial ordered", "Guilty of a lesser included offence", "Verdict deferred sine die"]>>
<<set _verdict = _otherVerdicts.random()>>
<</if>>
<!-- Base sentence length -->
<<set _years = random(1, 100)>>
<!-- Calculate judge unreasonability change and sentence multiplier based on defence choice -->
<<if $defence isnot "">>
<!-- Player chose to defend -->
<<if _verdict is "Guilty" or _verdict is "Guilty of a lesser included offence">>
<!-- Defence failed: judge becomes more unreasonable, sentence harsher -->
<<set $judgeUnreasonability = Math.min(100, $judgeUnreasonability + 30)>>
<<set _sentenceMultiplier = 2>>
<<else>>
<!-- Defence succeeded: judge becomes more reasonable, normal sentence -->
<<set $judgeUnreasonability = Math.max(0, $judgeUnreasonability - 15)>>
<<set _sentenceMultiplier = 1>>
<</if>>
<<else>>
<!-- Player chose to rest without comment -->
<<if _verdict is "Guilty" or _verdict is "Guilty of a lesser included offence">>
<!-- Guilty with no defence: judge slightly more reasonable, reduced sentence -->
<<set $judgeUnreasonability = Math.max(0, $judgeUnreasonability - 5)>>
<<set _sentenceMultiplier = 0.6>>
<<else>>
<!-- Not guilty with no defence: judge becomes much more reasonable -->
<<set $judgeUnreasonability = Math.max(0, $judgeUnreasonability - 25)>>
<<set _sentenceMultiplier = 1>>
<</if>>
<</if>>
<!-- Apply sentence multiplier -->
<<set _years = Math.floor(_years * _sentenceMultiplier)>>
<!-- Assign image and verdict text based on verdict type -->
<<switch _verdict>>
<<case "Guilty">>
<<set _img = "miner", _text = "Guilty. " + $accused + " is sentenced to " + _years + " years in the salt mines of linguistics, searching for new verbs.">>
<<case "Not guilty">>
<<set _img = "exit", _text = "Not guilty. " + $accused + " leaves via the exit sign.">>
<<case "Not proven">>
<<set _img = "exit", _text = "Not proven. The Court suspects " + $accused + " did it, but unfortunately cannot prove it.">>
<<case "Nolle prosequi">>
<<set _img = "exit", _text = "Nolle prosequi. The prosecution declines to proceed, chiefly because nobody can understand the charge.">>
<<case "Acquitted on a technicality">>
<<set _img = "exit", _text = "Acquitted on a technicality: the court finds the evidence for " + $mainVerb + " " + setup.nouns.random() + " was inadmissible.">>
<<case "Charge found irrelevant">>
<<set _img = "exit", _text = "The court finds that " + $mainVerb + " is not, in fact, a criminal act.">>
<<case "Case dismissed">>
<<set _img = "exit", _text = "Case dismissed. The court finds that the alleged crime does not exist.">>
<<case "Mistrial">>
<<set _img = "castle", _text = "Mistrial. Three jurors were caught " + setup.verbs.random() + " during deliberations.">>
<<case "Retrial ordered">>
<<set _img = "castle", _text = "A retrial has been ordered for " + random(1, 31) + " days hence.">>
<<case "Guilty of a lesser included offence">>
<<set _img = "miner", _text = "Not guilty of " + $mainVerb + ", but guilty of the lesser included offence of " + setup.verbs.random() + ". Sentenced to " + _years + " months, suspended.">>
<<case "Verdict deferred sine die">>
<<set _img = "castle", _text = "Verdict deferred sine die. The court will rule as soon as the meaning of the charge becomes clear.">>
<</switch>>
<!-- Update trial tracking counters -->
<<if _verdict is "Guilty" or _verdict is "Guilty of a lesser included offence">>
<<run $guiltyCount++>>
<<else>>
<<run $notGuiltyCount++>>
<</if>>
<!-- Add this trial to the docket record -->
<<run $docket.push({name: $accused, verdict: _verdict})>>
<!-- If verdict is innocent, free the verb from future charges -->
<<if setup.innocentVerdicts.includes(_verdict)>>
<<run $freedVerbs.push($mainVerb)>>
<</if>>
<</silently>>
<!-- Display judge's mood based on unreasonability meter -->
<<set _unreasonability = $judgeUnreasonability>>
<<if _unreasonability >= 70>>
**The Lord Ordinary appears ABSURDLY UNREASONABLE** (Unreasonability: $judgeUnreasonability/100). This judge is anything but fair and measured.
<<elseif _unreasonability >= 50>>
**The Lord Ordinary appears CYNICAL** (Unreasonability: $judgeUnreasonability/100). On the balance of probabilities, the judge is unreasonable.
<<elseif _unreasonability >= 30>>
**The Lord Ordinary appears SKEPTICAL** (Unreasonability: $judgeUnreasonability/100). Weighing evidence carefully.
<<else>>
**The Lord Ordinary appears REASONABLE** (Unreasonability: $judgeUnreasonability/100). Fair and measured.
<</if>><br>
<br>
<!-- Display verdict image based on outcome type -->
<<if _img is "miner">>
<img src="http://www.eric-kerr.com/images/miner.png" width="250" height="500" alt="The Salt Mines of Linguistics">
<<elseif _img is "exit">>
<img src="http://www.eric-kerr.com/images/lawyer3.png" width="320" height="640" alt="Lawyer. Credit to OpenClipart-Vectors">
<<else>>
<img src="http://www.eric-kerr.com/images/lawyer2.png" width="333" height="480" alt="Lawyer. Credit to Clker-Free-Vector-Images.">
<</if>><br>
<!-- Acknowledge defence submission if one was made -->
<<if $defence isnot "">>
CLERK: The court has carefully considered counsel's submission that "<i>$defence</i>".<br>
<br>
<</if>>
<!-- Read the verdict -->
LORD ORDINARY: In the matter of the Crown v. $accused, the court rules as follows:<br>
<br>
_text<br>
<!-- Check for win/loss conditions -->
<<if $judgeUnreasonability >= 100>>
[[Game Over - You have lost|Game Over - Loss]]
<<elseif $freedVerbs.length >= 15>>
[[Game Over - You have won|Game Over - Win]]
<<else>>
<!-- Game continues -->
<</if>>
<hr>
<!-- Display cumulative court statistics -->
<strong>Court Record:</strong> Guilty: $guiltyCount | Not Guilty: $notGuiltyCount | Conviction Rate: <<print Math.round(100 * $guiltyCount / ($guiltyCount + $notGuiltyCount)) + "%">> | Judge Unreasonability: $judgeUnreasonability/100 | Freed Verbs: <<print $freedVerbs.length>><br>
<br>
<!-- Navigation options -->
CLERK: Would you like to [[bring in the next accused->Bring in the accused]] or learn more about the <a href="http://www.eric-kerr.com/projects/projects-home.html#game1">random crime generator</a>?<img src="http://www.eric-kerr.com/images/judge.png" width="357" height="640" alt="Lawyer. Credit to Clker-Free-Vector-Images."><br>
Welcome to the Court of Random Crimes. We have a near-infinite number of crimes to accuse people of at our disposal. <br>
<br>Would you like to [[bring in the accused->Bring in the accused]] now or [[learn how to play->How to Play]] first?<<goto "Verdict">><<goto "Verdict">><h2>The Court of Random Crimes — Closed</h2>
LORD ORDINARY: Enough! This court has seen enough babbling! Henceforth, I declare ALL defendants GUILTY, regardless of evidence, testimony or the law itself! Justice is a word.<br>
<br>
<strong>Final Record:</strong>
- Guilty verdicts: $guiltyCount
- Acquittals: $notGuiltyCount
- Verbs freed: <<print $freedVerbs.length>>
- Judge Unreasonability: $judgeUnreasonability/100
[[Start Over->Bring in the accused]]<h2>The Court of Random Crimes — Disbanded</h2>
LORD ORDINARY: Enough! You have freed too many verbs from criminal prosecution! We cannot continue under such restrictive linguistics."<br>
<strong>Final Record:</strong>
- Guilty verdicts: $guiltyCount
- Acquittals: $notGuiltyCount
- Verbs liberated: <<print $freedVerbs.length>>
- Judge Unreasonability: $judgeUnreasonability/100
- Conviction Rate: <<print Math.round(100 * $guiltyCount / ($guiltyCount + $notGuiltyCount))>>%
[[Play Again->Bring in the accused]]<img src="http://www.eric-kerr.com/images/judge2.png" width="480" height="258" alt="Judge. Credit to GDJ."><br>
<strong>How to Play:</strong><br><br>
Be careful, the judge is extremely unforgiving of poorly-argued defences. If your defence fails, the judge will grow more unreasonable. Each failed defence pushes the court closer to linguistic tyrrany. <br><br>
A successful defence, however, could set a precedent, freeing those engaging in such actions from future prosecution. You will also earn the judge's respect and they will become more reasonable. <br><br>
Choose to give no defence, and the trial proceeds with less risk of antagonising the judge, but less reward, making your future trials more difficult.<br><br>
<br>Would you like to [[bring in the accused->Bring in the accused]] now?