原代碼狀態轉移行:
newlocation = location ^ (0x00 | movers); // 錯誤
0x00 導致農夫位(bit3)不翻轉,實際應翻轉農夫+被攜帶物:
newlocation = location ^ (0x08 | movers); // 正確:0x08 = 1000b (農夫位)
route[0]=0。movers = 1,2,4,8(農夫單獨/帶狼/帶羊/帶白菜)。(location&0x08) == (location&movers)。route[new]=loc。the revers path is:
the location is:15
the location is:11
the location is:9
the location is:13
the location is:5
the location is:7
the location is:3
the location is:0