text:
Make a Bowl of Alphabet Soup
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
   XYZABC
 VW      DE
U          F
T          G
S          H
 RQ      JI
   PONMLK

Write a program that takes in a single letter character, A-Z, and outputs that same bowl of alphabet soup "rotated", so to speak, so the input letter appears where the A does in the example above and the rest of the alphabet cycles fully around clockwise.
So the output for input A would be that same original bowl of alphabet soup.
And the output for input B would be this one:
   YZABCD
 WX      EF
V          G
U          H
T          I
 SR      KJ
   QPONML

Likewise the output for H would be:
   EFGHIJ
 CD      KL
B          M
A          N
Z          O
 YX      QP
   WVUTSR

Or for Z:
   WXYZAB
 UV      CD
T          E
S          F
R          G
 QP      IH
   ONMLKJ

This needs to work for all 26 letters, A through Z.
Details:

You can assume the only input will be a single letter, A through Z.
If convenient you may use lowercase a-z for input and/or output, you can even mix and match lower and uppercase.
The alphabet order must cycle clockwise, not counter-clockwise.
You must use spaces, not something else, to indent and fill the soup bowl.
There may be leading or trailing newlines or spaces in the output as long as the soup bowl is arranged properly.
Note that the bowl shape is 12 characters wide by 7 tall to make it appear roughly circular as text. Your bowls need to be the same shape.

This is code golf so the shortest code wins!

Great challenge! It initially seems easy, but it's not

It's quite late, but you won two of the Best of CGCC 2019 awards, this one for Trickiest Challenge, and another for Best first-time Challenge Writer! We want to award bounties for you, but they can only be awarded on answers. Can you write one or two answers so that you can receive the bounty?

05AB1E, 21 bytes
Defines a program \$f : \color{purple}{\texttt{AlphabeticChar}} \rightarrow \color{purple}{\texttt{String}}\$
Code:
2AA¹k._•1ëª»*Ć,ãiDΣ•Λ

Try it online!

Breakdown:
2AA¹k._•1ëª»*Ć,ãiDΣ•Λ

2                       # <length>
 AA¹k._                 # <filler>
       •1ëª»*Ć,ãiDΣ•    # <pattern>
                    Λ   # Invoke the canvas function.

Explanation:
The canvas (Λ) in this particular context works as a function with the following signature:
$$
\mathsf{\Lambda} : \left(\texttt{length}: \color{purple}{\texttt{Nat}},\ \texttt{filler}: \color{purple}{\texttt{String}},\ \texttt{pattern}: \color{purple}{\texttt{Nat}}\right) \rightarrow \color{purple}{\texttt{String}}
$$
The \$\texttt{pattern}\$ parameter is in this situation a number defining the directions. In the code, this number is represented as •1ëª»*Ć,ãiDΣ•, which is a compressed version of the big number \$2232344565666667670012122\$. Directions are denoted in the following manner:

$$
\begin{array}{l}
7 & & 0 & & 1 \\
  & \nwarrow & \uparrow & \nearrow & \\
6 & \leftarrow & \bullet & \rightarrow & 2 \\
  & \swarrow & \downarrow & \searrow & \\
5 & & 4 & & 3
\end{array}
$$

This means that the big number represents the following pattern of directions:
$$
[\rightarrow, \rightarrow, \searrow, \rightarrow, \searrow, \downarrow, \downarrow, \swarrow, \leftarrow, \swarrow, \leftarrow, \leftarrow, \leftarrow, \leftarrow, \leftarrow, \nwarrow, \leftarrow, \nwarrow, \uparrow, \uparrow, \nearrow, \rightarrow, \nearrow, \rightarrow, \rightarrow]
$$
With this signature context, the canvas iterates through the \$\texttt{pattern}\$ list and writes \$\texttt{length}\$ characters from the \$\texttt{filler}\$ in the current direction.
The \$\texttt{length}\$ is specified in the code as \$2\$ (at the beginning of the code). For the \$\texttt{filler}\$, we need a rotated version of the alphabet such that it starts with the given input. That is done with the following code (try it here):

AA¹k._

 A¹k       # Find the <index> of the given input character in the alphabet
A   ._     # Rotate the alphabet to the left <index> times.

In pseudocode, this would be executed by the canvas function:
\$
\begin{array}{l}
1. & \text{Write } \color{blue}{\texttt{ab}} \text{ in the direction} \rightarrow \\
2. & \text{Write } \color{blue}{\texttt{bc}} \text{ in the direction} \rightarrow \\
3. & \text{Write } \color{blue}{\texttt{cd}} \text{ in the direction} \searrow \\
4. & \text{Write } \color{blue}{\texttt{de}} \text{ in the direction} \rightarrow \\
5. & \text{Write } \color{blue}{\texttt{ef}} \text{ in the direction} \searrow \\
6. & \text{Write } \color{blue}{\texttt{fg}} \text{ in the direction} \downarrow \\
\dots
\end{array}
\$
Lastly, you can see that the filler argument is 'rotated' \$\texttt{length} - 1\$ times to the right, meaning that the canvas would iterate through the following (cycled and therefore infinite) list:
$$
[\color{blue}{\texttt{ab}}, \color{blue}{\texttt{bc}}, \color{blue}{\texttt{cd}}, \color{blue}{\texttt{de}}, \color{blue}{\texttt{ef}}, \color{blue}{\texttt{fg}}, \color{blue}{\texttt{gh}}, \color{blue}{\texttt{hi}}, \color{blue}{\texttt{ij}}, \color{blue}{\texttt{jk}}, ...
$$
Which results in the desired alphabet soup ascii-art shape.

Perl 6, 100 bytes
{"2XYZABC
 VW5DE
U9F
T9G
S9H
 RQ5JI
2PONMLK".trans(/\S/=>{(try ' 'x$/+1)||chr ($/.ord+.ord)%26+65})}

Try it online!
Replaces all letters in the string with their shifted counterparts, while replacing digits with the number of spaces they represent plus one.
Explanation
{                                                            }# Anonymous code block
 "...".trans(/\S/=>{                                       }) # Translate non-whitespace
                    (try ' 'x$/+1)      # If digits, the amount of spaces plus one
                                  ||chr ($/.ord+.ord)%26+64  # Else the shifted letter

MATL, 49 bytes
7I8*32tvB[1b]&Zvc2Y2j7+_YSy&f7-w4-_Z;YPE\,&S])yg(

What a mess. But it was fun writing. There's even an arctangent involved.
Try it online!
Explanation
The code
7I8*32tvB

creates an array of numbers and converts them to binary. This gives the zero-one matrix
0 0 0 1 1 1
0 1 1 0 0 0
1 0 0 0 0 0
1 0 0 0 0 0

which is the top left quadrant of a matrix specfying the positions of the letters.
[1b]&Zv

reflects that quadrant vertically without repeating the last row, and horizontally repeating the last column to produce the full matrix:
0 0 0 1 1 1 1 1 1 0 0 0
0 1 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 0 0 1
0 1 1 0 0 0 0 0 0 1 1 0
0 0 0 1 1 1 1 1 1 0 0 0

We now have a mask with the positions. The code
c

converts this to char, because the final result will be a char matrix. Character 0 is displayed as space, and the nonzero entries will be written with the appropriate letters.
2Y2

pushes the string 'abc···xyz', which contains the 26 letters. This string needs to be circularly shifted as per the input. To do that,
j7+_YS

reads the input letter, adds 7 to its ASCII code, and negates the result. For input 'a' this gives −104, which is a multiple of 26, so circularly shifting by this amount will do nothing. If the input is b this gives −105, which shifts the string 1 step to the left to produce 'bcd···yza'; etc.
The next step is to define the order in which the shifted string will be written into the nonzero entries of the matrix. To this end,
y&f

creates a copy of the matrix and pushes two vectors containing the 1-based row and column positions of the nonzeros. Then
7-w4-_

subtracts 7 from the latter, brings the former to top, substracts 4 from it, and negates it. The 7 and 4 specify an origin of coordinates, so that the angles of the position vectors of the nonzero entries with respect to that origin define the desired order.
Z;YPE\

computes the two-argument arctangent modulo 2*pi to produce those angles. Now the smallest angle, which is 0, corresponds to the entry where the first letter should go, and the rest advance counter-clockwise.
,&S])

rearranges the letters in the string according to those angles, so that when the letters are written into the nonzero entries of the matrix in column-major order (down, then across) the result will be correct. This is done by
yg(

For example, if the input is 'a' the string was not circularly shifted:
abcdefghijklmnopqrstuvwxyz

The rearranging as per the angles transforms this into
utsvrwqxpyoznamblckdjeifgh

so that 'u' will correctly go to the first (in column-major order) nonzero entry, which is (3,1) in matrix notation; 't' will go to (4,1), 's' to (5,1); 'v' to (2,2) etc:
   ······
 v·      ··
u          ·
t          ·
s          ·
 ··      ··
   ······

@EriktheOutgolfer I finally found some time to add an explanation

Woah... I actually thought you abandoned this because you deleted that comment. :P

Ruby, 107 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=(1i**((i.ord-n.ord-6)/6.5)).rect;a[3.5*k+=1][5.2*j+6]=i}
a*$/}

Try it online!
Improved syntax "i".to_c -> 1i (Suggested by Jordan)
Changed coordinate system so 0 degrees is at right instead of top. This enables 0.5 -> 6
Adjusted multipliers of j and k for shortness
Rather than print output puts a, concatenate array elements and return a string a*$/
Ruby, 119 bytes
->n{a=(0..6).map{' '*11}
(?A..?Z).map{|i|j,k=("i".to_c**((i.ord-n.ord+0.5)/6.5)).rect;a[3.5-j*3.3][6+k*5.17]=i}
puts a}

Uses a complex number raised to a power to map to an ellipse. A complete turn is 26, so each quadrant is 6.5.
This approach relies on the required output resembling an ellipse sufficiently that a valid mapping can be achieved.
Try it online!

Charcoal, 33 bytes
ＧＨ→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→²✂⁺αα⌕αＳ

Try it online! Link is to verbose version of code. Explanation:
ＧＨ

Trace a path.
→→↘→↘↓↓77←←←←↖←↖↑↑↗→↗→→

Outline the bowl. Each 7 expands to ↙←.
²

