- 最后登录
- 2024-11-23
- 在线时间
- 938 小时
- 阅读权限
- 40
- 注册时间
- 2008-1-6
- 积分
- 1960
- 帖子
- 1075
- 精华
- 6
- UID
- 17579
- 性别
- 保密
- 积分
- 1960
- 帖子
- 1075
- 精华
- 6
- UID
- 17579
- 性别
- 保密
|
回复 91# 的帖子
伪码是这样的:- maxLength=9999
- function Kociemba ( position p)
- for depth d from 0 to maxLength
- Phase1search( p; d )
- endfor
- endfunction
- function Phase1search( position p; depth d )
- if d=0 then
- if subgoal reached and last move was a quarter turn of R, L, F, or B then
- Phase2start( p )
- endif
- elseif d>0 then
- if prune1[p]<=d then
- for each available move m
- Phase1search( result of m applied to p; d-1 )
- endfor
- endif
- endif
- endfunction
- function Phase2start ( position p)
- for depth d from 0 to maxLength - currentDepth
- Phase2search( p; d )
- endfor
- endfunction
- function Phase2search( position p; depth d )
- if d=0 then
- if solved then
- Found a solution!
- maxLength = currentDepth-1
- endif
- elseif d>0 then
- if prune2[p]<=d then
- for each available move m
- Phase2search( result of m applied to p; d-1 )
- endfor
- endif
- endif
- endfunction
复制代码 不是去掉-1。我想我要慢慢理解这个2-phase。 |
|