05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
AlternativeNon-competive solution: 17 bytes
Works well except for empty inputs. I think that there isThere was a problembug in 05AB1E with the operator « when the input is emptyI first submitted that solution, subsequent operands likewhere some operators badly handled empty inputs. This resulted in this solution answering γ1 give inconsistent resultson an empty input. Does anyone
This has a workaround? (same thing goes for ì)now been fixed, so this solution works just fine.
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›
05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
Alternative solution: 17 bytes
Works well except for empty inputs. I think that there is a problem in 05AB1E with the operator « when the input is empty, subsequent operands like γ give inconsistent results. Does anyone has a workaround? (same thing goes for ì).
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›
05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
Non-competive solution: 17 bytes
There was a bug in 05AB1E when I first submitted that solution, where some operators badly handled empty inputs. This resulted in this solution answering 1 on an empty input.
This has now been fixed, so this solution works just fine.
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›
05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
Alternative solution: 17 bytes
Works well except for empty inputs. I think that there is a problem in 05AB1E with the operator « when the input is empty, and I can't findsubsequent operands like γ give inconsistent results. Does anyone has a workaround? (same thing goes for ì).
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›
05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
Alternative solution: 17 bytes
Works well except for empty inputs. I think that there is a problem in 05AB1E with the operator « when the input is empty, and I can't find a workaround (same thing goes for ì).
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›
05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
Alternative solution: 17 bytes
Works well except for empty inputs. I think that there is a problem in 05AB1E with the operator « when the input is empty, subsequent operands like γ give inconsistent results. Does anyone has a workaround? (same thing goes for ì).
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›
05AB1E, 19 bytes
0 -> Ore
1 -> Brick
2 -> Log
3 -> Wheat
4 -> Sheep
Returns 0 when false, and 1 otherwise.
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3›
Explanation:
{γvyDĀi1⁄4 ̈}g4÷}3⁄4)O3› Implicit input, e.g. 0030201
{ Sort -> 0000123
γ Split into chunks of consecutive elements: [0000, 1, 2, 3]
vy For each chunk...
DĀ ...is different than 0?
i1⁄4 ̈} ...if true: increment the counter by 1, and
remove 1 element from the chunk
g4÷ ...divide the number of elements by 4
} End For
3⁄4 Push the counter
) Wrap the entire stack in a list
O Sum of that list
3> True if > 3
Implicit output
Alternative solution: 17 bytes
Works well except for empty inputs. I think that there is a problem in 05AB1E with the operator « when the input is empty, and I can't find a workaround (same thing goes for ì).
The difference here is that we add an ore prior to removing one of each resource, indiscriminately, counting the number of resources removed that way. We then decrement the counter by 1 to get the correct number of B, L, W and S.
0«{γε ̈g4÷1⁄4}O3⁄4<+3›