ex1

Does the bug always move to a new location? Explain. 不能。調用 bug 的 canMove 方法返回一個當前 bug 能否移動到新位置的布爾值。當有 rock 對象或 bug 對象位於 bug 的下一前進位置時,canMove 方法返回 false ,bug 只能選擇執行 turn 方法轉向;當 bug 的八鄰域都有 rock 對象或 bug
相關文章
相關標籤/搜索