Skip to main content
-1 byte golf
Source Link
mazzy
  • 7.2k
  • 2
  • 13
  • 23

Powershell, 143 141 136 130130 122 121 bytes

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){$a[$i]=$n=0$a[$i]=0
$n=(-1,1+-6..-4+4..6|?6|%{($v=$a[$i+$_]$a[$i+$_]}|sort)[-gt$n}|%{$n=$v}1]}
 $a|%{$s+=$_}
$s
$f = {

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=$n=0$a[$i]=0
    $n=(-1,1+-6..-4+4..6|?6|%{($v=$a[$i+$_]$a[$i+$_]}|sort)[-gt$n}|%{
        $n=$v
    }1]
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=$n=0$a[$i]=0
    $n=(-1,1+-6..-4+4..6|?6|%{($v=$a[$i+$_]$a[$i+$_]}|sort)[-gt$n}|%{
        $n=$v
    }1]
}

Powershell, 143 141 136 130 bytes

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){$a[$i]=$n=0
-1,1+-6..-4+4..6|?{($v=$a[$i+$_])-gt$n}|%{$n=$v}}
 $a|%{$s+=$_}
$s
$f = {

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=$n=0
    -1,1+-6..-4+4..6|?{($v=$a[$i+$_])-gt$n}|%{
        $n=$v
    }
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=$n=0
    -1,1+-6..-4+4..6|?{($v=$a[$i+$_])-gt$n}|%{
        $n=$v
    }
}

Powershell, 143 141 136 130 122 121 bytes

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){$a[$i]=0
$n=(-1,1+-6..-4+4..6|%{$a[$i+$_]}|sort)[-1]}$a|%{$s+=$_}
$s
$f = {

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=0
    $n=(-1,1+-6..-4+4..6|%{$a[$i+$_]}|sort)[-1]
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=0
    $n=(-1,1+-6..-4+4..6|%{$a[$i+$_]}|sort)[-1]
}
-6 byte golfed
Source Link
mazzy
  • 7.2k
  • 2
  • 13
  • 23

Powershell, 143 141 136136 130 bytes

-2 bytes: Yeah, one zero as delimiter is enough.

-5 bytes: The bottom zero border is enough.

