[Gambas-user] Code optimization Fun

Brian G brian at westwoodsvcs.com
Tue May 18 16:11:10 CEST 2021


Hi , 
I am trying to figure out the best way to optimize the N queens problem in gambas. Have tried many different ways and settled on the method included in the attached program. 

The program Splits the problem into multiple tasks and then waits for all the tasks to complete. The program then collects the count from each task and presents the total number of good solutions to the problem. 

It seems impossible to get more than 18x18 queens solutions in a reasonable time. It would seem that there has never been more than 27x27 queens solution ever calculated. 

Can anyone see a better way to write the code reducing the time per starting position....... 

This is just for fun and entertainment... and learning how to write efficient code in gambas.... 

"Failure is the key to success; 
each mistake teaches us something" .. Morihei Ueshiba 
Brian G 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210518/cce986c3/attachment-0001.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nQueens-0.0.1.tar.gz.gmail.txt
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210518/cce986c3/attachment-0001.txt>


More information about the User mailing list