add test and fix issue with king location calculation