Is this continuous terrain?

Very related

You're given a piece of ASCII art representing a piece of land, like so:

/‾\
__/   ‾\_
\_/‾\
\

Since an overline () is not ASCII, you can use a ~ or - instead.

Your challenge is to determine if it is connected by the lines of the characters. For example, the above can be traced like so:

To clarify the connections:

• _ can only connect on the bottom on either side
• (or ~ or -) can only connect on the top on either side
• / can only connect on the top right and bottom left
• \ can only connect on the top left and bottom right

It doesn't matter where the connections start and end as long as they go all the way across. Note that one line's bottom is the next line's top, so stuff like this is allowed:

_
‾

\
\

_
/

\
‾

You can assume input will only contain those characters plus spaces and newlines, and will only contain one non-space character per column.

Input can be taken as ASCII art, an array of rows, a character matrix, etc.

Testcases

Separated by double newline.

Truthy:

\
\

\_
\ /\/\_
‾     \

/\
\/

\_
‾\

/‾\
__/   ‾\_
\_/‾\
\

Falsy:

/
\

//

‾‾
/  \

‾
_

\____/
/‾‾‾\

Python 3.8, 85 bytes

Input is taken as a list of lines, with replaced with dashes (-).

lambda L,n=0:len({(n:=n+2-ord(c:=max(x))//2%5)-x.index(c)+(c<'0')for x in zip(*L)})<2

Try it online!

J, 43 39 bytes

[:*/2=/@(I.@:*-1#.3 2&=+1&=)\' -\/'i.|:

Try it online!

• ' -\/'i.|: Transpose and convert characters to integers.
• 2...(...)\ For each pair of rows...
• I.@:* Get the indices of the non-zero (non-space) element...
• -1#.3 2&=+1&= And adjust it as follows:
• 1&= If it's a - in either position, subtract 1.
• 3 2&= If it's a / on the left or a \ on the right, subtract 1.
• =/@ Are the two row indices equal after this adjustment?
• [:*/ Are they all equal?
• I think ' -\/'i.|: works for -2
– ovs
Jan 16 at 22:49
• I actually just went back to this and found that as well as some other golfs... Jan 16 at 22:55

Retina, 77 bytes

m/(?<=^|¶)([\\_]([_\/]|.*¶ [-\\])|[\/-][-\\]| [_\/].*¶[\/-])/+^.

^\s*\S\s*$Try it online! Link includes test suite that takes double-spaced test cases and converts to - which the script actually uses. Explanation: /(?<=^|¶)([\\_]([_\/]|.*¶ [-\\])|[\/-][-\\]| [_\/].*¶[\/-])/+ Repeat while the first two columns have a valid join, either a \ or _ followed by either a _ or / or a - or \ on the next line, or a / or - followed by a - or \, or a / or - followed by a _ or / on the previous line, ... m^. ... delete the first character of each line. ^\s*\S\s*$

Check that only one column is left.

Charcoal, 37 bytes

ＷＳ⊞υι⬤Φθκ¬↨ＥＥ²⭆υ§ν⁺κλ⁺⌕λ⌈λ№⁺_§\/μ⌈λ±¹

Try it online! Link is to verbose version of code. Takes input as a rectangle of newline-terminated lines and outputs a Charcoal boolean, i.e. '-' for continuous, nothing if not. Assumes that any character not one of \_/ or space is the overline character. Explanation:

ＷＳ⊞υι

Input the land.

⬤Φθκ

Loop over all the columns except one.

Ｅ²⭆υ§ν⁺κλ

Get the current and the next column.

Ｅ...⁺⌕λ⌈λ№⁺_§\/μ⌈λ

Find the positions of the non-space characters, but add 1 if the character is a _, or if it is either \ or / depending on the column.

¬↨...±¹

Ensure the positions are equal.

BQN, 35 bytesSBCS

Uses ¯ MACRON instead of the overline.

⌈˝{≡´¯1‿1↓¨((/˘𝕨=𝕩)-𝕨∊'¯'∾⊢)¨"/\"}⍉

Run online!

┌─
╵"\_                     # Input character matrix    - m
\ /\/\_
¯     \"
┘
"\_\¯/\/\_\"             # collapsed - ⌈˝m
⟨ 0 0 1 2 1 1 1 1 1 2 ⟩  # the depth of each column  - /˘(⌈˝m)=(⍉m)

⟨ 0 0 0 1 1 0 1 0 0 0 ⟩  # locations of '¯' and '/'  - (⌈˝m)∊'¯'∾'/'
⟨ 0 0 1 1 0 1 0 1 1 2 ⟩  # depth - ^locations
⟨ 0 0 1 1 0 1 0 1 1 ⟩    # the last element dropped  - ¯1↓...

⟨  1 0 1 1 0 1 0 1 0 1 ⟩ # locations of '¯' and '\'  - (⌈˝m)∊'¯'∾'\'
⟨ ¯1 0 0 1 1 0 1 0 1 1 ⟩ # depth - ^locations
⟨ 0 0 1 1 0 1 0 1 1 ⟩ # the first element dropped - 1↓...
• Nice. How do you like BQN compared with APL so far? Jan 17 at 19:48
• @Jonah for golfing purposes it is quite nice (as long as you don't need base conversion). Nothing · (similar to J's cap [:) makes writing tacit functions easier and there are a few additional useful operators, like Catch, Under, Before, etc. The somewhat different selection of primitives for sequences takes a while to get used to, but Occurence Count has already provided me with multiple very short answers in return ;). For non golfed code I tend to notice that Dyalog actually did a decent job at making APL run fast, there is definitely a gap there.
– ovs
Jan 17 at 21:13

Jelly, 28 bytes

“-\/_”iⱮⱮZTḢ+S+3BḊƲƲ€FḊs2E€Ạ

Try it online!