Write a Java implementation of the Best First Search algorithm for this problem. Your program must read the contents of a start state from a text file. The output of your program must show the sequence of nodes that are expanded. A node in the graph can simply be displayed by printing the heuristic vale and showing the contents of each cell from 1 to 13 in a single line. A zero entry represents an empty cell. For example, State A can be displayed as: h=1 0234567891000 and State B can be displayed as h=9 0000235689147 Your program must show the number of moves taken to reach the goal state. The output of parts a and b must be written to an output file an to the screen. Nine Little Soldiers is a puzzle in which 9 numbered soldiers are trapped in a bomb shelter that has 13 cells as shown in the figure below. A cell's number is shown either below or above the cell, and the soldiers are identified by the numbers inside a circle. A soldier may only move into an adjacent empty cell and no more than one soldier may occupy a single cell. The puzzle requires you to move the soldiers so that soldier: :D:D:D is in cell number 1, in cell number 2, and so on up to soldier: :D:D:D:D:D:D:D: cell number 9. soldier The figure below depicts start state A. 11 12 13 23 456 7891 1 2 3 4 5 6 7 8 9 10

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question

Please please help

Write a Java implementation of the Best First Search algorithm for this problem.
Your program must read the contents of a start state from a text file.
The output of your program must show the sequence of nodes that are expanded. A
node in the graph can simply be displayed by printing the heuristic vale and showing
the contents of each cell from 1 to 13 in a single line. A zero entry represents an empty
cell. For example, State A can be displayed as:
h=1
0234567891000
and State B can be displayed as
h=9
0000235689147
Your program must show the number of moves taken to reach the goal state.
The output of parts a and b must be written to an output file an to the screen.
Transcribed Image Text:Write a Java implementation of the Best First Search algorithm for this problem. Your program must read the contents of a start state from a text file. The output of your program must show the sequence of nodes that are expanded. A node in the graph can simply be displayed by printing the heuristic vale and showing the contents of each cell from 1 to 13 in a single line. A zero entry represents an empty cell. For example, State A can be displayed as: h=1 0234567891000 and State B can be displayed as h=9 0000235689147 Your program must show the number of moves taken to reach the goal state. The output of parts a and b must be written to an output file an to the screen.
Nine Little Soldiers is a puzzle in which 9 numbered soldiers are trapped in a bomb shelter that
has 13 cells as shown in the figure below. A cell's number is shown either below or above the
cell, and the soldiers are identified by the numbers inside a circle.
A soldier may only move into an adjacent empty cell and no more than one soldier may occupy a
single cell. The puzzle requires you to move the soldiers so that soldier: :D:D:D is in cell number 1,
in cell number 2, and so on up to soldier: :D:D:D:D:D:D:D: cell number 9.
soldier
The figure below depicts start state A.
11
12
13
23 456 7891
1
2
3
4
5
6
7 8 9 10
Transcribed Image Text:Nine Little Soldiers is a puzzle in which 9 numbered soldiers are trapped in a bomb shelter that has 13 cells as shown in the figure below. A cell's number is shown either below or above the cell, and the soldiers are identified by the numbers inside a circle. A soldier may only move into an adjacent empty cell and no more than one soldier may occupy a single cell. The puzzle requires you to move the soldiers so that soldier: :D:D:D is in cell number 1, in cell number 2, and so on up to soldier: :D:D:D:D:D:D:D: cell number 9. soldier The figure below depicts start state A. 11 12 13 23 456 7891 1 2 3 4 5 6 7 8 9 10
Expert Solution
steps

Step by step

Solved in 1 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT