1 in 3

Try itChance

This slime walks back and forth. Every 2 seconds it might jump. The script gives it a 1 in 3 chance.

No problems detected

How to read it

LinesWhat they do
when I start and patrolThe slime walks back and forth
every 2 secondsThis rule runs again and again, 2 seconds apart
if a 1 in 3 chanceOne time in three, the lines inside happen
jumpThe slime jumps
when I reach an edge and turn aroundThe slime turns back at a gap, so it never walks off

Try it

  1. Press Play Play this script, under the little game.
  2. Watch for 24 seconds. That is 12 tries, because 24 รท 2 is 12.
  3. Count the jumps on your fingers.

With a 1 in 3 chance, you expect about 4 jumps in 12 tries. You might see 2, or 6. Chance is like that.

Change the chance

  1. Press Stop Stop.
  2. Press Blocks Blocks, at the top left of the code box. There you can type any number.
  3. Change the 3 to another number, then press Play Play this script.
Try thisWhat you expect in 12 triesWhat kind of enemy it is
1 in 112 jumps. Every timeEasy to learn. No surprise
1 in 2About 6 jumpsJumpy
1 in 6About 2 jumpsCalm, then a shock

This section ticks itself when you press Play Play this script.

Press Play in the code box to finish this section.