AI 1 - Problem Solving (Artificial intelligence)

Final bit of code

OKAY, the main cpp file, “EightPuzz.cpp”

Here’s the code that kicks the thing off ! Its very simple.

#include"Eightpuzz.h"

int main() {

   char Choice=0;

   cout << "Choose Search Method...\n"
        << "    [1] Blind Breadth First Search\n"
        << "    [2] Blind Depth First Search\n"
        << "    [3] A*(Tiles in the wrong position)\n"
        << "    [4] A*(Manhattan Distance)\n" << endl;
       
   cin >> Choice;

   switch(Choice) {

   case '1':
       // call Blind Breadth First Search
       GeneralSearch(BREADTH_FIRST, NOT_USED);
       break;
   case '2':
       // call Blind Depth First Search
       GeneralSearch(DEPTH_FIRST, NOT_USED);
       break;
   case '3':
       // call A* with wrong tiles heuristic
       GeneralSearch(DEPTH_FIRST, WRONG_TILES);
       break;
   case '4':
       // call A* with manhatten heuristic
       GeneralSearch(DEPTH_FIRST, MANHATTAN_DISTANCE);
       break;
   }

   return 0;

}

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic