Shortest path for a chess knight
Ruby 1.9, 146 151 characters
g=(?9*8+".
")*8
r=->x,a=0{x<0||a<g[x].to_i&&(g[x]=a.to_s;[21,19,12,8].map{|i|r[x+i,a+1];r[x-i,a+1]})}
r[eval gets.split*?++"*10"]
puts g.tr(?.,"")
Haskell, 255 236 231 229 bytes
import Data.List
k x y=unlines[[toEnum$findIndices(elem(i,j))(scanl(\s _->filter(\(z,w)->z`elem`n&&w`elem`n)$(\(a,b)->[(a+c,b+d)|(c,d)<-zip[1,1,-1,-1,-2,-2,2,2][2,-2,2,-2,1,-1,1,-1]])=<<s)[(x,y)]n)!!0+48|j<-n]|i<-n]where n=[0..7]
D:
This is my first attempt at golfing. Also somewhat new to Haskell.
Test suite:
import System.Environment
main :: IO ()
main = do
args <- getArgs
let readArgs = map read args
let out = k (readArgs !! 0) (readArgs !! 1)
putStr out
Windows PowerShell, 178 183 188
filter f($n){if($d[($p=$_)]-gt$n){$d[$p]=$n
12,8,21,19|%{$p+$_
$p-$_}|f($n+1)}}$d=,0*20+(0..7|%{,9*8+0,0})+,0*20
$x,$y=-split$input
20+"$y$x"|f 0
2..9|%{-join$d[(10*$_).."$_`7"]}
Passes both test cases.