Very heavily inspired by this challenge Code Golf: Your own pet ASCII snake - I thought making it horizontal would add an extra layer of complexity.
An example horizontal snake:
0 0
0 0 0 000
00 0 00 000 0 0
000 0 0 0 00
0 000
And the rules are:
- Exactly 5 lines of characters are printed
- Each line is exactly 30 characters long, consisting of a combination of spaces and the character you choose to draw your snake with
- Your snake starts on line 3
- The next line to be used for drawing your snake must be randomly chosen from your current line, one line above (if you're not already on line 1) or one line below (if you're not already on line 5).
- These choices must be equally weighted. So if you are on line 1, you have a 50% chance to stay on line 1 and a 50% chance to move to line 2. If you are on line 2, you have a 33% chance to move to line 1, a 33% chance to stay on line 2 or a 33% chance to move to line 3
- Your snake does not need to visit every single line.