我正在編寫一個謎題程序。當我編譯我的Java程序時,它是成功的。但是當我運行它時,它顯示 Solution to problem using breadth first :
Exception in thread "main" java.lang.NullPointerException
at SolvingProblem.isGoal(SolvingProblem.java:24)
at
標準的BFS實現是一樣的東西(維基百科提供): Breadth-First-Search(Graph, root):
create empty set S
create empty queue Q
root.parent = NIL
Q.enqueue(root)
while Q is not empty:
current