Cannibals and Missionaries Choose an uninformed search meth

Cannibals and Missionaries - Choose an uninformed search method (breadth first search C++). Show how your method solves the cannibals and missionaries problem by expanding the search tree. Do this up to a depth of 10 or until you find the solution, whichever comes first. The program should be written in C++.

Solution

. . . .

. . . .

Solutionprovider s = new

Solution provider( ) ;

Array list solution =

S. getsolutions ( new state (\" Root\", 3 , 3, false, 1),

State (\" Goa1\", 0, 0, true, 9 9 9 9 9 9));

Printsolutions ( solution);

. . . .

. . . .

// this method prints the solutions returned

// by the solutions provider object.

//however, there may not actually be any solutions to print.

//

// once a solution provider is created this

// class asks it to provide all the

// solutions. If there are any solutions.

// returned these are then printed

//

// param: solution the solutions returned

// by the solution provider object.

Private static void

Print solutions( Array list solution)

{

// Are there any solutions if ( solution. Count ==0)

{

Console writeline (\"\ \ No SOLUTIONS HAVE BEEN FOUND\\ r\ \");

}

Else

{

Int sol found = 1

// show the solutions for ( int i= 0; i< solution count; i++)

{

State s =

( state ) solution [i];

Console writeline(\"= = = = =

FOUND SOLUTION [\" +

Sol found+++ \"]

= = = = = \\ r\\ n\");

Console writeline (\" this solution was found at level [\" + s. get state level ( ) + \"]\\ r\\ n\"];

S.print ( );

Console. Writeline(\"\ \ \");

}

}

}

Cannibals and Missionaries - Choose an uninformed search method (breadth first search C++). Show how your method solves the cannibals and missionaries problem b
Cannibals and Missionaries - Choose an uninformed search method (breadth first search C++). Show how your method solves the cannibals and missionaries problem b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site