果冻, 23 22 14 10 字节
²ḶdðạP€ċ2)
单链链接产生一个平面列表-使用KSab在他们的Python答案中首先使用的想法-骑士的举动具有“边” 1和2,仅有2的因数。
在线尝试!(页脚调用该程序的唯一链接,然后将结果格式化为网格)
另外,对于10个字节,²Ḷdðạ²§ċ5)
(骑士移动是距离所有可能移动)5–√
怎么样?
²ḶdðạP€ċ2) - Link: integer, n (any non-negative) e.g. 8
² - square n 64
Ḷ - lowered range [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63]
d - divmod (vectorises) i.e. x->[x//n,x%n] [[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7],[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7],[4,0],[4,1],[4,2],[4,3],[4,4],[4,5],[4,6],[4,7],[5,0],[5,1],[5,2],[5,3],[5,4],[5,5],[5,6],[5,7],[6,0],[6,1],[6,2],[6,3],[6,4],[6,5],[6,6],[6,7],[7,0],[7,1],[7,2],[7,3],[7,4],[7,5],[7,6],[7,7]]
ð ) - new dyadic chain for each - call that L ( & e.g. R = [1,2] representing the "2nd row, 3rd column" ...-^ )
ạ - absolute difference (vectorises) [[1,2],[1,1],[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[0,2],[0,1],[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[1,2],[1,1],[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[2,2],[2,1],[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[3,2],[3,1],[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[4,2],[4,1],[4,0],[4,1],[4,2],[4,3],[4,4],[4,5],[5,2],[5,1],[5,0],[5,1],[5,2],[5,3],[5,4],[5,5],[6,2],[6,1],[6,0],[6,1],[6,2],[6,3],[6,4],[6,5]]
P€ - product of €ach [2, 1, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 1, 2, 3, 4, 5, 4, 2, 0, 2, 4, 6, 8, 10, 6, 3, 0, 3, 6, 9, 12, 15, 8, 4, 0, 4, 8, 12, 16, 20, 10, 5, 0, 5, 10, 15, 20, 25, 12, 6, 0, 6, 12, 18, 24, 30]
ċ2 - count 2s 6: ^-...1 ^-...2 ^-...3 ^-...4 ^-...5 ^-...6
- ) v-...that goes here
- -> -> [2, 3, 4, 4, 4, 4, 3, 2, 3, 4, 6, 6, 6, 6, 4, 3, 4, 6, 8, 8, 8, 8, 6, 4, 4, 6, 8, 8, 8, 8, 6, 4, 4, 6, 8, 8, 8, 8, 6, 4, 4, 6, 8, 8, 8, 8, 6, 4, 3, 4, 6, 6, 6, 6, 4, 3, 2, 3, 4, 4, 4, 4, 3, 2]
前22位
2RżN$Œp;U$+,ḟ€³R¤Ẉ¬Sðþ
完整程序(由于³
)。
在线尝试!(页脚调用该程序的唯一链接,然后将结果格式化为网格)
查找所有移动并通过计算确定落在板上的移动可能 肯定可以击败(也许可以通过更改“落在板上”逻辑来击败)。