Inspired by Digits in their lanes
Input:
An ASCII-art of width ≤ 11, consisting of spaces and #
. (You can choose any two distinct characters instead.) Example:
#
###
#
#
# #
# #
# #
# ### #
# ### #
###########
# #
# #
# ### #
# ### #
# ### #
###########
Output:
A list of integers, with one element for each line of the input.
If you put a hash in each decimal digit's lane, including the minus sign, in
the order -0123456789
. Duplicated digits are allowed, but ignored. The order of the digits in the output is not important.
Possible outputs for the above input include:
[ 4, 345, 4, 4, 35, 26, 17, 34580, -3459, -9876543210, -9, -9, -3459, -3459, -3459, -1234567890 ]
[ 4444444, 5345354354, 4, 44, 535, 2666, 71, 85430, -3495939495, -93678132645160234, -99, -99999, -934539, -935439, -9534, -9876543210 ]
Note that you have to distinguish between 0 and -0. If your output format doesn't support that, you can say there is a special value for -0 (e.g. None
).
Leading zeros
If a number is 0 (or -0), the zero is always counted.
Else, you have to move the zero after the first digit (not necessarily next to it): For example, -09 stands for -
and 9
, so you have to output -90 instead. So, even if you output the string "-09"
where -
, 0
and 9
are #
, that is not right.
In your output, leading zeroes are not counted (that is, the output is the same as if those leading zeroes are removed). This does also include zeroes directly after the minus signs.
Here are some examples for clarification:
-0123456789 OK not OK ## -> -0 ### -> -10 -01 ## # -> -90 -09 ## -> 10 01 # -> 01 10
- This does also apply when you output a string!
General rules
- You can assume that in every line, at least one of 0-9 is a
#
(not empty or only-
) - You can submit a program or function
- Choose any reasonable input/output format (eg. list of lines, list of characters, etc.)
Scoring
- Your score is the number of bytes in your code.
- Lowest score wins.
Loopholes
- Standard loopholes are forbidden
Examples
Note that there is an infinite number of correct outputs for every input, here, only one is mentioned. If you need to verify an output, you can usually use an answer to Digits in their lanes and input your output. Then compare it's output with the original input.
# 4
### 345
# 4
# 4
# # 35
# # 26
# # 17
# ### # 83450
# ### # -> -9534
########### -9876543210
# # -9
# # -9
# ### # -3459
# ### # -3459
# ### # -3459
########### -1234567890
######### 123456780
# # -9
# ## ## # -23679
# # # # -159
# # # # # -1579
# ## ## # -> -23679
# # -9
##### ### 12346780
## 45
# 4
## ## ## -45890
# # # # -137
## # # -> -370
# # # # -379
# ## ## -4589
## ## ## ## -2356890
# # ## -> -289
# # -2
## -0
## 10
## 12
## 23
## -> 34
## 45
## 56
## 67
## 78
## 89
-09
allowed when-9
is required? \$\endgroup\$ – l4m2 Apr 3 '18 at 15:53