{"ref":"master","ref_type":"branch","master_branch":"master","description":"Hill Climbing approach has taken to solve the 8 Queens problem. The board is simply defined as a two dimensional list, with the occupied elements stored as “Q” and empty elements as 0. The initial board is generated by picking a random row and column to place a queen, although the class structure allows for predefined boards to be manually passed in. If the spot on the board is occupied, then another spot is randomly chosen.  Violations are calculated by iterating through every queen and checking horizontally, vertically, and diagonally for other queens. Each violation is total up, and at the end they are divided by 2 since violations were overcounted. This could certainly be optimized further.  The hill solution works by checking every possible single move and returning the best of these. Algorithm simply attempts to move every space within a column rather than every open spot on the board – which would speed up the process by an order of magnitude and also decrease the likelihood of finding a solution by a small percentage. Also, it appears that the random initial state only contains one queen per column, which is also different from this implementation.   With this algorithm, every queen on the board tries to move to every spot on the board, and violations are re-calculated. A move with the least violations is chosen and the process repeats until there is no improvement. It there is no improvement after every queen has had a go, there is no solution found and the algorithm returns. If there is an improvement, the algorithm continues for another go-around.","pusher_type":"user"}
{"actor":{"display_login":"Shaisni"}}