#ThisWeeksFiddler, 20250523

This week the #puzzle is: How Long Is the River? #probability (Link at the bottom.)

… a phenomenon known as a “river”, where spaces between words diagonally align from one line of text to the next.
Before getting to rivers, let’s figure out where spaces are likely to appear in the (fictional) Fiddlish language, which includes only three- and four-letter words. These words are separated by spaces, but there is no other punctuation.
Suppose a line of Fiddlish text is generated such that each next word has a 50 percent chance of being three letters and a 50 percent chance of being four letters.
Suppose a line has many, many, many words. What is the probability that any given character deep into the line is a space?

And for extra credit:

Fiddlish is written using a monospace font, meaning each character (including spaces) takes up the same amount of horizontal space. As before, lines of text are very, very long, and each next word has a 50 percent chance of being three letters and a 50 percent chance of being four letters. Each line begins with a new word (i.e., words at the end of a line are not hyphenated into the next line).
Suppose the 12th character of a specific line of text is a space. You want to know how long the river down and to the right from this space will be. For example, suppose the 13th character on the next line and the 14th character on the line after that are both spaces, but the 15th character on the very next line is not a space. In this case, the river would have a length of 3. (By this definition, the length of the river is always at least 1.)
On average, how long do you expect the resulting river from the given space (again, the 12th character in its line) to be?

Highlight to reveal (possibly incorrect) solution:

Program 1

And for extra credit:

Program 2

***

How Long Is the River?

Skriv en kommentar