<<set $r1 to random(1,6)>><<if $r1 is 1>> Oof, you rolled $r1
You lose! [[restart?|start]] Or, stop [[here?|end]]
<<else>> $r1 ?
Nice! Roll [[again|r2]]?
Or, stop [[here|end]]
<</if>>
<<set $r2 to random(1,6)>><<if $r2 is 1>>
Oh no! you rolled a $r2! You lost all your points [[restart?|start]] Or, stop [[here?|end]]<<else>><<set $r2 to $r1+$r2>> $r2 ?!?!
Wow, you're on fire! [[roll again?|r3]],
Or, stop [[here|end]]
<</if>>
<<set $r3 to random(1,6)>><<if $r3 is 1>>Dang! lost your points. [[Restart?|start]] Or, stop [[here?|end]]<<else>><<set $r3 to $r2+$r3>>$r3 -- incredible. Keep on [[rolling?|r4]], Or, stop [[here|end]]
<</if>><<set $r4 to random(1,6)>><<if $r4 is 1>>
$r4
That's rough. Well do you want to [[restart?|start]] Or, stop [[here?|end]]
<<else>><<set $r4 to $r3+$r4>>
$r4 ???
Amazing. Keep on [[rolling!|r5]]
Or, stop [[here|end]]
<</if>><<if visited("start") is 4>>
Sorry, you have run out of turns.
GAME OVER
<<else>>
[[Roll the die|r1]]
<</if>>
<<set $r5 to random(1,6)>><<if $r5 is 1>>
You rolled....$r5
That's a bummer. Well do you want to [[try your luck again?|start]] Or, stop [[here?|end]]
<<else>><<set $r5 to $r4+$r5>>
$r5 !!
Fantastic. [[but now it's over|end]]
<</if>><<if $r5 gte 1>> You've earned $r5
<<elseif $r4 gte 1>> You've earned $r4
<<elseif $r3 gte 1>> You've earned $r3
<<elseif $r2 gte 1>> You've earned $r2
<<elseif $r1 gte 1>> You've earned $r1
<</if>>
<<button "THE END" "credits">><<script>>/* (code) */<</script>><</button>>
This is a prototype based on the core mechanics of the game of pig
In this game, if you roll a 1 you can either:
<ul>
<li>Restart (up to 3 times)</li>
<li>Or you can quit</li>
</ul>
If you roll anything else you can either:
<ul>
<li>Roll again and try to accumulate more points</li>
<li>Or you can quit with however many points you have then
</li></ul>
Each round you potentially accumulate more points or you can quit while you're ahead. There's always the chance you will lose all your points. You have three chances to restart if you roll a 1.
The goal is to accumulate high points without running out of turns
[[START THE GAME|start]]here is where you can put end credits