5
\$\begingroup\$

Given a rectangle input with only \, / and space, decide if it's a valid output of Drawing in Slashes

Empty lines and columns at edge get cleaned up, so the 3rd true case is true.

True cases:

 /\/\   
/ /\ \  
\/ /  \ 
/\/ /\ \
\  /  \/
 \ \    
  \ \   
   \/   

   /\/\ 
  / /\ \
 /  \ \/
/ /\ \/\
\/  \  /
    / / 
   / /  
   \/   

/\      
\/      
      /\
      \/

False cases:

 /\ 
/  \
\ \/
 \/ 

 /\ 
/  \
\  \
 \/ 

/\     
\/     
     /\
     \/

Shortest code in each language wins.

\$\endgroup\$
5
  • \$\begingroup\$ Aren't the third cases for each category the same? \$\endgroup\$
    – Jo King
    Dec 16, 2022 at 9:59
  • 1
    \$\begingroup\$ @JoKing Different amount of space between, making one possible and one impossible \$\endgroup\$
    – l4m2
    Dec 16, 2022 at 11:05
  • 2
    \$\begingroup\$ Challenges must be self-contained; please include the criteria for validity within the spec rather than relying on an outside source. \$\endgroup\$
    – Shaggy
    Dec 16, 2022 at 15:20
  • 1
    \$\begingroup\$ This seems like a good question, it just needs to be better specified. \$\endgroup\$ Dec 16, 2022 at 15:53
  • \$\begingroup\$ @Shaggy Please provide a source of this rule \$\endgroup\$
    – l4m2
    Dec 16, 2022 at 17:43

1 Answer 1

0
\$\begingroup\$

Charcoal, 62 bytes

WS⊞υι≔E/\ΣEυ⁺μ⌕Aλιθ∧∧⬤υ¬﹪⁺№ι/№ι\²⬤E⌊υEυ§λκ¬﹪⁺№ι/№ι\²⬤⊟θ⌊﹪⁺ι⌊θ²

Attempt This Online! Link is to verbose version of code. Takes input as a rectangular list of newline-terminated strings. Not actually sure this works in general, but posting anyway just in case.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.