文件名称:BaHuangHou
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:30.44kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
题目:八皇后问题。
八皇后问题是指求解如何在国际象棋8*8棋盘上无冲突的放置八个皇后棋子。因为在国际象棋里,皇后的移动方式是横竖交叉,所以在任意一个皇后所在的位置的水平,竖直和斜45度都不能有其他棋子的存在。一个完整的无冲突的八皇后棋子分布成为八皇后问题的一个解。设计思路:我使用了回溯的方法来解决八皇后问题,也就是逐次试探的方法。这个方法是通过函数putchess()对自身的递归调用来实现的。运行程序后,主函数调用putchess()函数在棋盘第一行第一列上放置棋子,开始向下一行递归。每一步的递归中,首先检测待放位置有没有冲突出现,如果没有冲突,就放下棋子,并进入下一行递归,否则检测该行的下一个位置。如果整个一行中都没有可以放置的位置,就退回上一层递归。最后,如果本次放置成功,并且递归调用深度为7,就打印输出结果。-Title: Queen s eight questions.
Queen s eight questions refer to how to solve the 8* 8 chess board placed on the eight conflict-free Queen s pawn. Since at chess, the Queen of the mobile means are横竖cross, so at any one location s level, vertical and inclined 45 degrees can not have other pieces exist. A complete conflict-free distribution of the eight Queen s pawn to become queen eight questions a solution. Design ideas: I use a retrospective method to solve the eight Queen s question, that is, successive test method. This method is through the function putchess () recursive calls of their own to achieve. After running the program, the main function call putchess () function at the first line of the first column of the chessboard placed on a pawn down and his party start recursion. Every step of the recursion, the first question put Detect location appears there is no conflict, if there is no conflict, it is down a pawn, and into the next line recursive, otherwise detect the locatio
八皇后问题是指求解如何在国际象棋8*8棋盘上无冲突的放置八个皇后棋子。因为在国际象棋里,皇后的移动方式是横竖交叉,所以在任意一个皇后所在的位置的水平,竖直和斜45度都不能有其他棋子的存在。一个完整的无冲突的八皇后棋子分布成为八皇后问题的一个解。设计思路:我使用了回溯的方法来解决八皇后问题,也就是逐次试探的方法。这个方法是通过函数putchess()对自身的递归调用来实现的。运行程序后,主函数调用putchess()函数在棋盘第一行第一列上放置棋子,开始向下一行递归。每一步的递归中,首先检测待放位置有没有冲突出现,如果没有冲突,就放下棋子,并进入下一行递归,否则检测该行的下一个位置。如果整个一行中都没有可以放置的位置,就退回上一层递归。最后,如果本次放置成功,并且递归调用深度为7,就打印输出结果。-Title: Queen s eight questions.
Queen s eight questions refer to how to solve the 8* 8 chess board placed on the eight conflict-free Queen s pawn. Since at chess, the Queen of the mobile means are横竖cross, so at any one location s level, vertical and inclined 45 degrees can not have other pieces exist. A complete conflict-free distribution of the eight Queen s pawn to become queen eight questions a solution. Design ideas: I use a retrospective method to solve the eight Queen s question, that is, successive test method. This method is through the function putchess () recursive calls of their own to achieve. After running the program, the main function call putchess () function at the first line of the first column of the chessboard placed on a pawn down and his party start recursion. Every step of the recursion, the first question put Detect location appears there is no conflict, if there is no conflict, it is down a pawn, and into the next line recursive, otherwise detect the locatio
相关搜索: chess board detect
bahuanghou
(系统自动生成,下载前可以参看下载内容)
下载文件列表
BaHuangHou/大作业4.cpp
BaHuangHou/大作业4.exe
BaHuangHou/大作业4.txt
BaHuangHou
BaHuangHou/大作业4.exe
BaHuangHou/大作业4.txt
BaHuangHou
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.