Wednesday, March 20, 2013

An Approach to solve Artificial Intelligence 8 queens puzzle with pen and paper, and mind. Tag, Genetic Algorithm.

Just for fun, was thinking about this on my way home:
(**Not related to Network Security, but this term I take an Intro to AI class**)


8 queens puzzle

( 7 4 2 8 6 1 3 5 )
( 3 5 7 1 4 2 8 6 )
( 4 2 8 6 1 3 5 7 )
( 5 7 1 4 2 8 6 3 )

I've found that it's possible to find at least 3 combinations of solution within 5 minutes using only pen and paper, and your mind.

By applying the following conditions:

1. The position 1th-8th must be given each a unique number. (This is to avoid vertical or horizontal attacks)
2. Given any position number 'x', and another position number 'y'
and 'i' is the displacement between 'x' and 'y'
This condition must always be true: i != | x - y |
(This is to avoid the diagonal attack)

No brainer method:

1. First just avoid the diagonal attacks between each pair that has 1 displacement.
2. Just swap around you will find the answer soon enough.
3. I notice the pattern of [4 2 8 6 | 1 3 5 7] to be very useful.

Afterthought:

Would it contribute to the speed of finding a solution when applying this method as a criteria in GA?

or

Would the calculation that comes with this method slow down the process?

No comments:

Post a Comment