Move one character at a time (this API overlaps each line's ends with the next).
✂⁺αα⌕αＳ

Draw using the doubled alphabet, but starting at the position of the input character.

Python 2, 129 bytes
lambda x:''.join((i,chr((ord(x)+ord(i))%26+65),' '*5)[ord(i)/46]for i in'''   XYZABC
 VW] DE
U]]F
T]]G
S]]H
 RQ] JI
   PONMLK''')

Try it online!

R, 139 122 bytes
-17 bytes thanks to Giuseppe
u=utf8ToInt;`*`=rep;o=c(' '*12,'
')*7;o[u("  &3@LKWVUTSRDC5(")]=LETTERS[(13:38+u(scan(,'')))%%26+1];cat(o,sep='')

Explanation:
o=rep(c(rep(' ',12),'
'),7)

Builds an empty box of spaces
u(" &3@LKWVUTSRDC5(")

is a set of indices for letter positions corresponding to:
c(7:9,23,24,38,51,64,76,75,87:82,68,67,53,40,27,15,16,4:6)

TIO

you never use intToUtf8 so those are extraneous bytes, but if you use * in place of rep, you can get save 2 bytes and get to 125 bytes

Oh, and using the low-byte characters instead of printable ascii you can shave off the -32, for 122 bytes. You can generate them yourself by using cat(intToUtf8(bytes)).

@Giuseppe I was pretty sure I had already removed the intToUtf8, too many versions of the function open at once I guess. Nice saves all roundthough, thanks

JavaScript (Node.js),  121  119 bytes
Saved 2 bytes thanks to @tsh
c=>`2XYZABC
0VW5DE
U9F
T9G
S9H
0RQ5JI
2PONMLK`.replace(/./g,x=>''.padEnd(+x+1)||(B=Buffer)([65+([a,b]=B(c+x),a+b)%26]))

Try it online!
How?
This code abuses Buffer to extract the ASCII codes of the template letter \$x\$ and input letter \$c\$ and convert them back into the target letter.
Example with \$c=\$"H" and \$x=\$"B"
// extracting the ASCII codes
Buffer(c + x) → Buffer("HB") → <Buffer 48 42>

// assigning them to variables
[a, b] = Buffer(c + x) → a = 0x48 (72) and b = 0x42 (66)

// computing the ASCII code of the target letter
65 + ((a + b) % 26) → 65 + (138 % 26) → 65 + 8 → 73

// turning it back into a character
Buffer([73]) → <Buffer 49> → implicitly coerced to "I" by replace()

119 bytes

APL+WIN, 72 bytes
Prompts for character
m←7 12⍴' '⋄n←(7⍴2)⊤v,⌽v←(⍳3)/28 34 65⋄((,n)/,m)←(22+s⍳⎕)⌽s←⎕av[65+⍳26]⋄m

Try it online!Coutesy of Dyalog Classic

R, 218 197 bytes
-21 bytes thanks to Giuseppe
function(t,l=letters,`*`=rep,s=" ",n="
",`~`=`[`,r=c(l~l>=t,l))cat(s*3,r~24:26,r~1:3,n,s,r~22:23,q<-s*6,r~4:5,n,r~21,u<-s*10,r~6,n,r~20,u,r~7,n,r~19,u,r~8,n,s,r~17:18,q,r~10:9,n,s*3,r~16:11,sep='')

Try it online!
Ungolfed:
alphasoup <- function(startlet){
  startnum <- which(l == startlet)
  rotatedletters <- c(letters[startnum:26], letters[1:(startnum -1)])[1:26]
  cat('   ',rotatedletters[24:26],rotatedletters[1:3], '\n ',
      rotatedletters[22:23], s6 <- '      ', rotatedletters[4:5], '\n',
      rotatedletters[21], s10 <- rep(' ', 10), rotatedletters[6], '\n',
      rotatedletters[20], s10, rotatedletters[7], '\n',
      rotatedletters[19], s10, rotatedletters[8], '\n ',
      rotatedletters[17:18], s6, rotatedletters[10:9], '\n   ',
      rotatedletters[16:11],
      sep = '')
}

Created rotated letter vector and uses cat to fill out rim of bowl with that vector.

203 bytes if you don't mind one-line monstrosities; the biggest improvement was probably removing the which and using l>=t as the index directly, which was worth 12 bytes.

198 bytes by aliasing [ with ~. This is a great answer; I was spending about 250 bytes in my first few attempts with a much more complex approach.

Ah, that's clever, I forget about string comparisons.

Java 11, 134 bytes
c->"2XYZABC_0VW5DE_U9F_T9G_S9H_0RQ5JI_2PONMLK".chars().forEach(i->System.out.print(i<59?" ".repeat(i-47):(char)(i>90?10:(c+i)%26+65)))

Try it online.
136 bytes version with potential to be golfed?
c->"2XYZABC_0VW5DE_U9F_T9G_S9H_0RQ5JI_2PONMLK".chars().forEach(i->System.out.printf("%"+(i<59?i-47:"")+"c",i>90?10:i<59?32:(c+i)%26+65))

Try it online.
Explanation (of the first answer)
c->                          // Method with character parameter and no return-type
  "2XYZABC_0VW5DE_U9F_T9G_S9H_0RQ5JI_2PONMLK"
                             //  Template-String
    .chars().forEach(i->     //  Loop over the unicode values of its characters:
    System.out.print(        //   Print:
     i<59?                   //    If the value is below 59 (so a digit character):
      " ".repeat(i-47)       //     Repeat a space that digit + 1 amount of times
     :(char)(i>90?           //    Else-if the value is above 90 (an underscore character):
              10             //     Print a newline
             :               //    Else:
              (c+i)          //     Add the current value and the input together
                   %26       //     Take modulo-26 of it to get the index in the alphabet
                      +65))) //     And add 65 to make it an uppercase letter

Why not replace digits with unprintables? That way, you could just omit the i-47

@EmbodimentofIgnorance I'm afraid it wouldn't save any bytes. The numbers of spaces are 3, 1, 6, and 10. The 10 is used three times and is 2 bytes each as character (\n). So whether I use unprintables and 3x \n with i or digits-1 with i-47, both are the same 134 byte-count. And unfortunately I can't have an unprintable 0, otherwise I could have used 2,0,5,9 instead, and use i+1 to save 1 byte in total.

C(GCC) 286 270 bytes
-12 bytes ceilingcat
Not exactly the shortest golf, but it works
#define r(a)(a+c)%26+65
#define R(a)for(i=10;i;a[--i]>32?a[i]=r(a[i]):0);
i;f(c){char T[]="   XYZABC\n",E[]="VW      DE\n",F[]="RQ      JI\n",B[]="   PONMLK";R(T)R(E)R(F)R(B)printf("%s %s%c%*c\n%c%*c\n%c%*c\n %s%s",T,E,r(85),11,r(70),r(84),11,r(71),r(83),11,r(72),F,B);}

Try it online!

266 bytes

Wolfram Language (Mathematica), 258 bytes
(t[x_]:=Table[" ",x];w=RotateRight[Alphabet[],4-LetterNumber@#];j=Join;a[x_,y_]:=j[{w[[x]]},t@10,{w[[y]]}];b[m_,n_]:=j[t@1,w[[m;;m+1]],t@6,w[[n;;n+1]],t@1];""<>#&/@{j[t@3,w[[1;;6]]],b[25,7],a[24,9],a[23,10],a[22,11],Reverse@b[12,20],j[t@3,w[[19;;14;;-1]]]})&

Try it online!

TSQL query, 238 bytes
DECLARE @y char='G'

,@ char(91)=3;WITH C as(SELECT'5585877636333330301125255'z,8a,ascii(@y)x
UNION ALL
SELECT stuff(z,1,1,''),a+left(z,1)/3*13+left(z,1)%3-14,(x+14)%26+65FROM
C WHERE''<z)SELECT
@=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))FROM
C PRINT @

The test link for this answer broke the line breaks and excluded the spaces. I have replaced the spaces with period and replaced char(13) with char(13)+char(10) in order to show a readable result.
Try it online
Ungolfed:
DECLARE @y char='G'

-- @ is the string being printed last.
-- @ is populated with 3 to save a byte
-- the number 3 gets replaced later
-- (this could have been any 1 digit value),
-- @ is automatically filled with spaces, because
-- it is declared as a char(x) and assigned a value
,@ char(91)=3;
-- recursive query
WITH C as
(
-- z string containing digits for the direction of next letter
-- z should not contain 4 because it will point to same position.
-- values in z 0,1,2,3,4,5,6,7,8 can logally convert to
-- (-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)
-- a is the starting position
  SELECT'5585877636333330301125255'z,8a,ascii(@y)x
  UNION ALL
-- stuff remove first character from the z string
-- a calculate next position of the next letter
-- x cycle the input letter
  SELECT stuff(z,1,1,''),a+left(z,1)/3*13+left(z,1)%3-14,(x+14)%26+65
-- repeat recursive until long string is empty
  FROM C
  WHERE''<z
)
SELECT
-- 1st stuff replace the character to created the start of a
--   logical line in the string @ this is where 3 gets overwritten
-- 2nd stuff replaces a character(space if coded correct)
--  with the letter at the calculated position.
  @=stuff(stuff(@,a,1,char(x)),1+a/13*13,1,char(13))
FROM C

PRINT @

@MickyT ok, thanks for your feedback, I will fix it later today if i can get access to a db

@MickyT it should be fixed now

looks good now.

Kotlin, 148 146 145 bytes
Removed extra parentheses for -2
Replaced raw string for -1
{l:Char->"2XYZABC 0VW5DE U9F T9G S9H 0RQ5JI 2PONMLK".map{c->if(c>'@')((c-'A'+(l-'A'))%26+65).toChar()
else if(c>' ')" ".repeat(c-'/')
else '\n'}}

Try it online!

Haskell, 127 bytes
("cXYZABC aVWfDE UjF TjG SjH aRQfJI cPONMLK">>=).(?)
t?c|c>'Z'=' '<$['a'..c]|c<'!'="\n"|t<'B'=[c]|c>'Y'=t?'@'|1<2=pred t?succ c

Try it online!
Each character in the encoded string is decoded by function ? into a string:
t?c                             -- 't' is the starting char,
                                -- 'c' the char from the encoded string
   |c>'Z'=' '<$['a'..c]         -- if 'c' is a lowercase letter, return some spaces
                                -- 'a': one, 'b': two, etc
   |c<'!'="\n"                  -- if 'c' is a space, return a newline
   |t<'B'=[c]                   -- if 't' is the letter A, return 'c'
   |c>'Y'=t?'@'                 -- wrap around Z
   |1<2=pred t?succ c           -- else the result is the same as starting one letter
                                -- earlier (pred t) but looking at the successor of 'c'

C# (Visual C# Interactive Compiler), 126 118 bytes
n=>$@"   XYZABC
 VW{"",6}DE
U {"",9}F
T {"",9}G
S {"",9}H
 RQ{"",6}JI
   PONMLK".Select(b=>b<65?b:(char)((b+n)%26+65))

Saved 8 bytes thanks to @someone. Yes, that's actually his username.
Try it online!

String interpolation for 118 bytes. It is likely acceptable to return a array of charcodes (saving ~8 bytes), but I'm not sure.

@someone Nice, forgot about string interpolation

Javascript (V8), 316 bytes
function a(b){n="abcdefghijklmnopqrstuvwxyz".split(b);n=b+n[1]+n[0],console.log(`   ${n[23]+n[24]+n[25]+n[0]+n[1]+n[2]}\n ${n[21]+n[22]}      ${n[3]+n[4]}\n${n[20]}          ${n[5]}\n${n[19]}          ${n[6]}\n${n[18]}          ${n[7]}\n ${n[17]+n[16]}      ${n[9]+n[8]}\n   ${n[15]+n[14]+n[13]+n[12]+n[11]+n[10]}`)}

Try it online
First time trying code golf out. Appreciate any tips / feedback.
Original code before minifying:
function a(b){
    var c = ("abcdefghijklmnopqrstuvwxyz").split(b);
    c = b+c[1]+c[0]
    console.log(`   ${c[23]+c[24]+c[25]+c[0]+c[1]+c[2]}\n ${c[21]+c[22]}      ${c[3]+c[4]}\n${c[20]}          ${c[5]}\n${c[19]}          ${c[6]}\n${c[18]}          ${c[7]}\n ${c[17]+c[16]}      ${c[9]+c[8]}\n   ${c[15]+c[14]+c[13]+c[12]+c[11]+c[10]}`)
}

Hello and welcome to PPCG. As it stands, your submission is a snippet, which is invalid I/O. Please fix your answer to either be a full program or function -- as in you non-minified version.

@Jonathan Fresch thanks! Would that suffice?

Yes, this is now a valid submission.

PHP, 236 229 226 bytes
<?=($a=ord(file_get_contents('php://stdin'))-65)?preg_replace_callback('~\w~',function($m)use($a){return chr((ord($m[0])-65+$a)%26+65);},'   XYZABC
 VW      DE
U          F
T          G
S          H
 RQ      JI
   PONMLK'):'';

Try it online!
Pre-golf:
<?php
$adjust = ord(file_get_contents('php://stdin')) - 65;
echo preg_replace_callback('~\w~', function($match) use ($adjust) {
    $new = ord($match[0]) - 65;
    $new = ($new + $adjust) % 26;
    $new += 65;
    return chr($new);
}, '   XYZABC
 VW      DE
U          F
T          G
S          H
 RQ      JI
   PONMLK');

Explanation:
Using ord we convert to an integer between 0 and 255. A is 65 and Z is 90.
Using this knowledge, we take the input and reduce it by 65 so we have an adjustment value.
We then iterate over all characters, call ord on them, reduce them by 65, increase them by our adjustment value. Using modulo we loop back down to 0 if they exceed 26.
We then increase them by 65 again and convert them back into letters with chr.
Sadly php://stdin can only be interogated once, so we need to pass the input into the function in our loop, preventing us from saving bytes on use($a) and having to declare a variable outside the function stops us from cleanly using the <?= echo method - we have to wrap everything in a giant ternary.

Red, 139 bytes
func[a][foreach c{   XYZABC
 VW      DE
U          F
T          G
S          H
 RQ      JI
   PONMLK}[if c > sp[c: c + a % 26 + 65]prin c]]

Try it online!
A really naive solution.

Perl 5 -p, 110 bytes
$b=/A/?Z:chr(-1+ord);$_=eval("'2XYZABC
 VW5DE
U9F
T9G
S9H
 RQ5JI
2PONMLK'=~y/A-Z/$_-ZA-$b/r");s/\d/$".$"x$&/eg

Try it online!

$b is unnecessary. -24 bytes: TIO.

-2 bytes TIO

C (gcc), 200 198 197 bytes
-3 bytes thanks to ceilingcat.
x,z;f(c){char*y,t[27],i=0;for(c-=46;i<14;t[13+i++]=(c-i)%26+65)t[i]=(c+i)%26+65;for(i=-4;++i<4;printf("%*.*s%*.*s\n",3273>>x*3&7,x?:1,y,z,x?:1,y+2*!i+z))z="--*%"[x=abs(i)]-34,y=t+x+(x>2)+13*(i>0);}

Try it online!

APL (Dyalog Classic), 50 bytes
⎕a@((-⎕a⍳⍞)⌽∪⌊.5+{3 5.5×1-2 1○○⍵÷¯19}¨⍳38)⊢7 12⍴''

Try it online!

So this makes a circle of numbers 1-26 and indexes ⎕A into it, right?

@Razetime actually, it makes a list of coordinate pairs for the letters, and amends a blank 7×12 matrix to put ⎕A in those positions

PHP, 131 bytes
for(;$s='2YZABCD
 WX5EF
V9G
U9H
T9I
 SR5KJ
2QPONML'[$i++];)echo$s<A?$s<'0'?$s:str_pad('',$s+1,' '):chr(65+(ord($s)+ord($argn))%26);

Try it online!


text:
Gotta Collect 'Em All
Your task here will be to write a very dumb AI capable of fetching all treasures on a map.
Map
The map is defined as follow: (artist-mode™-powered)
Basic case:
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |M|M|M|T| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | |T| | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+

Locked up:
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | |M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | |M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T| | |M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+

No treasures
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | |M|M|M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | |M|M|M|M|M|M|M| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |M| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |M|M|M|M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+

No way to move
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|P|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

The world is a giant treasure
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|P|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

Back alley
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | | | | | | | | |T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | |M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | |M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | |T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | |M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

1x1
+-+
|P|
+-+

Cells

Empty cases are empty
M cells are mountains and cannot be walked on.
T cells are treasures that need to be collected.

Goal

You will generate a "path string" describing the movements needed to obtain all the treasures. No extraneous moves after treasures were all collected are allowed.
Moves can be: "Left" "Right" "Up" "Down".
Generating a move that'd result in an attempt to clib a mountain (M) or hit a wall (Out Of Bounds) is an error (it's not simply ignored).

General Rules

Map must be read. (this is not a compression challenge, there are an infinite possible number of maps).
There will always be one and only one player, P.
There will always be a path to go get all the treasures, T.
Map size may vary, but it'll always be at least 1x1.
The AI starts at P, the player.
There might not be a treasure on the map. In this case, you're allowed to exit any falsy value (that isn't a valid path)
Your algorithm pick -- it needn't be the most efficient.
You must solve it before the heat death of the universe
It is not guaranteed you'll be able to access every non-mountain cell on the map. Just enough to fetch all treasures.
The AI may see the whole map.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

Format
Input

You can decide to take inputs as a multi-line string with or without the ASCII separators I included (same for the space between cells)
Passed via stdio or a function argument or on your program's stack(s)
You can other identifiers instead of " ",M,P -- so long they are uniquely identifiable and not a separator (you need it specified in your answer)
You can decide to take an 2-dimensional array, or matrix, or the equivalent in your language, with the cells, as [['P', ' ', ' '...], [...], [' ', ' ', 'T'...]...].
You are also allowed to take an array of strings, such as ["P  ...", ..., "  T..."...].
You are allowed to take the length as an extra input (width/height).

Output

The output must look like "LLRRUUDD" (Left/Left/Right/Right/Up/Up/Down/Down)
You can decide to intersperse spaces, newlines, etc, so long they don't mix with your instructions.
You can other identifiers instead of L,R,U,D -- so long they are uniquely identifiable and not a separator (you need it specified in your answer)
There might be different solutions (i.e. DR vs RD), it doesn't matter which you output in this case.

Scoring
This is a code-golf challenge.

Is the parsing tag really suitable if we're allowed to take input as a matrix? Also, allowing input as a matrix seems to conflict with Map must be parsed.

Feel free to edit tags.

@Arnauld Added "back alley", which should answer your question.

Related

@KevinCruijssen Though the winning criteria is the opposite :)

@Ven I know. In my challenge the most optimal path has to be found from the entrance to the exit. In yours any one valid path should be output from the starting point through all treasures. I just added it as a related challenge for people to draw inspiration from, since both challenges require the path to be output and have backtracking involved. :)

Does the output path end when the last treasure is picked up?  If so, the output of "No treasures" is an empty string (or empty array), yes?

Indeed, it's an empty string or an empty array. I see no point disallowing "any falsy value", even.

Pretend there is a mountain on the right of the player. Are we allowed to output R, and let the player just stay in place? Also, can we take input as a string with an additional parameter as length of line?

@Embodiment of Ignorance Generating a move that'd result in an attempt to clib a mountain (M) or hit a wall (Out Of Bounds) is an error (it's not simply ignored). (so no for the former), yes for the latter: you may take length in input

So, uh, we're allowed to output a falsey value if there are no treasures? Not required to? But judging from the comments here, then if there are no treasures, we are to return an empty string? So superfluous move commands after last treasure is found is disallowed? But not superfluous moves before that?

@gastropner my point was: I don't see a reason to force a particular falsey value (like "" or whatever), any falsey value or "empty" value (say an empty array) is OK.

@Ven Hm. But it must be an "empty" value?

@gastropner edited: "No extraneous moves after treasures were all collected are allowed."

APL (Dyalog Extended), 132 bytes
Saved 16 bytes by having the function ouput 1 0,0 1,¯1 0,0 ¯1 instead of U,L,D,R. TIO link below decodes output back to letters.
I may write an explanation later, but most of the work is creating a graph in a format that the dfns path function likes, then using it to find successive shortest paths between the start and all treasures. Quite efficient, but because treasures are pathed left-to-right, top-to-bottom instead of being based on proximity, the answers are not optimal.

{z←×`/d←⍴⍵⋄g←z⍴⊂⍬⋄s t m←(⍸∘∊⍵=⊢)¨'PTM'⋄f←{(⍵∊m)∨0=⍺:⍬⋄g[⍺],←⍵}⋄h←(f`⍨,f)⋄⍬≡t⊣{2h`/⍵⊣2h`⌿⍵}x←d⍴⍳z:⍬⋄⊃,/⊃,/2-/¨{⍸x=⍵}¨¨2(g⌂path,)/s,t}

Try it online!

Would love an explanation :-).

PHP, 385 335 307 270 256 bytes
function c(&$m,$x,$r=-1,$d=0){if($r<0)$r=array_search(P,$m);$m[$r]=V;if(!in_array(T,$m))die;foreach([$r%$x?$r-1:-1,$m[$r-$x]?$r-$x:-1,$m[$r+$x]?$r+$x:-1,$r%$x<$x-1?$r+1:-1]as$o=>$n)if($n>=0&$m[$n]!=M&$m[$n]!=V){echo LUDR[$o];c($m,$x,$n,$o);}echo RDUL[$d];}

Try it online!
Uses a recursive depth-first search to crawl the map until all treasures are found.
Input is a one-dimensional array map and number of columns, example: c( $map, 13 );.
Output is to STDOUT as L,R,U and D.
Or 242 bytes to output as numbers (but I prefer the letters).
Ungolfed
function c( &$m, $x, $r=-1, $d=0 ) {

    // locate starting room ($r) on first move
    if( $r < 0 )
        $r = array_search( 'P', $m );

    // mark square on map ($m) with V to show it has been visited
    $m[ $r ] = 'V';

    // end if no more treasures
    if ( ! in_array( 'T', $m ) )
        exit;

    // generate list of adjacent squares
    $dirs = [
        $r % $x ? $r - 1 : -1,            // Left
        $m[ $r - $x ] ? $r - $x : -1,     // Up
        $m[ $r + $x ] ? $r + $x : -1,     // Down
        $r % $x < $x - 1 ? $r + 1 : -1    // Right
    ];

    // consider valid directions for next move
    foreach ( $dirs as $o => $n )
        // if not a Wall or Mountain and not Visited
        if ( $n >= 0 and $m[ $n ] != 'M' and $m[ $n ] != 'V' ) {
            // display the direction
            echo 'LUDR'[ $o ];
            // and recursively keep crawling
            c( $m, $x, $n, $o );
        }

    // reached a dead end, go back to previous square
    echo 'RDUL'[ $d ];   // display the reverse direction

}

Basic Case
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |M|M|M|T| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | |T| | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+

DDDDDRUUUUURDDRUURDDRUURDDDLDLLLDRRRRURUUUURDDDDDLRRU
Locked Up
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | |M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | |M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T| | |M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+

DDRUURDD
No Treasure:
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|P|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

   (no output)
No way to move
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M|M|M|M|M|M|M|M|M|M|M|P|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

  (no output)
The world is a giant treasure
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|P|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T|T|T|T|T|T|T|T|T|T|T|T|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

LLLLLLUURDRURDRURDRURDDDLLLLLLLDDRURDRURDRURDRURUUUURDDDDDLRRUUUUURDDDDDRUUUUU
1x1
+-+
|P|
+-+

  (no output)
Back Alley
DDDDDRUUUUURDDDDDRUUUUURDDDDDRUUUUURDDDDDRUUUUURRRRRLLLLLDDRRRRRLLLLLDDRRRRR
Hedge Maze (an original creation)
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P|M| |T|M| | | |M| |M|M|T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |M| |M| | |M|T|M|T| | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T| | |M| |M| |T|M|M|M| |M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M| | | |M| |M|M| | | |M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|T| | |M| |M| | | | |M| |M|
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|M|M| |T| | |M|M|M|M|M| |T|
+-+-+-+-+-+-+-+-+-+-+-+-+-+

DDRRUURLDDDDLLRRDRRUULRUURURRDDLDDRRRURRUULLUDRRRUDLDDDDR

JavaScript (ES6),  187 183  173 bytes
Takes input as a matrix of characters. Returns an array of signed integers: -2 = down, -1 = right, 1 = left and 2 = up.
ff=(m,X,Y,p=[])=>/T/.test(m)?(g=u=>m.some((r,y)=>r.some((c,x)=>(r[o=c=='M'|c>u|(h=X-x)*h+(v=Y-y)*v^c!='P'?0:f(m,x,y,1/X?[...p,h+2*v]:p,r[x]=3-~r[x]),x]=c,o)))?O:g(-~u))``:O=p

Try it online!
(with the output translated back to L, R, U, D)
How?
This AI:

Is definitely more artificial than intelligent.

Rushes like a mad man in the map (i.e. implements a depth-first search).

Stops as soon as there are no more treasures, but otherwise does not care about the positions of the remaining treasures. This test is done with a regular expression.
  /T/.test(m)

Compares the quadrance between its current position \$(X,Y)\$ and a new position \$(x,y)\$ with \$1\$ to know whether it can move there. Or tests if the cell contains "P" if its position is not yet defined.
  (h = X - x) * h + (v = Y - y) * v ^ c != 'P'

Writes \$4N\$ on a cell that has been visited \$N\$ times and uses this threshold combined with an internal counter \$u\$ to decide -- in a sudden flash of lucidity -- whether it should backtrack over already visited cells when everything else failed.

+1 for the "Is definitely more artificial than intelligent." xD And it may not be intelligent, but based on the run-time it's definitely fast.

Python 2, 233 bytes
G=input()
e=enumerate
P=T=M=E=frozenset()
for i,k in e(G):
 for j,l in e(k):exec l+'|={(i,j)}'
G={0}
c=-1
while T-G|G&M|G-E-T:
 G-=G;e=list(P)[0];x=c=c+1;r=()
 while x:m=x%5%4;x/=5;r+=m,;e=~-m%2*~-m+e[0],m%2*(m-2)+e[1];G|={e}
print r

Try it online!
Very slow. Most of the test cases would probably time out.
 MPTLRUD → EMPT1302. Any other characters should be considered to be prefixes, separators or postfixes.

Python 3, 766 622 bytes
def f(s,W,H):
 Z=enumerate;I=[("L",-1),("R",1),("D",1j),("U",-1j)];o="";P,M,T=map(lambda t:{x+y*1jfor y,l in Z(s)for x,c in Z(l)if c==t},'PMT');E=D={c:{t:0}for t,c in Z(T)}
 while len(E):
  E={}
  for m,N in[(c+d,D[c])for c in D for _,d in I if not c+d in M]:
   if 0<=m.real<W and 0<=m.imag<H:
    T={t:N[t]+1for t in N if not m in D or not t in D[m]}
    if any(T)or not m in D:
     E[m]=T
  for m in E:
   if m in D:
    D[m].update(E[m])
   else:
    D[m]=E[m]
 for m in P:
  if m in D:
   for g in D[m]:
    while D[m][g]:
     for i,d in I:
      if m+d in D and D[m+d][g]<D[m][g]:
       o+=i;m=m+d;break
 return o

Try it online!
Fairly certain after this that I will never win code-golf, but contributing because I enjoyed the exercise.
This version works by building a dictionary of reachable locations, with each entry being a dictionary whose keys are a unique ID for the treasure, and whose value is the shortest distance to that treasure.  The code supports multiple values for P: for each one it outputs a path that collects the treasures.  No optimization is attempted.. it picks the nearest treasure from its current location until all treasures are collected.

Can reduce it by 5 bytes by using e=enumerate, and adjusting 1 space after any(T)

You can often put an if statement and the line to execute on the same line e.g. if any(T)or not m in D:E[m]=T.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Find all diagonal counts in only one direction
If I need to get the number of diagonal squares in all directions:

I do the following formula 2 N − 2 − |x − y| − |x + y − N − 1|
The above example has 13 and that's what the formula gives.
Now, what if you wanted to get the diagonal squares, but only in one direction?
The top right has 4 squares, the top left has 3, the bottom left has 3 and the bottom right has 3.
Assume I have that program to compute all legal diagonals for the Queen, and as I demonstrated above I can get all diagonals by one step using above formula, written like :
int positiveDiagonal = Math.abs(r_q - c_q);
int negativeDiagonal = Math.abs(r_q + c_q - n - 1);
int totalDiagonal = 2 * n - 2 - positiveDiagonal - negativeDiagonal;

So, assume there is a soldier on position (5,5), that's make the Queen can't move to others diagonals in the same direction with total 4 count.
Sample Input - 1:

Board length = 8
Queen on position (4, 4)
There is no soldiers.
Explanation :

Because there is no pieces (soldiers), we just get all diagonals we calculated using our formula.

Output - 1: 13

Sample Input - 2:

Board length = 8
Queen on position (4, 4)
There is a soldiers on point (5, 3)
Explanation :

Because there is a piece or whatever, on point (5, 3), The Queen can't go to (5, 3), (6, 2) and (7, 1).

Output - 2: The total diagonals we got from formula is 13 and by calculating the soldier diagonals [The steps that queen can't go through], the result would be  10.

Sample Input - 3:

Board length = 5
Queen on position (5, 5)
There is a soldiers on point (1, 1)
Explanation :

Because there is a piece (soldier), on point (1, 1), The Queen can't go to that square.

Output - 3: By subtracting this square from total diagonals which equal 4 it's results  3

Sample Input - 4:

Board length = 5
Queen on position (3, 3)
Soldiers on positions (5, 5) , (2, 1), and (4, 4)
Explanation :

Because there is a piece (soldier), on point (5, 5) and (4, 4), The Queen can't go to these squares.

Output - 4 = 6

Welcome to PPCG! This is actually pretty close to be a valid submission for this site, but you should rephrase it as a programming challenge with a description of the input and the expected output rather than a generic programming question. If it is however intended as the latter, Stack Overflow would be a better option (or maybe math.stackexchange.com).

@Arnauld Thank you, I will rephrase it.

@Arnauld Not sure if this is on topic on Stackoverflow either.. Looks more like a math program, since OP is looking for a formula to calculate the diagonal lengths (which could be solved with a program of course, but could also be solved with a formula like OP did for both diagonals). I agree that it could be a nice code-golf challenge if reworded a bit however.

Provide a standard way for input and output - input could be position of queen and which diagonal, output could be length of diagonal, just a suggestion. But you will need to provide sample inputs and outputs. Do that, and I can almost promise you someone will figure it out.

@Stephen I added examples, I hope that's clear now.

You should remove the horizontals and verticals from your graphic, to avoid confusion.

Can there ever be more than one "soldier" on the board?

@Shaggy Yes, there is can be many soldiers on the board, I will edit the question , sorry.

What is a 'soldier'? Does it matter? It seems to just be a piece blocking the way.

@Riker Yes, we called it soldier, I don't why it's off-topic

You say "There is may a way to calculate that via loops, but I really prefer formulas as it's saving much time and efforts", but with [tag:code-golf] you don't get to determine what method people use. Maybe that part should be removed or rephrased, as I'm not really sure what it adds to the question.

@IbrahimAli I voted as off-topic, but I should've voted as unclear. I don't understand exactly how this is supposed to work. Could you possibly provide a short example program (or pseudocode)? I'm uncertain what square we're counting.

Err, shouldn't you be using the bishop as the example piece, rather than the queen?

Does "Assume I have that program to compute all legal diagonals" mean that we have a free function to calculate $2N-2-|x-y|-|x+y-N-1|$? Is "Now, what if you wanted to get the diagonal squares, but only in one direction?" relevant at all? Why does the last example give 5 rather than 6?

@JoKing In old image, There was up and down steps, but someone suggest to remove these steps.

@PeterTaylor I just showing what I achieved, and you are correct, last example should be 6, my fault.

I think the problem with the phrasing is that the title and the first few sentences imply that you're figuring out the amount of accessible diagonal squares in one direction, and then the very last sentence throws in other pieces out of nowhere. You should reword the title to something like "How many places can my bishop go?" and remove references to moving in one direction

@JoKing You're right, The examples doesn't demonstrate what Exactly I need, It can be "How many places can my bishop go in one direction?", because I can get diagonals already in all direction, I will edit it for further explanation.

Jelly, 41 37 bytes
æ.µṬ+ḢṬ$+⁴²x@0¤s⁴µŒD;UŒD$ṣ€1Ẏ=2Ẹ$ƇF¬S

Try it online!
A dyadic link that takes as its left argument the zero-indexed positions of the queen and any soldiers as a list (queen first, any subsequent entries a solider) and as right argument the board size. Returns an integer that represents the number of squares available for moves on the diagonal.
Explanation
æ.                                    | dot product of piece positions with board size, right-padded with 1
  µ                                   | start new chain with this as input
   Ṭ                                  | make a boolean array with 1 at the position of each piece
    +ḢṬ$                              | and add the same again for the Queen so the Queen has a 2
        +⁴²x@0¤                       | expand to the board dimension square with zeroes
               s⁴                     | split into lists the length of the board dimension
                 µ                    | start a new chain
                  ŒD;UŒD$             | concatenate the diagonals and the diagonals of the flipped board
                         ṣ€1          | split at soldiers
                            Ẏ         | tighten (make a single list of lists)
                             =2Ẹ$Ƈ    | filter keeping only those diagonals with the Queen in
                                 F¬S  | count the number of zeroes

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Would this string work as string?
Write a program that takes a single line string that you can assume will only contain the characters /\_‾. (That's forward and backward slash, underline and overline. You can use ~ in place of overline if you need since overline is not convenient ASCII.)
For example, one possible input is:
__/‾‾\/\_/‾

Your program needs to output a truthy or falsy value depending on whether the left edge of the string is "connected", so to speak, to the right edge of the string via the lines of the characters. So, if the kerning was a bit less, there would be a solid black (albeit kinky) line all the way from the left edge to the right, like an unbroken piece of string or twine.
The output for the above example would be true because the edges are connected:

To be clear on the connections:

/ connects on its bottom left and top right
\ connects on its top left and bottom right
_ connects on its bottom left and bottom right
‾ (or ~) connects on its top left and top right

Also:

It doesn't matter whether the edges of the string started on the top or the bottom, it only matters that they connect horizontally through the whole length of the string.
You can assume the input string is non-empty, and of course just one line.

Here are some more examples followed by 1 (truthy) if they are connected or 0 (falsy) if not:
__/‾‾\/\_/‾
1

_
1

\
1

/
1

‾
1

___
1

\/
1

/\/
1

/\/\
1

‾‾‾
1

\\
0

‾‾
1

_‾
0

‾_
0

\_____/
1

\/\\/\\___
0

\/\__/‾‾\
1

______/\_____
1

‾‾‾‾‾‾\\_____
0

‾‾‾‾‾‾\______
1

_____/‾‾‾‾‾
1

\___/‾‾‾\___/‾‾‾
1

\_/_\_
0

\_/\_
1

/\/\/\/\/\/\/\/\/\/\/\/
1

____________________
1

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
1

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾/
0

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾\
1

/\‾/\‾___/\_\/__\/\‾‾
0

The shortest code is the winner.

Welcome to PPCG! Nice first challenge.

Are the characters specified in your challenge the only ones that will appear in the string?

@EmbodimentofIgnorance Yes, only the 4.

Wait you could make a language out of this

Vaguely related.

@Arnauld No, I really think only truthy for connected and falsy for unconnected. (Unless allowing a swap is normal for this kind of question?)

@DiscreteGames No, this is not a default rule or practice for this tag. Some challenges allow it, but this is left at the sole discretion of the OP.

Is there a max length limit?

@smci No, the input string should be able to be very long, in the thousands of characters (but below string length limits of an average language).

Jelly, 9 bytes
-1 byte thanks to @EriktheOutgolfer
Expect ~ instead of ‾. Returns \$0\$ or \$1\$.
O*Ɲ:⁽8ƇḂẠ

Try it online!, Truthy test suite, Falsy test suite
Using this formula (but otherwise similar to the 11-byte version below):
$$n=\left\lfloor\frac{x^y}{15145}\right\rfloor$$
The transition is valid if \$n\$ is odd, or invalid if \$n\$ is even.
Commented
O*Ɲ:⁽8ƇḂẠ     - main link, taking a string          e.g. "\_/"
O             - get ASCII codes                     -->  [92, 95, 47]
 *Ɲ           - exponentiation on all pairs         -->  [92**95, 95**47]
   :⁽8Ƈ       - integer division by 15145           -->  [23964828…8421, 59257069…0485]
       Ḃ      - least significant bit (i.e. parity) -->  [1, 1]
        Ạ     - all values equal to 1?              -->  1

Jelly,  14 12  11 bytes
Supports (and expects) the ‾ character in the input string. Returns \$0\$ or \$1\$.
O*Ɲ%276%7ỊẠ

Try it online!, Truthy test suite, Falsy test suite
How?
Given two consecutive characters of ASCII codes \$x\$ and \$y\$, we want a function that checks whether they form a valid transition.
We need a non-commutative operation, because the result may change when the characters are reversed. For instance, _/ is valid but /_ is not.
Using exponentiation, a possible formula1 is:
$$n=(x^y \bmod 276)\bmod 7$$
The transition is valid if \$n\le1\$, or invalid if \$n>1\$.
 chars |    x |    y | (x**y)%276 | %7 | valid
-------+------+------+------------+----+-------
   __  |   95 |   95 |      71    |  1 |  yes
   _/  |   95 |   47 |     119    |  0 |  yes
   _‾  |   95 | 8254 |     265    |  6 |   no
   _\  |   95 |   92 |     265    |  6 |   no
   /_  |   47 |   95 |      47    |  5 |   no
   //  |   47 |   47 |      47    |  5 |   no
   /‾  |   47 | 8254 |       1    |  1 |  yes
   /\  |   47 |   92 |       1    |  1 |  yes
   ‾_  | 8254 |   95 |     136    |  3 |   no
   ‾/  | 8254 |   47 |      88    |  4 |   no
   ‾‾  | 8254 | 8254 |     196    |  0 |  yes
   ‾\  | 8254 |   92 |     196    |  0 |  yes
   \_  |   92 |   95 |      92    |  1 |  yes
   \/  |   92 |   47 |      92    |  1 |  yes
   \‾  |   92 | 8254 |     184    |  2 |   no
   \\  |   92 |   92 |     184    |  2 |   no

1. Found with a brute-force search in Node.js (using BigInts)
Commented
O*Ɲ%276%7ỊẠ   - main link, taking a string          e.g. "\_/"
O             - get ASCII codes                     -->  [92, 95, 47]
 *Ɲ           - exponentiation on all pairs         -->  [92**95, 95**47]
   %276       - modulo 276                          -->  [92, 119]
       %7     - modulo 7                            -->  [1, 0]
         Ị    - ≤1?                                 -->  [1, 1]
          Ạ   - all values equal to 1?              -->  1

lookup table method has won many a problem

9 bytes: ⁽"O is the same as 9580.

@EriktheOutgolfer Thanks. :) Maybe the script provided in this tip should be updated to support this format (when it's relevant).

@Arnauld Actually, Jonathan Allan has made this.

Ruby -n, 30 bytes
p !/[_\\][\\‾]|[\/‾][_\/]/

Try it online!
Reduces all of the string-breaking sequences to two cases using Regex character classes.

You can save 4 bytes by using ~ instead of ‾. I'm not sure if it matters for this challenge, since the character count is the same.

Do you need to escape the /s even though they are within square brackets?

JavaScript (ES6), 45 bytes
The naive way.
s=>!/\/\/|\\\\|_~|~_|~\/|_\\|\/_|\\~/.test(s)

Try it online!

So this is checking all the invalid pairings, making sure they don't exist in the string? Smart.

@DiscreteGames Yes, exactly. (Except that I forgot 2 of them. Now fixed.)

35 bytes: s=>!/[~\/][\/_]|[_\\][\\~]/.test(s). It checks if \/ or ~ end in \/ or _. And then, it check if \\ or _ end in \\ or ~.

@IsmaelMiguel This might be posted as a separate answer, but I'd better leave this one unchanged for reference, as it shows the simplest (as in 'least complicated') regular expression solving the problem.

You can post it as an alternative, but not definitive answer.

Python, 46 bytes
f=lambda s:s==''or s[:2]in"__/~~\/\_"*f(s[1:])

Try it online!
Confirms that each adjacent pair of characters connects by checking that they appear consecutively in __/~~\/\_. This string can be viewed as a De_Bruijn_sequence on the \$2^3=8\$ triples of high/low positions.
I tried other less humdrum methods to check character pairs, but they were all longer that hardcoding all legal pairs like this .

R, 89 87 81 78 bytes
-2 bytes thanks to @Giuseppe
-6 bytes thanks to @Nick Kennedy
-3 bytes replacing 1:length(y) with seq(a=y), where a is short for along.with
y=utf8ToInt(scan(,''));all(!diff(cumprod(c(1,y>93)*2-1)[seq(a=y)]*(y%%2*2-1)))

uses \ / _ ~. This is probably not as short as a regex based solution, but I fancied doing something a bit different to everyone else.
utf8ToInt('\\/_~')
# [1]  92  47  95 126

The characters less than  93 switch the state from up to down (or vice versa), and as such behave as -1 while the others do nothing and behave as 1, cumprod tracks the state with respect to the start. The even numbers are in an upstate (represented with -1), the odd numbers are in a down state (1). If the string is unbroken the tracked state multiplied with the up/down position, should not change, it will always be the starting condition (-1,or 1)
Try it online

this is quite clever, and a unique R way of doing things! I believe you can remove the () around y%%2 to save 2 bytes, since the special operators %(any)% have a rather high precedence.

How about tio for 83 bytes? Takes advantage of the implicit coercion to logical by !

C (gcc), 93 bytes
w,o,r;k(char*_){for(r=0;w=*_,o=*++_;)r|=w-126&&w>47?w-95&&w-92?0:o>47&&o-95:o-92&&o<126;_=r;}

Try it online!

I appreciate the w,o,r;k.

05AB1E, 29 14 9 bytes
ÇümŽb‘÷ÈP

Port of @Arnauld's Jelly answer, so make sure to upvote him as well!
Input with ‾.
Try it online or verify all test cases.

Original 29 bytes answer:
„_~SD2×s:Çü-т+•6_üê{â†•ƵΔвåO_

Input with ~ instead of ‾.
It sounded shorter in my head.. Will try to golf it down from here.
Try it online or verify all test cases.
Explanation:"
„_~S                          # Push the characters ["_","~"]
    D2×                       # Duplicate it, and increase each to size 2: ["__","~~"]
       s:                     # Swap and replace all "__" with "_" and all "~~" with "~"
                              #  in the (implicit) input-string
         Ç                    # Convert the remaining characters to unicode values
          ü-                  # Calculate the difference between each pair
            т+                # Add 100 to each
              •6_üê{â†•       # Push compressed integer 1781179816800959
                       ƵΔ     # Push compressed integer 180
                         в    # Convert the larger integer to Base-180 as list:
                              #  [52,66,69,100,103,131,179]
                          å   # Check for each if it's in the difference-list
                              # (1 if present; 0 if not)
                           O  # Sum the truthy values
                            _ # Check if this sum is exactly 0 (1 if 0; 0 otherwise)
                              # (and output this result implicitly)

See this 05AB1E tip of mine (sections How to comrpess large integers? and How to compress integer lists?) to understand why •6_üê{â†• is 1781179816800959, ƵΔ is 180 and •6_üê{â†•ƵΔв is [52,66,69,100,103,131,179].
Additional explanation:
There are 16 (\$2^4\$) possible pairs of characters we have to verify. If we convert each character to its unicode value, and calculate the differences, we would get these differences. Because compressed integer lists in 05AB1E has to have positive integers only, I add 100 to each. The invalid pairs and their corresponding values are then: ["/_", 52]; ["\~", 66], ["_~", 69], ["//", 100], ["\\", 100], ["_\", 103], ["~_", 131], ["~/", 179], which is why I have the compressed integer list in my code containing these values.
Since __ and ~~ will just like // and \\ result in 0 (or 100 after I add 100), I first remove any adjacent duplicates of ~ and _  in the input-string, before calculating and verifying the pair-differences.

Now 9 bytes.

@Arnauld Oh nice!

That explanation would work as a string.

@connectyourcharger What do you mean?

Python 3, 79 70 63 bytes
Saved 16 bytes thanks to Arnauld and Jo King, thanks!
p=lambda s:len(s)<2or((ord(s[-2])%13>5)^ord(s[-1])%2)&p(s[:-1])

Try it online!
Python 3, 67 60 bytes with ~ instead of ‾
p=lambda s:len(s)<2or(~(ord(s[-2])//7^ord(s[-1]))&p(s[:-1]))

Try it online!

Nice first answer! You can save 6 bytes by removing some white space. (You may want to add a TIO link, BTW.)

Thank you! I'm enjoying learning all these tricks

Chip -z, 17 bytes
FZ!C~aS
A}^]--^~t

Try it online! (TIO includes -v to make it easier to understand the output.)
Expects the _/~\ set. Returns either \x00 (falsy) or \x01 (truthy).
The strategy for my answer uses the following information:
Symbol  Binary
   _    0101 1111
   /    0010 1111
   ~    0111 1110
   \    0101 1100
          ^   ^ ^
        HGFE DCBA

A: This bit position happens to be 1 when the left side of the symbol is low, and 0 when it is high
F: This bit position happens to be 0 when the right side of the symbol is low, and 1 when it is high
C: This bit position happens to always be 1
Using this information, I simply need to check that the F of each character matches the not A of the next. An xor gate is a convenient way to accomplish this.
The following code does this, but gives output for each pairing (plus an extra 1 at the start) (7 bytes):
FZ!
A}a

We want to halt at the first failure, and also print whether we have halted within the string, or at the null terminator (we also add -z to give us a null terminator). We can use not C to signify where we stopped, and that gives us this program (13 bytes):
FZ!C~a
A}^]~t

But we still have "leading zeroes" (e.g. \_/\ gives 00 00 00 00 01), so this is transformed to the answer given at the top.

Nice, I'd noticed this pattern but didn't know a good language to exploit it.

Jelly,  13 12  11 bytes
O*Ɲ%⁽wḃ%5ỊẠ

A monadic Link accepting a list of characters, uses the ~ in place of ‾ option.
Try it online! Or see a test-suite (...where I've reordered to place the 8 falsey ones at the end)
This formula was found by fiddling around by hand :p  (as were those below)
For this one I too all 16 pairs of character's ordinals treated as an exponentiation and looked for a large modulo that will fit into three bytes followed by a one-byte modulo (1,2,3,4,5,6,7,8,9,10,16,256) that partitioned the 16 such that all of the acceptable results were either 1 or 0 ("insignificant") since I know Ị is shorter than <5, in my previous solution, which was looking for all acceptable results being less than all unacceptable ones.
O*Ɲ%⁽wḃ%5ỊẠ - Link: list of characters
O           - ordinals
  Ɲ         - for each pair of neighbours:
 *          -   exponentiate
    ⁽wḃ     - 30982
   %        - modulo (vectorises)
        5   - five
       %    - modulo (vectorises)
         Ị  - insignificant? (abs(x) <=1) (vectorises)
          Ạ - all truthy?

The possible neighbouring characters and their internal evaluations:
(Ɲ)         (O)            (*%⁽wḃ)        (%5)      (Ị)
pair   a,b=ordinals   c=exp(a,b)%30982   d=c%5   abs(d)<=1
__       95,  95         28471             1         1
_/       95,  47         29591             1         1
/~       47, 126         19335             0         1
/\       47,  92          9755             0         1
~~      126, 126         28000             0         1
~\      126,  92         26740             0         1
\_       92,  95          9220             0         1
\/       92,  47         13280             0         1
~_      126,  95          3024             4         0
~/      126,  47         12698             3         0
\~       92, 126         27084             4         0
\\       92,  92         17088             3         0
_~       95, 126         28169             4         0
_\       95,  92          4993             3         0
/_       47,  95         22767             2         0
//       47,  47          7857             2         0

Previous @ 12:
O*Ɲ%⁽?K%⁴<8Ạ

Try it online!

Previous @ 13:
O%7ḅ6$Ɲ%⁵%8ỊẠ

Try it online!

For some reason, I thought that Ị was testing abs(x)<1 rather than abs(x)≤1. This offers quite a few more opportunities. :) (I'm stuck at 11 bytes as well for now, though.)

I find that Ị comes in handy very often.

Python 3, 126 bytes
lambda s,d={'‾':'\‾','_':'/_','/':'\‾','\\':'/_'}:len(s)<2or all([s[i+1] in d[s[i]]for i in range(len(s)-1)if s[i]in d])

perl 5, 26 25 bytes
using ; as delimiter the end delimiter can be removed
$_=!m;[/~][_/]|[\\_][~\\]

TIO
26 bytes

R, 43 chars, 47 bytes
It's the same regex the other answers use, but adapted for R.
!grepl('[/‾][/_]|[\\\\_][\\\\‾]',scan(,''))

Try it online!
And obligatory xkcd.

you can use ~ in place of ‾ to get to 43 bytes, 43 chars.

True, but it's more fun with the overbar. :)

Haskell, 70 bytes
This variant uses ~ instead of overlines. It takes all eight valid pairs and checks whether the string only contains those:
f(a:b:x)=[a,b]`elem`words"__ _/ /~ ~~ ~\\ \\_ \\/ /\\"&&f(b:x)
f _=1>0

Try it online!
Ungolfed:
validate :: String -> Bool
validate xs = all valid $ zip xs (tail xs)
  where
    valid (a,b) = [a,b] `elem` starts
    starts      = words "__ _/ /~ ~~ ~\\ \\_ \\/ /\\"

Forth (gforth), 100 98 bytes
: x = swap '~ = + ;
: f 1 tuck ?do over i + >r i 1- c@ r> c@ dup 92 x swap dup 47 x <> + loop 0> ;

Try it online!
Explanation
Go through the string and determine whether each character starts on the same position (top or bottom) as the one before ends. Subtract 1 from a counter if they don't match. At the end, if the counter has changed, then the string is not a string.
End position is high if char is / (47) or ~ (126). Otherwise it's low
Start Position is high if char is \ (92) or ~ (126). Otherwise it's low
Code Explanation
\ x is basically just extracting some common logic out into a function to save a few bytes
\ it checks if the first number is equal to the second number
\ or the third number is equal to 126
: x                \ start a new word definition
  = swap           \ check if the first two numbers are equal then swap with the third
  '~ =             \ checks if the third number is equal to 126
  +                \ adds results together (cheaper version of or)
;                  \ end the word definition

: f                \ start a new word definition
  1 tuck           \ set up parameters for a loop (and create a bool/counter)
  ?do              \ start counted loop from 1 to string-length -1,
                   \ ?do will skip if loop start and end are the same
    over i +       \ copy the string address and add the loop index to get the char address
    >r i           \ place char address on return stack and place a copy back on the stack
    1- c@          \ subtract 1 to get previous char address and grab ascii from memory
    r> c@          \ move char address back from return stack, then grab from memory
    dup 92 x       \ get the "output" position of the prev character
    swap dup 47 x  \ get the input position of the current character
    <> +           \ check if they aren't equal and add the result to the counter
                   \ the counter won't change if they're equal
  loop             \ end the loop
  0>               \ check if counter is less than 1 (any of the "links" was not valid)
;                  \ end word definition

Perl 6, 32 bytes
{!/< \\\ \~ ~/ // _~ ~_ _\ /_>/}

Try it online!
A regex solution that simply checks that the string contains no invalid sequences.
Explanation:
{                              }   # Anonymous code block
  /<                         >/    # Find the longest sequence from
     \\\                           # \\
         \~                        # \‾
            ~/                     # ‾/
               //                  # //
                  _~               # _‾
                     ~_            # ‾_
                        _\         # _\
                           /_      # /_
 !                                 # And logically negate the match

Haskell, 42 bytes
g=tail>>=zip
h=all(`elem`g"__/~~\\/\\_").g

this solution uses ~, and the function to call is h (i.e., h string gives the answer)
The solution uses a function g that given a list, returns all tuples of adjacent values on the list.
Then we use g to generate the list of allowed neighbors (in g"__/~~\\/\\_") and also the list of all neighboring pairs in the input list. Then we check that each neighboring pair is an allowed pair.

C (gcc), 41 36 bytes
f(char*_){_=!_[1]||*_/32+*++_&f(_);}

Try it online!
-5 eliminated &1 starting off from an idea from Peter Cordes; changed operators (precedence) to remove parentheses

Uses ~. Checks the first and sixth bits of the first two characters' binary representations:
_ 1011111
\ 1011100
/  101111
~ 1111110
   ^    ^

and traverses the string recursively.
(*_ / 32) & 1 is true only for chars that end high, while *_ & 1 is true only for chars that start low.  (x&1) ^ (y&1) == (x+y)&1.  XOR is add-without-carry, and carry doesn't disturb the lowest bit.  The 1 comes from the f(_) return value, if the rest of the string was stringy.

Right shifting by 5 leaves the 6th bit at the bottom.  So you're checking bits 0 and 5, or the first and sixth bits.  (This is a really nice trick, BTW, well done.  c&32 is true for chars that end high, while c&1 is true only for chars that start low.)

I know the rules only require it to work on at least one implementation, but still worth pointing out that *_ ^ *++_ is undefined behaviour: ^ is not a sequence point, so there's no sequenced-before relationship guaranteeing they get different characters.  Of course it's also missing a return, so it only works with gcc -O0 where the function body is a statement-expression.

Oops, you're right about the bits. Thanks for catching that

Doing &1 twice is redundant.  (x^y)&1 == (x&1) ^ (y&1).  But given C operator precedence where & has higher priority than ^ (unlike arithmetic operators where + and - have the same priority), we'd need to add () 2 bytes to remove &1 2 bytes, because (x&1) ^ y is not equivalent.  But maybe using parens opens up opportunities for some other saving.  Fortunately not a problem for an x86 machine-code version of this, where the bit manipulation is very compact...

Finished my x86 machine code answer, 13 bytes using this algorithm.

Python 3, 80 78 bytes
I don't realy do many python code golfs but I thought I could give it a try

-2 bytes: realised not(any()) is the same as all(not()) and could move the not into the r-string

def f(x):*l,=map(r'_/\~'.find,x);return 1-any((i^j//2)%2for i,j in zip(l,l[1:]))

Try it online!
Python 3.8 (pre-release), 71 bytes
I wanted to try out the new := expression assignment
lambda x:all((i^j//2)%2for i,j in zip(l:=[*map(r'\~_/'.find,x)],l[1:]))

Try it online!

Bash, 30 bytes
grep -E '//|\\\\|_~|~_|~/|_\\|/_|\\~'

Input is STDIN. Exit code is 1 if valid, 0 if invalid.

Excel, 150 bytes
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"_\",),"_‾",),"‾_",),"‾/",),"/_",),"//",),"\‾",),"\\",)=A1

Removes any invalid pairs, then return true if this results in the original string.

Retina, 24 bytes
C`[_\\][\\~]|[~/][_/]
^0

Try it online!
Uses ~ rather than ‾, because that made it easier to type.

-2 bytes by removing some unnecessary backslashes (thanks to @Neil)

I don't think you need the backslashes before the slashes.

@Neil Apparently I don't, thanks for pointing it out!

If you use ~ instead of ‾, shouldn't that also be the case for your input in your TIO?

SNOBOL4 (CSNOBOL4), 58 bytes
	INPUT '/_' | '_\' | '\\' | '//' | '~/' | '\~' @OUTPUT
END

Try it online!
Outputs nothing for truthy and a positive integer (indicating the position of the first break in the string) for falsy.

Charcoal, 32 18 bytes
⌊⭆θ∨¬κ⁼№_/ι№\_§θ⊖κ

Try it online! Link is to verbose version of code. Explanation:
  θ                 Input string
 ⭆                  Map over characters and convert to string
     κ              Current index
    ¬               Logical Not (i.e. is zero)
   ∨                Logical Or
          ι         Current character
       №            Count (i.e. contained in)
        _/          Literal _/ (i.e. begins at bottom)
      ⁼             Equals
               θ    Input string
              §     Indexed by
                 κ  Current index
                ⊖   Decremented (i.e. previous character)
           №        Count (i.e. contained in)
            \_      Literal \_ (i.e. ended at bottom)
⌊                   Minimum (i.e. if all true)
                    Implicitly print

Regex, 34 bytes
I couldn't find rules on using Regex as a language.  Please let me know if I need to adjust this.
^(‾+|(‾*\\)?(_*\/‾*\\)*_*(\/‾*)?)$

Try it here: https://regex101.com/r/s9kyPm/1/tests

That's 34 bytes, not 24, right?

Well, really 42 bytes, but you can change ‾ to ~

x86 machine code, 13 bytes.
(Or 11 bytes without handling single-character strings that are trivially stringy.)
Uses the bit-position check from @attinat's C answer
Same machine code works in 16, 32, and 64-bit modes.  The source is NASM for 64-bit mode.
nasm -felf64 -l/dev/stdout  listing
    17   addr                  global string_connected
    18           code          string_connected:
    19           bytes         ;;; input: char *RSI, transitions to check=RCX
    20                         ;;; output: AL=non-zero => connected.  AL=zero disconnected
    21                         .loop:                      ; do {
    22 00000000 AC                 lodsb                   ;   al = *p++
    23 00000001 E309               jrcxz  .early_exit        ; transitions=0 special case.  Checking before the loop would require extra code to set AL.
    24 00000003 C0E805             shr    al, 5
    25 00000006 3206               xor    al, [rsi]          ; compare with next char
    26 00000008 2401               and    al, 1
    27 0000000A E0F4               loopne .loop            ; }while(--rcx && al&1);
    28                         .early_exit:
    29 0000000C C3                 ret

Callable from C as unsigned char string_connected(int dummy_rdi, const char *s, int dummy_rdx, size_t transitions); with the x86-64 System V calling convention.  Not bool because the transitions=0 case returns an ASCII code, not 1.
RCX = len = strlen(s) - 1.  i.e. the number of character-boundaries = transitions to check in the explicit-length string.
For transitions > 0, returns 0 (mismatch) or 1 (connected) and leaves ZF set accordingly.  For transitions == 0, returns the single byte of the string (which is non-zero and thus also truthy).  If not for that special case, we could drop the early-exit JRCXZ.  It's inside the loop only because AL is non-zero there.

The bit-position logic is based on the observation that bit 0 of the ASCII code tells you the starting height, and bit 5 tells you the ending height.
;;;  _ 1011111
;;;  \ 1011100
;;;  /  101111
;;;  ~ 1111110
;;;     ^    ^

    ; end condition (c>>5) & 1 =>  0 = low
    ; start cond: c&1 => 0 = high
    ; (prev>>5)&1 == curr&1  means we have a discontinuity
    ; ((prev>>5) ^ curr) & 1 == 0  means we have a discontinuity

Test harness (modified from attinat's TIO link, beware the C sequence-point UB in that C reference function).  Try it online!.  This function is correct for all 30 cases.  (Including the single-character cases where the return value doesn't match: both are truthy with different non-zero values in that case.)

Excel, 79 bytes
Cell A1 as input
=1---SUMPRODUCT(--ISNUMBER(FIND({"//","/_","\~","\\","~/","~_","_\","_~"},A1)))

naz, 142 bytes
2a2x1v4a8m1s2x2v2m2s2x3v3a2x4v3d4m2a2x5v1x1f1r3x2v2e3x3v3e3x4v3e2f0x1x2f1r3x1v4e3x3v3e3x5v2e0m1o0x1x3f1r3x1v4e3x2v2e3x4v3e0m1o0x1x4f0m1a1o0x1f

Another answer with a lot of conditionals - so many, in fact, that halfway through writing the explanation for a 206-byte solution, I realized an optimization I could make to achieve this one.
Works for any input string terminated with the control character STX (U+0002). ~ is expected instead of ‾.
Explanation (with 0x commands removed)
2a2x1v                       # Set variable 1 equal to 2
4a8m1s2x2v                   # Set variable 2 equal to 47 ("/")
2m2s2x3v                     # Set variable 3 equal to 92 ("\")
3a2x4v                       # Set variable 4 equal to 95 ("_")
3d4m2a2x5v                   # Set variable 5 equal to 126 ("~")
1x1f                         # Function 1
    1r                       # Read a byte of input
      3x2v2e                 # Jump to function 2 if it equals variable 2
            3x3v3e3x4v3e     # Jump to function 3 if it equals variable 3 or variable 4
                        2f   # Otherwise, jump to function 2
1x2f                         # Function 2
    1r                       # Read a byte of input
      3x1v4e                 # Jump to function 4 if it equals variable 1
            3x3v3e           # Jump to function 3 if it equals variable 3
                  3x5v2e     # Jump back to the start of the function if it equals variable 5
                        0m1o # Otherwise, output 0
1x3f                         # Function 3
    1r                       # Read a byte of input
      3x1v4e                 # Jump to function 4 if it equals variable 1
            3x2v2e           # Jump to function 2 if it equals variable 2
                  3x4v3e     # Jump back to the start of the function if it equals variable 4
                        0m1o # Otherwise, output 0
1x4f0m1a1o                   # Function 4
                             # Output 1
1f                           # Call function 1

Dart, 94 bytes
f(s)=>!(r'//,\\,~/,_\,~_,_~,/_,\~'.split(',').map((t)=>s.contains(t)).fold(false,(p,e)=>p|e));

Try it online!

APL+WIN, 58 bytes
m←2 2⊤'_/\~'⍳s←,⎕⋄(1+⍴s)=+/((↑m[0;]),m[1;])=m[0;],¯1↑m[1;]
Prompts for input of string, index origin 0 and uses ~ for upper character
Try it online! Courtesy of Dyalog Classic

C++, 132 110 109 bytes
-22 bytes thanks to ASCII-only
-1 byte thanks to Adalynn
-9 bytes thanks to ceilingcat
TIO Link
int f(char*s){int t[128]={},u=0;t[47]=1;t[92]=2;t[126]=3;for(;*++s;)u+=t[s[-1]]%2^t[*s]/2;return!u;}

Uses a bitmask to know if the start and end are up or down

hmm. wouldn't porting the C version be golfier :P

114

110

109

100 bytes

TSQL code, 90 bytes
declare @ varchar(99)='__/‾‾\/\_/‾'

while len(@)>1set
@=iif(charindex(left(@,2),'__/\/‾‾\_')=0,'',stuff(@,1,1,''))print
len(@)

Try it out
TSQL query, 119 bytes
use master
declare @ varchar(99)='/\/\_/‾\'

SELECT top 1sign(charindex(substring(@,number,2),'__/\/‾‾\_'))FROM
spt_values
WHERE number<len(@)and'P'=type
ORDER BY 1

Try it out

Scala, 75 bytes
def f(s:String)="""[^/\\_~]|[/~][/_]|[\\_][\\~]""".r.findFirstIn(s).isEmpty

PHP, 67 bytes
for(;$s=$argn[$i++];)$f|=$l%3<1==($l=ord($s)%18%4)%2&&$i>1;echo!$f;

Try it online!
Created a non RegEx solution without looking at other solutions. Uses ~ character.
Converts each input character to a number from 0 to 3 using its ASCII code and mod 18 and mod 4:

~ (126) % 18 % 4 = 0
_  (95) % 18 % 4 = 1
\  (92) % 18 % 4 = 2
/  (47) % 18 % 4 = 3.

Loops on each character and current character's converted ASCII mod 2 is compared with previous character's converted ASCII mod 3 < 1 and they shouldn't be equal for all characters so it can be a valid string.
~ | Converted ASCII (CA) = 0 | CA % 3 < 1 = 1 | CA % 2 = 0
_ | Converted ASCII (CA) = 1 | CA % 3 < 1 = 0 | CA % 2 = 1
\ | Converted ASCII (CA) = 2 | CA % 3 < 1 = 0 | CA % 2 = 0
/ | Converted ASCII (CA) = 3 | CA % 3 < 1 = 1 | CA % 2 = 1

Since CA % 3 < 1 (previous character) and CA % 2 (current character) shouldn't be equal, only valid combinations will be these: ~~, ~\, __,  _/,  \_,  \/,  /~,  /\ and if a string has a combination other than those, it will be invalid.

Thunno, \$ 16 \log_{256}(96) \approx \$ 13.17 bytes
ODZTz.^15145,2%P

Attempt This Online!
Port of Arnauld's Jelly answer. Expects ~ instead of the overline.
Explanation
ODZTz.^15145,2%P  # Implicit input
O                 # Ordinals
 DZT              # Duplicate and push ords[1:]
    z.^           # Exponentiation
       15145,     # Integer divide each by 15145
             2%   # Mod by 2
               P  # Check if all are 1
                  # Implicit output

Swift 5.9, 50 bytes
let f={!($0+"").contains(#/[~/][/_]|[_\\][\\~]/#)}

The obvious method.


text:
Convert ASCII art numbers to integers
Inspired by this game
Challenge:
Given an ASCII art string representing a number, output that number.
Example:
Input:

  &&&&      #####    .====..    .&&&
 $$$$$.    %%   %%   %    % .   +. .
   @@@  .      @@ .  = .  =   . ????
   +++.    &&   &&.  %    %     =   =
   $$$    . @@@@@    #    #  .  ===.
 .$$$$$              .????.

Output: 1306

Input:

  ====     .$$..      &&&&&&.    .@@@@    ?????
 +++++     &. &           $$    %%   %%  &&   &&
   $$$     .==.          @@ .   @@   @@ .    ??
.  ### .   @  @  .      ==     $$$$$$$$  ??. .??
. .@@@.    .%%.        ==           .$$   &&&&&  .
  $$$$$. .            .%        .    @@ .

Output: 18743

Periods are interference, you can ignore them

The complete list of numbers:
 &&&&
%    %
=    =
%    %
#    #
 ????

 &&&&
$$$$$
  @@@
  +++
  $$$
 $$$$$

 #####
++   ++
 #  ##
   @@
  @@
???????

 #####
%%   %%
    @@
&&   &&
 @@@@@

   @@@@
 %%   %%
 @@   @@
$$$$$$$$
      $$
      @@

######
$
####
    +
    ?
$$$$$

 &&&
+
????
=   =
===

&&&&&&
    $$
   @@
  ==
 ==
 %

 $$
&  &
 ==
@  @
 %%

 &&&&
@    @
 &&&&
    $
    &
  +

Rules:

Your input is a string unless your language doesn't have a string type.
The input is guaranteed to be exactly 6 characters "high." Numbers such as 8 and 3 have a whitespace buffer UNDER the number.
If you write a function, it MUST return a numerical type.
The ASCII art can be composed of ANY printable characters in no particular order (remember, you can ignore periods).
No standard loopholes.
Your program must handle any arbitrary ASCII number of reasonable length (as long as the result fits within a 32-bit signed integer).
Input is guaranteed valid, undefined behavior is allowed with bad input.
This is code-golf, shortest program wins.

More tests:

  $$$$     ######     @@@@  . .  .%%%%    #####
 #####     $ .       =====..  . ##   ##  ++   ++
   +++     ####.       +++.     ==   ==   #  ##
   ===     .   +       ###  .  ========.    @@
  .&&&    .  . ?   . . @@@           ##    @@    .
  %%%%%    $$$$$      #####          @@  ???????

> 15142

 .&&&&.    ??????     @@@@@      .++++
 @    @    + .       ==   ==    %%   %%
 .&&&&.    ####..     =  == .   ++   ++
  .. $         &        $$     $$$$$$$$.
 .   &.      . #       && .          ##
   +.   .  #####     $$$$$$$        .==

> 9524

As far as I can tell, the set of valid number characters is &$@+#%=?. Are there any other characters that are valid? Will each row in a number always contain the same character?

@Stephen I updated the question. The numbers can be composed of any printable characters in no particular order.

Can a period . appear as both a part of the character and a part of interference?

@AdmBorkBork periods are always interference. They are not part of the number.

I'm not sure that "periods are interference" really adds much to the challenge.

Is it the case that all digits are 8 characters wide and will have a single leading and (optionally) trailing column of spaces? (the examples seem to adhere to this)

...and is the input guaranteed to be 6 characters high? (...or do we need to handle inputs like 863 being only 5 high?)

@JonathanAllan that is correct (6 high & 8 wide). I've edited the question. The periods are there because my source for the numbers puts them in randomly, so I kept them. It might not add much to the challenge, but it is what it is /shrug

The 2 in the tests is different to the 2 in the sample digits

@NickKennedy fixed

Is the trailing space at the end of the first line of the 0 intentional?

I think AdmBorkBork's question was not "are periods always interference?" but rather "can there be a period where a non-space character should be?" I assume (as have current answers) that they can only appear where spaces are meant to appear (and hence why I said I din't think it added much to the challenge).

Is it ok to take the input as a list of strings?

@NickKennedy strings only, no arrays ;)

@EmbodimentofIgnorance the space is intentional for formatting purposes (example: 2019). If it wasn't there, the top row would be offset by a character making the subsequent numerals look odd.

Unless we are meant to handle the 8-digit wide digits being aligned at different points within a 10 character wide window then the first two examples are incorrectly aligned. From the two tests it looks like the alignment is meant to be a leading column of space/dot and then the 8 character wide digit and then a trailing column of space/dot. Also I assume, but should probably confirm with you, that it is OK to assume the input will have all the trailing spaces on each line, is it?

@JonathanAllan that's fine. 8 column numerics are "centered" using empty columns. You can ignore it if you wish.

...so the first two are formatted incorrectly?

see also Read ASCII-Art Text

@mazzy nice, I didn't see that.

Jelly, 35 33 34 bytes
Ỵe€€⁾ .¬ZḄṣ0§ḟ0%29“h½sØ?X’ḃ26¤iⱮ’Ḍ

Try it online!
When I started writing this, The question didn’t specify that the width of digits was fixed, so my answer doesn’t make that assumption.
Input is now a string (which costs a byte over having a list of strings). Output is an integer.
Explanation:
Ỵ                         | split at new lines
e€€⁾ .                    | For each character check whether it is a
                          | full stop/space or something else
      ¬                   | invert this
       Z                  | transpose
        Ḅ                 | convert from binary to decimal (one number per column of input)
         ṣ0               | split at zeroes (blank columns)
§                         | take the sum of each digit
 ḟ0                       | filter out remaining blank columns
   %29                    | take this number mod 29
      “h½sØ?X’ḃ26¤iⱮ      | look each digit up in a compressed list
                          | [18, 23, 6, 5, 1, 19, 13, 21, 8, 25]
                    ’     | subtract one
                     Ḍ    | convert to decimal

Minor note: The post is worded as "input must be a string", which I read as allowing a list of characters or taking input as a full program. As such I would ask if we may take a list of the lines.

@JonathanAllan fair enough. Ỵ added following response.

05AB1E, 34 bytes
'.ð:.B€SðÊøJC0¡O0K29%•!aˆM©м•₂вskJ

Port of @NickKennedy's Jelly answer, so make sure to upvote him!
PS: Knowing the width of the digits is pretty useless if the amount of space columns in between digits can vary..
Try it online.
Explanation:
'.ð:                              '# Replace all dots with spaces
    .B                             # Split on newlines
      €S                           # Convert each line to a list of characters
        ðÊ                         # Check of each character if it's NOT equal to a space
          ø                        # Zip/transpose; swapping rows/columns
           J                       # Join each column together
            C                      # Convert each from binary to an integer
             0¡                    # Split on 0s
               O                   # Sum each inner list
                0K                 # Remove 0s
                  29%              # Take modulo-29 on each
                     •!aˆM©м•      # Push compressed integer 102583844953589
                             ₂в    # Converted to Base-26 as list:
                                   #  [18,23,6,5,1,19,13,21,8,25]
                               sk  # Index the earlier number into this list
                                 J # Join everything together (and output implicitly)

See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why •!aˆM©м• is 102583844953589 and •!aˆM©м•₂в is [18,23,6,5,1,19,13,21,8,25].

Jelly, 29 bytes
⁾. yỴ=⁶s€⁵ZẎ€Ḅ:434ị“¡£:E’Œ?’¤

A monadic Link accepting a list of characters which yields a list of digits, or a full program accepting a single text argument which prints the digits.
(Requires padding on the right with spaces such that each digit has a width of ten characters, including the right-most one, which I believe is OK.)
Try it online! ...or try the other test case here.

Are you sure this works correctly? I copied the first test case, and it gives [1,3,4,8] instead of [1,3,0,6]. And I copied the second test case and it gives [1,5,4,4,4] instead of [1,8,7,4,3]..

@KevinCruijssen I copied the digits from the list yesterday, pre-pended a single space to each line of each of them and placed them together with a fixed-width of 10. The code does require trailing padding to 10 chars, but it looks like something else is different about the tests vs what I've done. I can't look now but if you can tell from my TIO input do let me know; I'll look later today...

@KevinCruijssen ...yeah the 2 has changed since yesterday! try it

@KevinCruijssen I believe the 1306 is formatted incorrectly and has the 6 too far to the right. try this

...this was exactly why I asked about the format yesterday :)

Hmm, it is your current input (and therefore your code that's based on it) which seems to be wrong. Your current 0-9 input in your TIO has an incorrect 7,8,9 shape (a space/dot is missing at that dotted line between 6 and 7). Adding that gives incorrect results as well (although copying your test with that added dot/space gives the correct result in the other two answers). Still don't know what the problem in your code is, but it's based on an incorrect test case, and that's where the problem mainly lies.

@KevinCruijssen thanks for digging! I'll be free to address it in 4 hrs or so...

@KevinCruijssen I believe this updated version works with the new 2 and that the first two examples are, in fact, misaligned ("8 column numerics are 'centered' using empty columns").


text:
Is this Pascal's Matrix?
In Pascal's triangle each number is the sum of the two numbers directly above it, treating empty spots as zero:

By rotating the triangle, we can cut out square matrices of varying sizes and rotations which I will call Pascal's matrices. Note that those matrices always need to contain the top \$1\$. Here are some examples:
1  1  1  1
1  2  3  4
1  3  6 10
1  4 10 20

6  3  1
3  2  1
1  1  1

1  5 15 35 70
1  4 10 20 35
1  3  6 10 15
1  2  3  4  5
1  1  1  1  1

1

1  1
2  1

The Task
Given a square matrix containing positive numbers in any reasonable format, decide if it is a Pascal's matrix.
Decide means to either return truthy or falsy values depending on whether the input is a Pascal's matrix, or to fix two constant values and return one for the true inputs and the other for false inputs.
This is code-golf, so try to use as few bytes as possible in the language of your choice. The shortest code in each language wins, thus I will not accept an answer.
Test cases
True
[[1, 1, 1, 1], [1, 2, 3, 4], [1, 3, 6, 10], [1, 4, 10, 20]]
[[6, 3, 1], [3, 2, 1], [1, 1, 1]]
[[1, 5, 15, 35, 70], [1, 4, 10, 20, 35], [1, 3, 6, 10, 15], [1, 2, 3, 4, 5], [1, 1, 1, 1, 1]]
[[1]]
[[1, 1], [2, 1]]

False
[[2]]
[[1, 2], [2, 1]]
[[1, 1], [3, 1]]
[[1, 1, 1, 1], [1, 2, 3, 4], [1, 4, 6, 10], [1, 4, 10, 20]]
[[6, 3, 1], [1, 1, 1], [3, 2, 1]]
[[2, 2, 2, 2], [2, 4, 6, 8], [2, 6, 12, 20], [2, 8, 20, 40]]
[[40, 20, 8, 2], [20, 12, 6, 2], [8, 6, 4, 2], [2, 2, 2, 2]]
[[1, 5, 15, 34, 70], [1, 4, 10, 20, 34], [1, 3, 6, 10, 15], [1, 2, 3, 4, 5], [1, 1, 1, 1, 1]]

Suggested test case: [[40, 20, 8, 2], [20, 12, 6, 2], [8, 6, 4, 2], [2, 2, 2, 2]]. My initial answer was incorrectly truthy for this one, but correct for all of the current test cases.

@KevinCruijssen Thanks, added.

Brachylog, 28 24 23 bytes
This feels quite long but here it is anyway

-4 bytes thanks to DLosc by compressing the optional flips
-1 bytes thanks to DLosc again by doing the partial sums in 1 go

{|↔}\↰₁{k{a₀ᶠ+ᵐ}ᵐ⊆?h=₁}
Explanation
{|↔}\↰₁{k{a₀ᶠ+ᵐ}ᵐ⊆?h=₁}       # Tests if this is a pascal matrix:
{|↔}\↰₁                       #     By trying to get a rows of 1's on top
{|↔}                          #       Through optionally mirroring vertically
     \                        #       Transposing
      ↰₁                      #       Through optionally mirroring vertically

       {k{a₀ᶠ+ᵐ}ᵐ⊆?h=₁}       #     and checking the following
                  ?h=₁        #        first row is a rows of 1's
        k{     }ᵐ             #        and for each row except the last
          a₀ᶠ+ᵐ               #          calculate the partial sum by
          a₀ᶠ                 #             take all prefixes of the input
             +ᵐ               #             and sum each
               ⊆?             #        => as a list is a subsequence of the rotated input

Try it online!

JavaScript (ES6), 114 bytes
m=>[m,m,m=m.map(r=>[...r].reverse()),m].some(m=>m.reverse(p=[1]).every(r=>p=!r.some((v,x)=>v-~~p[x]-~~r[x-1])&&r))

Try it online!

MATL, 17 bytes
4:"Gas2YLG@X!X=va

Try it online! Or verify all test cases.
Outputs 1 for Pascal matrices, 0 otherwise.
Explanation
4:      % Push [1 2 3 4]
"       % For each
  G     %   Push input: N×N
  a     %   1×N vector containing 1 for matrix columns that have at least a nonzero
        %   entry, and 0 otherwise. So it gives a vector containing 1 in all entries
  s     %   Sum. Gives N
  2YL   %   Pascal matrix of that size
  G     %   Push input
  @     %   Push current iteration index
  X!    %   Rotate the matrix that many times in steps of 90 degress
  X=    %   Are they equal?
  v     %   Concatenate with previous accumulated result
  a     %   Gives 1 if at least one entry of the vector is nonzero
        % End (implicit). Display (implicit)

Charcoal, 41 bytes
Ｆ‹¹⌈§θ⁰≔⮌θθＦ‹¹⌈Ｅθ§ι⁰≦⮌θ⌊⭆θ⭆ι⁼λ∨¬κΣ…§θ⊖κ⊕μ

Try it online! Link is to verbose version of code. Explanation:
Ｆ‹¹⌈§θ⁰

If the maximum of its first row is greater than 1,
≔⮌θθ

then flip the input array.
Ｆ‹¹⌈Ｅθ§ι⁰

If the maximum of its first column is greater than 1,
≦⮌θ

then mirror the input array.
⌊⭆θ⭆ι

Loop over the elements of the input array and print the minimum result (i.e. the logical And of all of the results),
⁼λ∨¬κΣ…§θ⊖κ⊕μ

comparing each value to 1 if it is on the first row otherwise the sum of the row above up to and including the cell above.

R, 104 bytes
function(m,R=row(m)-1,y=nrow(m):1,Z=choose(R+t(R),R))any(sapply(list(Z,Z[,y],Z[y,y],Z[y,]),identical,m))

Try it online!
Nasty...
Creates a canonical Pascal's matrix Z with dimensions equal to that of m, then tests if the input matrix m is identical to any of the rotations of Z.

Python 2, 129 bytes
f=lambda M,i=4:i and(set(M[0])=={1}and all(a+b==c for x,y in zip(M,M[1:])for a,b,c in zip(x[1:],y,y[1:]))or f(zip(*M[::-1]),i-1))

Try it online!
Returns True if M is a Pascal's Matrix, else 0.

Julia 0.7, 78 bytes
m->any(i->(n=rotr90(m,i))[1]<2&&all(cumsum(n)'[1:end-1,:]-n[2:end,:].==0),0:3)

Try it online!

05AB1E, 29 bytes
¬P≠iR}DøнP≠ií}¬PΘsü)ε`sηOQ}P*

Try it online or verify all test cases.
Explanation:
¬P≠i }        # If the product of the first row of the (implicit) input-matrix is NOT 1:
    R         #  Reverse the order of the rows
D             # Duplicate the resulting matrix
 øнP≠i }      # If the product of the first column is NOT 1:
      í       #  Reverse each row individually
¬PΘ           # Check if the product of the first row is exactly 1
           *  # AND
          P   # And check if everything after the following map is truthy:
sü)ε     }    #  Map over each pair of rows:
    `sη       #   Get the prefixes of the first row
       O      #   Sum each prefix
        Q     #   And check if it's equal to the second row
              # (and output the result implicitly)

Java (JDK), 234 bytes
m->{int l=m.length,L=l-1,p=1,s=0,S=0,e=l,E=l,d=1,D=1,i,j;if(m[0][0]>1|m[0][L]>1){s=L;e=d=-1;}if(m[0][0]>1|m[L][0]>1){S=L;E=D=-1;}for(i=s;i!=e;i+=d)for(j=S;j!=E;j+=D)p=(i==s|j==S?m[i][j]<2:m[i][j]==m[i-d][j]+m[i][j-D])?p:0;return p>0;}

Try it online!
Credits

-1 byte thanks to Kevin Cruijssen.

Nice answer, but dang, loads of variables. ;) Oh, and -1: i==s||j==S to i==s|j==S.

@KevinCruijssen if you know a better algorithm I take it! But the rotation is the cause for all the variables. Some languages can handle them in 1-2 bytes, in Java, you have to think the code around them. The core algorithm is actually pretty short: m->{int l=m.length,i=0,j;for(;i<l;i++)for(j=0;j<l;j++)p=(i<1|j<1?m[i][j]<2:m[i][j]==m[i-1][j]+m[i][j-1])?p:0;return p>0;} (122 bytes)

228

Kotlin, 269 bytes
{m:List<List<Int>>->val n=m.size
var r=0
var c=0
fun f()=if(m[0][0]!=1)m[n-r-1][n-c-1]
else if(m[n-1][0]!=1)m[r][n-c-1]
else if(m[0][n-1]!=1)m[n-r-1][c]
else m[r][c]
var g=0<1
for(l in 0..n*2-2){r=l
c=0
var v=1
do{if(r<n&&c<n)g=f()==v&&g
v=v*(l-c)/++c}while(--r>=0)}
g}

Try it online!

Jelly, 22 bytes
Ż€Iṫ2⁼ṖaFḢ=1Ʋ
,Ṛ;U$Ç€Ẹ

Try it online!
Explanation
Helper link, checks whether this rotation of matrix valid
Ż€            | prepend each row with zero
  I           | find differences within rows
   ṫ2         | drop the first row
     ⁼Ṗ       | compare to the original matrix
              |   with the last row removed
       a      | logical and
        FḢ=1Ʋ | top left cell is 1

Main link
,Ṛ            | copy the matrix and reverse the rows
  ;U$         | append a copy of both of these
              |   with the columns reversed
     Ç€       | run each version of the matrix
              |   through the helper link
       Ẹ      | check if any are valid


text:
Morse sudo-ku-de
Hehe, see what I did with the title? Anyways...
Your job is to create a sudoku solver that accepts input in Morse code and creates output in Morse code. Here's the Morse code numbers for reference:
0:  -----
1:  .----
2:  ..---
3:  ...--
4:  ....-
5:  .....
6:  -....
7:  --...
8:  ---..
9:  ----.

Rules:

The code must define a function s(x) which returns the answer.
The function must accept a string or character array (whichever is the "string of characters" type of your relevant language) with 81 Morse code numbers (see above) separated by spaces. Each 9 Morse code numbers is one row of the sudoku puzzle. Known numbers should be represented by their appropriate Morse code number, while unknown numbers should be 0 in Morse code.
The function must perform calculations and then return a string of Morse code numbers similar to the input but as a solved board (separated by spaces).
Be mindful of the standard loopholes

Here's an example. I have the following input string:
----- -.... ----- ...-- ----- ----- ---.. ----- ....- ..... ...-- --... ----- ----. ----- ----- ----- ----- ----- ....- ----- ----- ----- -.... ...-- ----- --... ----- ----. ----- ----- ..... .---- ..--- ...-- ---.. ----- ----- ----- ----- ----- ----- ----- ----- ----- --... .---- ...-- -.... ..--- ----- ----- ....- ----- ...-- ----- -.... ....- ----- ----- ----- .---- ----- ----- ----- ----- ----- -.... ----- ..... ..--- ...-- .---- ----- ..--- ----- ----- ----. ----- ---.. -----

...which in regular numbers, is this:
0 6 0 3 0 0 8 0 4 5 3 7 0 9 0 0 0 0 0 4 0 0 0 6 3 0 7 0 9 0 0 5 1 2 3 8 0 0 0 0 0 0 0 0 0 7 1 3 6 2 0 0 4 0 3 0 6 4 0 0 0 1 0 0 0 0 0 6 0 5 2 3 1 0 2 0 0 9 0 8 0

And when I put the Morse code string through a correct function, it should then look like this (a solved sudoku board):
..--- -.... .---- ...-- --... ..... ---.. ----. ....- ..... ...-- --... ---.. ----. ....- .---- -.... ..--- ----. ....- ---.. ..--- .---- -.... ...-- ..... --... -.... ----. ....- --... ..... .---- ..--- ...-- ---.. ---.. ..--- ..... ----. ....- ...-- -.... --... .---- --... .---- ...-- -.... ..--- ---.. ----. ....- ..... ...-- ..... -.... ....- ---.. ..--- --... .---- ----. ....- ---.. ----. .---- -.... --... ..... ..--- ...-- .---- --... ..--- ..... ...-- ----. ....- ---.. -....

...which is this in regular numbers:
2 6 1 3 7 5 8 9 4 5 3 7 8 9 4 1 6 2 9 4 8 2 1 6 3 5 7 6 9 4 7 5 1 2 3 8 8 2 5 9 4 3 6 7 1 7 1 3 6 2 8 9 4 5 3 5 6 4 8 2 7 1 9 4 8 9 1 6 7 5 2 3 1 7 2 5 3 9 4 8 6

Any language allowed. Have fun, and golf away!

So...this is a sudoku solver and a number converter?

@J42161217 In all essence, yes.

In this case this is a dupe you know..

I'm not going to hammer this because of some weirdness about guessing/non-guessing but this is pretty much a dupe of one of this or this. In the future I'd recommend using the sandbox to work on your posts before posting. Good luck!

May we use an array of strings (each being a Morse digit) for I/O, instead of one long space-separated string?

Will the input only ever have one solution? If not, what do we do if there are multiple solutions?

@Adám Must be one long string.

May the output have extra spaces (e.g. two spaces between numbers or leading/trailing spaces)?

Relevant Meta post

(I don't actually understand the title)

@JoKing, I think it's supposed to be a play on "pseudo-code".

@JoKing Or an almost-valid bash command? ... ¯\(ツ)/¯ (I think sudo -ku de command would mean "run 'command' as user 'de', ignoring the cached credentials")

APL (Dyalog Extended), 42 bytesSBCS
Anonymous tacit prefix function.
⌂morse{1↓∊' ',¨⍺⍺∊⍕¨⊃⌂sudoku⍎¨9 9⍴⍺⍺⍵⊆⍨≠⍵}

Try it online!
⌂morse{…} derive a function where ⍺⍺ is shorthand for the to/from-Morse function
 ⍵ the argument string
 ≠ Boolean mask where not a space
 ⍵⊆⍨ cut where false (this gives us a list of Morse digit strings)
 ⍺⍺ convert Morse digits strings to string of digits
 9 9⍴ reshape to 9 rows and 9 columns
 ⍎¨ evaluate each character (turns them into integers)
 ⌂sudoku find all solutions
 ⊃ pick the first solution
 ⍕¨ stringify each integer
 ∊ ϵnlist (flatten)
 ⍺⍺ convert string of digits to list of Morse digit strings
 ' ',¨ prepend a space to each Morse digit string
 ∊ ϵnlist (flatten)
 1↓ drop the first character (the leading space)

APL has a method to find sudoku solutions? My grandma will like this c: Does it have one for crosswords also?