YOOtheme
October 2008
Mo Tu We Th Fr Sa Su
« Apr    
 12345
6789101112
13141516171819
20212223242526
2728293031  
BlogrollCategoriesArchives
0003.jpg

8 Queens on A Chessboard

Placing 8 Queens on a chessboard is a classic problem and is one of the good interview question. Following code is my take on this problem. However, instead of starting queen placement at predefined position (at 0,0 or at a corner), 1st queen placement in first row can be specified by user.

 
This program is iterative rule based algorithm. Implementation is mainly C with few C++ constructs.
  
A two dimensional array of 8×8 is used to represent chess board. Value ‘0′ in an element of this array represents that corresponding location in chessboard is empty. Similarly value ‘99′ indicates that corresponding location has a queen placed in it. Any other value in an element indicates influence weight of various queens on this element.  
 
Code can be downloaded at C/C++ Code.  
 

Watch above algorithm in action here.

Welcome To Enginuity Systems!

We @ Enginuity Systems welcome to you to our blog. Team will be posting exciting blogs and articles in this section. Stay tuned!!

We have developed this site using Joomla!. Joomla! is the ideal tool for developing small to large dynamic community websites, intra company portals, corporate portals, weblogs and much more. The MojoBlog component is a integration of WordPress within Joomla, Our aim is to develop a more semantic, flexible and powerful blogging tool for Joomla! users.

If you are interested in your website design using Joomla!, we can help you. Please contact us and we will be happy to talk to you.

Please see our offering section for full list. Thanks