Skip to content

LHang2002/Game-of-24

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Game-of-24

1.1 设计思维树

  • 如何定义“思维状态”?
  1. 当前可用数字
  2. 对应表达式
  3. 操作历史
  4. 搜索深度
  5. 评估分数
  • 画出搜索树的前2层结构(以[3,8]为例)
          [3, 8]
             |
   ┌────┬────┬────┐
   ↓    ↓    ↓    ↓
  11   -5   24  0.375
 (3+8)(3-8)(3*8)(3/8)
              ↓
           达成目标!
  • 如何避免重复搜索?
  1. 可用数字排序
  2. 使用哈希集合记录已访问状态
  3. 剪枝不必要的计算(a + b == b + a)

1.2 评估函数

  • 设计评估函数 evaluate(state) -> float [0,1],说明:
    • 评估标准
      1. 距离得分:越接近24分越高
      2. 进度得分:剩余数字越少分越高
    • 计算公式
      设当前数字列表为 N,目标值 T = 24

$$ \text{距离得分} = \frac{1}{1 + 0.1 \times \min_{n \in N}|n - T|} $$

$$ \text{进度得分} = \frac{4 - |N|}{3} $$

$$ \text{综合评分} = 0.6 \times \text{距离得分} + 0.4 \times \text{进度得分} $$

1.3 搜索策略

  • 选择一种搜索策略(BFS/DFS/Beam/Best-First)并说明理由。
    选择Best-First Search,因为它结合了广度优先的全面性和深度优先的效率,能够优先探索最有希望达到目标的状态,从而提高搜索效率。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages