Skip to main content
deleted 1456 characters in body
Source Link
emanresu A
  • 44.2k
  • 25
  • 40

Is this continuous terrain?Is this continuous terrain?

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Separated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\

Is this continuous terrain?

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Separated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\
deleted 21 characters in body
Source Link
emanresu A
  • 44.2k
  • 25
  • 40

WouldIs this string work as stringcontinuous terrain? (2d edition)

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Separated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\

Would this string work as string? (2d edition)

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Separated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\

Is this continuous terrain?

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Separated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\
typo
Source Link
Jonathan Frech
  • 7.3k
  • 1
  • 10
  • 14

Would this string work as string? (2d edition)

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

SeperatedSeparated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\

Would this string work as string? (2d edition)

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Seperated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\

Would this string work as string? (2d edition)

Based off this

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

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

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

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

enter image description here

To clarify the connections:

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

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

_
 ‾

\
 \

 _
/

\
 ‾

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

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

Testcases

Separated by double newline.

Truthy:

\
 \

\_
  \ /\/\_
   ‾     \

/\
  \/

\_
  ‾\

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

Falsy:

/
 \


//

 ‾‾
/  \

‾
 _

\____/
      /‾‾‾\
Source Link
emanresu A
  • 44.2k
  • 25
  • 40
Loading