Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 170 characters in body
Source Link
user2956892
  • 1.2k
  • 5
  • 9

05AB1E, (削除) 18 (削除ここまで) 17(削除) 17 (削除ここまで) 14 bytes

$γD€н>os€gć ̧s>«ŠΛγ€gć ̧s>«1IÔ·ÌΛ

Try it online!

I really wanted to use 05AB1E's canvas feature, here it is ! Takes input as binary array, uses 1 as the display char.Try it online!

Explanation

$γD γ€g # Push 1the andinput as the array as chuncks of consecutive elements, twice.
  €н map with length
 ć ̧s>« # MapIncrement chunckseach withvalue theirexcept the first elementone
 >o 1I # IncrementPush each1 and map with 2 **the input -- this gives us our direction array (4 for down and 2 for right)
 s€g  Ô # Swap, map thePush otherconnected arrayuniquified withinput the(first lengthelements of each chunck of consecutive elements in the input)
 ć ̧s>« # Increment each value except·Ì the first one
# Map each with 2 * a + 2
 ŠΛ # Put everything in theΛ right place,# drawDraw canvas :-)
  • 3 bytes thanks to @Emigna

05AB1E canvas's explanation

05AB1E, (削除) 18 (削除ここまで) 17 bytes

$γD€н>os€gć ̧s>«ŠΛ

Try it online!

I really wanted to use 05AB1E's canvas feature, here it is ! Takes input as binary array, uses 1 as the display char.

Explanation

$γD  # Push 1 and the array as chuncks of consecutive elements, twice.
  €н  # Map chuncks with their first element
 >o # Increment each and map with 2 ** input -- this gives us our direction array (4 for down and 2 for right)
 s€g  # Swap, map the other array with the length of each chunck ć ̧s>« # Increment each value except the first one
 ŠΛ # Put everything in the right place, draw canvas :-)

05AB1E canvas's explanation

05AB1E, (削除) 18 (削除ここまで) (削除) 17 (削除ここまで) 14 bytes

γ€gć ̧s>«1IÔ·ÌΛ

Try it online!

Explanation

γ€g # Push the input as the array as chuncks of consecutive elements, map with length
 ć ̧s>« # Increment each value except the first one
 1I # Push 1 and the input 
 Ô # Push connected uniquified input (first elements of each chunck of consecutive elements in the input)
 ·Ì # Map each with 2 * a + 2
 Λ # Draw canvas :-)
  • 3 bytes thanks to @Emigna

05AB1E canvas's explanation

added 668 characters in body
Source Link
user2956892
  • 1.2k
  • 5
  • 9

05AB1E, 18(削除) 18 (削除ここまで) 17 bytes

γD€gć ̧s>«sεн>o}1sΛ$γD€н>os€gć ̧s>«ŠΛ

Try it online! Try it online!

I really wanted to use 05AB1E's canvas feature, here it is ! Takes input as binary array, uses 1 as the display char.

Explanation

$γD # Push 1 and the array as chuncks of consecutive elements, twice.
 €н # Map chuncks with their first element
 >o # Increment each and map with 2 ** input -- this gives us our direction array (4 for down and 2 for right)
 s€g # Swap, map the other array with the length of each chunck
 ć ̧s>« # Increment each value except the first one
 ŠΛ # Put everything in the right place, draw canvas :-)

05AB1E canvas's explanation

05AB1E, 18 bytes

γD€gć ̧s>«sεн>o}1sΛ

Try it online!

I really wanted to use 05AB1E's canvas feature, here it is ! Takes input as binary array.

05AB1E, (削除) 18 (削除ここまで) 17 bytes

$γD€н>os€gć ̧s>«ŠΛ

Try it online!

I really wanted to use 05AB1E's canvas feature, here it is ! Takes input as binary array, uses 1 as the display char.

Explanation

$γD # Push 1 and the array as chuncks of consecutive elements, twice.
 €н # Map chuncks with their first element
 >o # Increment each and map with 2 ** input -- this gives us our direction array (4 for down and 2 for right)
 s€g # Swap, map the other array with the length of each chunck
 ć ̧s>« # Increment each value except the first one
 ŠΛ # Put everything in the right place, draw canvas :-)

05AB1E canvas's explanation

Source Link
user2956892
  • 1.2k
  • 5
  • 9

05AB1E, 18 bytes

γD€gć ̧s>«sεн>o}1sΛ

Try it online!

I really wanted to use 05AB1E's canvas feature, here it is ! Takes input as binary array.

AltStyle によって変換されたページ (->オリジナル) /