文件名称:Ex24PointsGame
- 所属分类:
- 数值算法/人工智能
- 资源属性:
- [Windows] [Visual.Net] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 135kb
- 下载次数:
- 0次
- 提 供 者:
- xyc****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
一、前言
24点游戏是一个常见游戏,出题者给出4个整数,要求答题者在指定时间内给出一个四则运算的表达式,恰好用上这这个整数各一次,计算结果为24,超出时间为输。
二、分析
用计算机来算这个题,搜索速度当然有很大优势,我编程喜欢考虑通用一点,不限制输入数量和结果数,甚至不限制运算符数量。这样组合数就很大,如果输入数比较多,则搜索时间会非常长。
我用两个方法来提高搜索速度:一、是大家都能考虑到的重复搜索问题,比如1,2,3和2,3,1所有的组合情况是相同的,我只搜索使用递增序的数组,则可以降低一个组合数的数量级别;二、使用动态规划中的备忘录方法,比如你计算出2和3所有可能的计算结果,则他们与4结合的时候,要用到,与1结合的时候,也要用到,使用备忘录,可以只计算一次,大大降低运算复杂度。
三、设计
整体设计:分别设计4个类:游戏、表达式、运算、分数,各司其责,结构清晰,易于扩展。
-First, the preamble
24-point game is a common game, give the title are four integer requiring answer within a specified period of time in a four calculations give the expression, just use that the integral of the time, results for the 24, beyond the time to lose.
Second, analysis
Use computers to count the title, the search speed of course, there is a great advantage, I enjoy taking generic programming that does not restrict the importation of the volume and the number of results, and even limiting the number of operators. So on a large number of combinations, if you type a few more, then the search will be a very long time.
I used two methods to improve search speed: one is the U.S. able to take into account the problem of duplicate search, such as 1,2,3 and 2,3,1 is a combination of all the same, I just search using the sequence of incremental array, you can reduce the quantity of a combination of the number of level two, the use of dynamic programming methods in the mem
24点游戏是一个常见游戏,出题者给出4个整数,要求答题者在指定时间内给出一个四则运算的表达式,恰好用上这这个整数各一次,计算结果为24,超出时间为输。
二、分析
用计算机来算这个题,搜索速度当然有很大优势,我编程喜欢考虑通用一点,不限制输入数量和结果数,甚至不限制运算符数量。这样组合数就很大,如果输入数比较多,则搜索时间会非常长。
我用两个方法来提高搜索速度:一、是大家都能考虑到的重复搜索问题,比如1,2,3和2,3,1所有的组合情况是相同的,我只搜索使用递增序的数组,则可以降低一个组合数的数量级别;二、使用动态规划中的备忘录方法,比如你计算出2和3所有可能的计算结果,则他们与4结合的时候,要用到,与1结合的时候,也要用到,使用备忘录,可以只计算一次,大大降低运算复杂度。
三、设计
整体设计:分别设计4个类:游戏、表达式、运算、分数,各司其责,结构清晰,易于扩展。
-First, the preamble
24-point game is a common game, give the title are four integer requiring answer within a specified period of time in a four calculations give the expression, just use that the integral of the time, results for the 24, beyond the time to lose.
Second, analysis
Use computers to count the title, the search speed of course, there is a great advantage, I enjoy taking generic programming that does not restrict the importation of the volume and the number of results, and even limiting the number of operators. So on a large number of combinations, if you type a few more, then the search will be a very long time.
I used two methods to improve search speed: one is the U.S. able to take into account the problem of duplicate search, such as 1,2,3 and 2,3,1 is a combination of all the same, I just search using the sequence of incremental array, you can reduce the quantity of a combination of the number of level two, the use of dynamic programming methods in the mem
(系统自动生成,下载前可以参看下载内容)
下载文件列表
扩展24点游戏动态规划求解
........................\24点游戏通用动态规划解.docx
........................\bin
........................\...\Debug
........................\...\.....\扩展24点游戏动态规划求解.exe
........................\...\.....\扩展24点游戏动态规划求解.pdb
........................\...\.....\扩展24点游戏动态规划求解.vshost.exe
........................\EquationGame.cs
........................\Expression.cs
........................\Form1.cs
........................\Form1.Designer.cs
........................\Form1.resx
........................\Fraction.cs
........................\obj
........................\...\Debug
........................\...\.....\Refactor
........................\...\.....\TempPE
........................\...\.....\扩展24点游戏动态规划求解.csproj.GenerateResource.Cache
........................\...\.....\扩展24点游戏动态规划求解.exe
........................\...\.....\扩展24点游戏动态规划求解.Form1.resources
........................\...\.....\扩展24点游戏动态规划求解.pdb
........................\...\.....\扩展24点游戏动态规划求解.Properties.Resources.resources
........................\...\.....\求四则运算等式.csproj.GenerateResource.Cache
........................\...\.....\求四则运算等式.Form1.resources
........................\...\扩展24点游戏动态规划求解.csproj.FileListAbsolute.txt
........................\...\求四则运算等式.csproj.FileListAbsolute.txt
........................\Operator.cs
........................\Program.cs
........................\Properties
........................\..........\AssemblyInfo.cs
........................\..........\Resources.Designer.cs
........................\..........\Resources.resx
........................\..........\Settings.Designer.cs
........................\..........\Settings.settings
........................\扩展24点游戏动态规划求解.csproj
........................\扩展24点游戏动态规划求解.sln
........................\24点游戏通用动态规划解.docx
........................\bin
........................\...\Debug
........................\...\.....\扩展24点游戏动态规划求解.exe
........................\...\.....\扩展24点游戏动态规划求解.pdb
........................\...\.....\扩展24点游戏动态规划求解.vshost.exe
........................\EquationGame.cs
........................\Expression.cs
........................\Form1.cs
........................\Form1.Designer.cs
........................\Form1.resx
........................\Fraction.cs
........................\obj
........................\...\Debug
........................\...\.....\Refactor
........................\...\.....\TempPE
........................\...\.....\扩展24点游戏动态规划求解.csproj.GenerateResource.Cache
........................\...\.....\扩展24点游戏动态规划求解.exe
........................\...\.....\扩展24点游戏动态规划求解.Form1.resources
........................\...\.....\扩展24点游戏动态规划求解.pdb
........................\...\.....\扩展24点游戏动态规划求解.Properties.Resources.resources
........................\...\.....\求四则运算等式.csproj.GenerateResource.Cache
........................\...\.....\求四则运算等式.Form1.resources
........................\...\扩展24点游戏动态规划求解.csproj.FileListAbsolute.txt
........................\...\求四则运算等式.csproj.FileListAbsolute.txt
........................\Operator.cs
........................\Program.cs
........................\Properties
........................\..........\AssemblyInfo.cs
........................\..........\Resources.Designer.cs
........................\..........\Resources.resx
........................\..........\Settings.Designer.cs
........................\..........\Settings.settings
........................\扩展24点游戏动态规划求解.csproj
........................\扩展24点游戏动态规划求解.sln