$a=,0*5+($args|%{$_+0})+,0*5
for($n=16;$n){$a[($i=$a$n=16;$i=$a.IndexOf($n))]=0{$a[$i]=$n=0
[int]$n=-1,1+-6..-4+4..6|%6|?{$a[$i+$_]}|measure ($v=$a[$i+$_])-ma|% ma*gt$n}|%{$n=$v}}
$a|%{$s+=$_}
$s
$f = {

$a=,0*5+($args|%{$_+0})+,0*5
for($n=16;$n){
    $i=$a$n=16;$i=$a.IndexOf($n)){
    $a[$i]=0$a[$i]=$n=0
    [int]$n=-1,1+-6..-4+4..6|%6|?{($v=$a[$i+$_])-gt$n}|%{
        $a[$i+$_]$n=$v
    }|measure -maximum|% maximum
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}

FirstFirst, add righttop and bottom borders of 0 and make a single dimensional array:

#0 #0 #0 #0 0
# # # # 0
# # # # 0
# # # # 0
0# 0# 0# 0# 0

     ↓

#0 #0 #0 #0 0 # # # # 0 # # # # 0 # # # # 0 0# 0# 0# 0# 0

SecondPowershell returns $null if you try to get the value behind the end of the array.

Second, loop biggest neighbor pile started from 16 to non-zero-maximum. And nullify it (The Hungry Mouse eats it).

for($n=16;$n){
    $i=$a$n=16;$i=$a.IndexOf($n)){
    $a[$i]=0$a[$i]=$n=0
    [int]$n=-1,1+-6..-4+4..6|%6|?{($v=$a[$i+$_])-gt$n}|%{
        $a[$i+$_]$n=$v
    }|measure -maximum|% maximum
}

ThirdThird, sum of the remaining piles.

Powershell, 143 141 136 bytes

-2 bytes: Yeah, one zero as delimiter is enough.

-5 bytes: The bottom zero border is enough.

$a=($args|%{$_+0})+,0*5
for($n=16;$n){$a[($i=$a.IndexOf($n))]=0
[int]$n=-1,1+-6..-4+4..6|%{$a[$i+$_]}|measure -ma|% ma*}
$a|%{$s+=$_}
$s
$f = {

$a=($args|%{$_+0})+,0*5
for($n=16;$n){
    $i=$a.IndexOf($n)
    $a[$i]=0
    [int]$n=-1,1+-6..-4+4..6|%{
        $a[$i+$_]
    }|measure -maximum|% maximum
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}

First, add right and bottom borders of 0 and make a single dimensional array:

# # # # 0
# # # # 0
# # # # 0
# # # # 0
0 0 0 0 0

     ↓

# # # # 0 # # # # 0 # # # # 0 # # # # 0 0 0 0 0 0

Second, loop biggest neighbor pile started from 16 to non-zero-maximum. And nullify it (The Hungry Mouse eats it).

for($n=16;$n){
    $i=$a.IndexOf($n)
    $a[$i]=0
    [int]$n=-1,1+-6..-4+4..6|%{
        $a[$i+$_]
    }|measure -maximum|% maximum
}

Third, sum of the remaining piles.

Powershell, 143 141 136 130 bytes

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){$a[$i]=$n=0
-1,1+-6..-4+4..6|?{($v=$a[$i+$_])-gt$n}|%{$n=$v}}
$a|%{$s+=$_}
$s
$f = {

$a=,0*5+($args|%{$_+0})
for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=$n=0
    -1,1+-6..-4+4..6|?{($v=$a[$i+$_])-gt$n}|%{
        $n=$v
    }
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}

First, add top and bottom borders of 0 and make a single dimensional array:

0 0 0 0 0
# # # # 0
# # # # 0
# # # # 0
# # # # 0

     ↓

0 0 0 0 0 # # # # 0 # # # # 0 # # # # 0 # # # # 0

Powershell returns $null if you try to get the value behind the end of the array.

Second, loop biggest neighbor pile started from 16 to non-zero-maximum. And nullify it (The Hungry Mouse eats it).

for($n=16;$i=$a.IndexOf($n)){
    $a[$i]=$n=0
    -1,1+-6..-4+4..6|?{($v=$a[$i+$_])-gt$n}|%{
        $n=$v
    }
}

Third, sum of the remaining piles.

-5 bytes: The bottom zero border is enough.
Source Link
mazzy
  • 7.2k
  • 2
  • 13
  • 23

Powershell, 143 141141 136 bytes

-5 bytes: The bottom zero border is enough.

$a=,0*6+($args|%{$_+0})+,0*40*5
for($n=16;$n){$a[($i=$a.IndexOf($n))]=0
[int]$n=-1,1+-6..-4+4..6|%{$a[$i+$_]}|measure -ma|% ma*}
$a|%{$s+=$_}
$s
$f = {

$a=,0*6+($args|%{$_+0})+,0*40*5
for($n=16;$n){
    $i=$a.IndexOf($n)
    $a[$i]=0
    [int]$n=-1,1+-6..-4+4..6|%{
        $a[$i+$_]
    }|measure -maximum|% maximum
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}

First, add a borderright and bottom borders of 0 and make a single dimensional array:

0 0 0 0 0
0 # # # #
0 0
# # # #
0 0
# # # #
0 0
# # # # 0
0 0 0 0 0

     ↓

0 0 0 0 0 0 # # # # 0 # # # # 0 # # # # 0 # # # # 0 0 0 0 0 0

Powershell, 143 141 bytes

$a=,0*6+($args|%{$_+0})+,0*4
for($n=16;$n){$a[($i=$a.IndexOf($n))]=0
[int]$n=-1,1+-6..-4+4..6|%{$a[$i+$_]}|measure -ma|% ma*}
$a|%{$s+=$_}
$s
$f = {

$a=,0*6+($args|%{$_+0})+,0*4
for($n=16;$n){
    $i=$a.IndexOf($n)
    $a[$i]=0
    [int]$n=-1,1+-6..-4+4..6|%{
        $a[$i+$_]
    }|measure -maximum|% maximum
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}

First, add a border of 0 and make a single dimensional array:

0 0 0 0 0
0 # # # #
0 # # # #
0 # # # #
0 # # # #
0 0 0 0 0

     ↓

0 0 0 0 0 0 # # # # 0 # # # # 0 # # # # 0 # # # # 0 0 0 0 0 0

Powershell, 143 141 136 bytes

-5 bytes: The bottom zero border is enough.

$a=($args|%{$_+0})+,0*5
for($n=16;$n){$a[($i=$a.IndexOf($n))]=0
[int]$n=-1,1+-6..-4+4..6|%{$a[$i+$_]}|measure -ma|% ma*}
$a|%{$s+=$_}
$s
$f = {

$a=($args|%{$_+0})+,0*5
for($n=16;$n){
    $i=$a.IndexOf($n)
    $a[$i]=0
    [int]$n=-1,1+-6..-4+4..6|%{
        $a[$i+$_]
    }|measure -maximum|% maximum
}
$a|%{$s+=$_}
$s

}

@(
    ,( 0  , ( 4,  3,  2,  1), ( 5,  6,  7,  8), (12, 11, 10,  9), (13, 14, 15, 16) )
    ,( 0  , ( 8,  1,  9, 14), (11,  6,  5, 16), (13, 15,  2,  7), (10,  3, 12,  4) )
    ,( 1  , ( 1,  2,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12), (13, 14, 15, 16) )
    ,( 3  , (10, 15, 14, 11), ( 9,  3,  1,  7), (13,  5, 12,  6), ( 2,  8,  4, 16) )
    ,( 12 , ( 3,  7, 10,  5), ( 6,  8, 12, 13), (15,  9, 11,  4), (14,  1, 16,  2) )
    ,( 34 , ( 8,  9,  3,  6), (13, 11,  7, 15), (12, 10, 16,  2), ( 4, 14,  1,  5) )
    ,( 51 , ( 8, 11, 12,  9), (14,  5, 10, 16), ( 7,  3,  1,  6), (13,  4,  2, 15) )
    ,( 78 , (13, 14,  1,  2), (16, 15,  3,  4), ( 5,  6,  7,  8), ( 9, 10, 11, 12) )
    ,( 102, ( 9, 10, 11, 12), ( 1,  2,  4, 13), ( 7,  8,  5, 14), ( 3, 16,  6, 15) )
    ,( 103, ( 9, 10, 11, 12), ( 1,  2,  7, 13), ( 6, 16,  4, 14), ( 3,  8,  5, 15) )
) | % {
    $expected, $a = $_
    $result = &$f @a
    "$($result-eq$expected): $result"
}

First, add right and bottom borders of 0 and make a single dimensional array:

# # # # 0
# # # # 0
# # # # 0
# # # # 0
0 0 0 0 0

     ↓

# # # # 0 # # # # 0 # # # # 0 # # # # 0 0 0 0 0 0
-2 bytes: Yeah, one zero as delimiter is enough.
Source Link
mazzy
  • 7.2k
  • 2
  • 13
  • 23
Loading
edited body
Source Link
mazzy
  • 7.2k
  • 2
  • 13
  • 23
Loading
Source Link
mazzy
  • 7.2k
  • 2
  • 13
  • 23
Loading