AI 1 - Problem Solving (Artificial intelligence)

Introduction

Hello. I’m writing this tutorial shortly after finishing a module in AI at university. I’m basically gonna show u all the interesting bits I learned, I’m sure none of you have any interest in hearing the long debate about what intelligence actually is.

Before reading on, I would recommend that you make sure you are comfortable using the following…

  • Pointers to object, functions, and classes
  • Classes
  • Linked Lists.
  • Creating objects using the ‘new’ keyword.

After you read through this, I would recommend you download the Zip that comes with the tutorial, as copying and pasting code almost never works with programs this large. In this tutorial, I’m going to use the single player game “eight puzzle” as an example. The rules of this game are as follows.

There is a 3 by 3 grid containing numbers 1 to 8 (with 1 blank square). Initially the numbers are arranged in no particular order. e.g.

6 1 7
3 4  
5 8 2

The player can move the blank 1 space in the directions North, East South, or West. On moving the blank, the space that the blank moves into moves into the blanks old position. e.g. moving the blank north would result in the game state looking like this.

6 1  
3 4 7
5 8 2

The game is complete when the numbers are in the following arrangement.

1 2 3
8   4
7 6 5

This concludes the introduction. On the next page I will get into the different ways in which this problem can be solved, and each methods advantage, and dissadvantage.

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.

“A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match” - Bill Bryson