联合开发网   搜索   要求与建议
                登陆    注册
排序按匹配   按投票   按下载次数   按上传日期
按分类查找All 数值算法/人工智能(581) 

[数值算法/人工智能] 8数码

需要说明的是:本文示例图中的目标状态在计算上是最快捷的,首先取数很方便,一般地查看目标在第i个位置上的值,则需要访问数组goal[i],而这里goal[i]==i,故而无需访问数组;第二,要想知道数码n的目标位置,则需要找到goal[i]==n,然后row=i/3,col=i%3. 但是这里的话,row=n/3,col=n%3. 当我们用8位无符号整型来表示各个数码值(0~8)时,n/3和n%3操作是非常快的,比访问数组还快。 程序还提供一种玩游戏模式,即用户自己通过W,S,A,D四个键分别控制空格往上、下、左、右四个方向移动一步,功能很简单,界面部分是用OpenCV做的。界面部分和搜索部分是完全分离的,demo文件中main函数部分显示了如何将它们组合使用。
Need explanation is: This paper sample figure in the target state is the most efficient in calculation, the first number is very convenient, generally view the targets in the I position on the value, requires access to an array of goal[i], where goal[i]==i, therefore no need to access the array; second, to know the digital n the position of the target, you need to find goal[i]==n, row=i/3 and col=i%3., but here, row=n/3, col=n%3. when we use 8 bit unsigned integer to the digital value (0~8), n/3 and n%3 operations are very fast, faster than accessing array. Program also provides a play game mode, that is, users themselves through W, S, A, D, four keys, respectively, control space, up, down, left, right four directions move a step, the function is very simple, the interface part is done with OpenCV. The interface section is completely separate from the search section, and the main function section in the demo file shows how to combine them. (2017-07-06, Visual C++, 456KB, 下载1次)

http://www.pudn.com/Download/item/id/1499310731682666.html