
Finding the solution may seem easy but it really costs a lot of troubles. So it is a good question for us to use computer science to solve this puzzle. It is a good example of a problem which can be solved with a recursive algorithm. This puzzle is a tried-and-failed puzzle I believe. Placing one queen on the chessboard and then eliminate the row, column and diagonal's possibility of putting the next queen. Then put the next queen randomly in the rest of the position and repeat. If till the end there are no 8 queens on the chessboard, clean the chessboard and put the first queen on the chessboard randomly and repeat the previous process.
I believe that this puzzle can be solved with the combination of if and for loop. Combined with the function that we just learned, I believe that this can be a great project for us to practice.
没有评论:
发表评论