不知道
来源:互联网 发布:第一岛链 知乎 编辑:程序博客网 时间:2024/04/27 23:33
vi oldId = id( oldState );
int& oldDir = direction[oldId];
//--- Apply all applicable moves to it and handle the new state.
for( int move=0;move<18;move++ ){
if( applicableMoves[phase]& (1 << move) ){
//--- Apply the move.
vi newState= applyMove(move, oldState);
vi newId= id( newState );
int& newDir = direction[newId];
//--- Have we seen this state (id) from the other direction already?
//--- I.e. have we found a connection?
if( newDir && newDir != oldDir ){
//--- Make oldId represent the forwards and newId the backwards search state.
if( oldDir > 1 ){
swap( newId, oldId );
move =inverse( move);
}
//--- Reconstruct the connecting algorithm.
vi algorithm(1, move );
while(oldId != currentId){
algorithm.insert(algorithm.begin(),lastMove[ oldId] );
oldId =predecessor[ oldId];
}
while(newId != goalId){
algorithm.push_back(inverse( lastMove[newId ] ));
newId =predecessor[ newId];
}
//--- Print and apply the algorithm.
for( int i=0;i<(int)algorithm.size();i++ ){
cout <<"UDFBLR"[algorithm[i]/3]<< algorithm[i]%3+1;
currentState = applyMove( algorithm[i],currentState );
}
//--- Jump to the next phase.
goto nextPhasePlease;
}
//--- If we've never seen this state (id) before, visit it.
if( ! newDir ){
q.push(newState );
newDir =oldDir;
lastMove[newId ] = move;
predecessor[newId ] = oldId;
}
}
}
}
nextPhasePlease:
;
}
}
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 不知道
- 知道不知道
- 知道不知道
- 不知道自己不知道 知道自己不知道 不知道自己知道 知道自己知道
- 已知前序中序,输出后序
- 程序员网站
- Spring mvc 环境配置及Hello World!
- 精灵sprite的创建方式
- NYOJ587blockhouses(深搜)
- 不知道
- python 中使用 chardet 模块
- Java异常体系
- 解释型语言
- linux shell编程指南第十五章------引号
- 将一个数转换成n进制(2<=n<=26)
- jQuery1.9为动态添加元素绑定事件以及获取和操作checkbox的选择属性
- C# 字符串比较 效率
- C#创建com组件