12
3
Your program should compute the number of moves it takes a chess knight to reach each square of the chess board. The input will be two space-separated integers representing coordinates of the starting square (horizontal then vertical coordinate, 0-7 inclusive each). Your program should output a number grid containing the minimum number of moves a chess knight needs to make to reach each square.
examples
input
0 0
output
03232345
34123434
21432345
32323434
23234345
34343454
43434545
54545456
input
3 1
output
21232123
32303232
21232123
34121432
23232323
32323234
43434343
34343434
Shortest code wins.
2
Welcome to the site! Good first golf. If you want some additional ideas for Haskell golfing, check out https://codegolf.stackexchange.com/questions/19255/tips-for-golfing-in-haskell
– isaacg – 2017-05-13T06:25:37.587map(\(c,d)->...)$zip ...
can be shortened tozipWith(\c d->...)...
. – Laikoni – 2017-05-13T11:50:38.850