This is the first in a series, the second is Two roads diverged in a yellow wood (part 2)
This challenge is inspired by Robert Frost's famous poem, "The Road Not Taken":
Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I —
I took the one less traveled by,
And that has made all the difference.
Notice the second to last line, I took the one less traveled by,
.
Your actual challenge
You will take input in the form like:
# ##
# ##
# ##
#
#
#
and you have to find the thinner road.
The road starts at the bottom with a #
. The other 2 roads, which always terminate on the top row, are the roads you have to examine. The road that is the thickest is most traveled by, and therefore it is not what you want. The other one is the least traveled by, and it is the one you want.
Output
Your program/function must output one of 2 distinct values (eg. 0 or 1, true or false), one for each possible position of the road not taken. For example, you could output 0 if the road not taken is on the left of the road taken, and 1 otherwise, or you could output the string "left" or "right", true, false, etc.
Test cases:
## #
## #
###
#
#
#
Might output "right".
## #
## #
###
##
#
#
#
Might output "right".
## #
## #
###
##
#
#
#
Might output "right".
## #
## #
###
#
#
#
#
Might output "right".
# ##
# ##
###
#
#
#
#
Might output "left"
# ##
# ##
###
#
#
#
#
Might output "left"
Notes
- This is code-golf, so the shortest answer in bytes wins
- Standard loopholes forbidden
- You must specify your outputs for "left" and "right" and they must be distinct
- Input will be one big string, and may have any amount of lines
- You don't need to worry about valid input.
- The road is always a Y shape, so you only have to look at the top.
- Have any questions? Comment below:
Y
shape and never upside down? In that case, isn't it sufficient to only look at the top row? That kinda trivializes the problem. \$\endgroup\$