Find all the coordinates on a path
Slip, 2 + 1 = 3 bytes
+1 byte for the
p flag. Code:
p-flag returns the position of each occurence of the following:
`# // The character '#'
Try it here!
7 6 5 bytes
This is using 1-based indexing with
(1,1) in the top left corner.
o % convert char to double o % remainder mod 2 ('#' == 35, ' '==32) makes spaces falsy &f % apply `find` with 2d-output h % concatenate outputs to display x- and y-coordinates side by side
Thanks @DJMcMayhem and @LuisMendo for each -1 byte!
Try it online!
Grime, 5 bytes
Try it online! The output format is a bit funky, but OP has stated that it's valid.
Grime is my 2D pattern matching language.
The part after
` is the pattern, in this case a 1×1 square containing a
Grime will search the input grid for a match, and prints the first one it finds by default.
The part before
` contains options, in this case signifying that all matches (
a) should be printed, along with their positions and sizes (