Stuck in pet moving situation

I done some math for the optimum path.

Route A is yellow path

Route B is Red path

enter image description here The number 1,2,3,4,5,6 represent A,B,T,Z,C,J respectively. on right side co-ordinate of block in x,z are filled.

distance from respective points is calculated and then from here, time is calculated.

enter image description here


So from calculation Red path is optimum path.