推箱子游戏中AI的实现

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

2010.19AI,。,。,,,,,,。1,,1。,,,,。[1],。,。,,2。,:(1)。(2)。1,。2,,。,[2],A*[3]。,m_stActiveState,3。,,。,[4],:(1);(2),,。,4。:,。,,。,,,C++。:;;;12YESNOYESNO3782010.19。:(1)。(2),5。。,。,,。(1)。(2)。(3)。(4)。,,4。2:typedefstructNOTESTACK{STATE*state;//NOTESTACK*next;NOTESTATE();//next=NULL;boolPush(STATE*newState);//pushSTATE*Pop();boolEmpty();}STACKSTATE;CPushBoxAI,m_man()、m_box()、m_bottomMap()、m_goal()。FindRoute():voidCPushBoxAI::FindRoute(){STATE*curState=newSTATE;//,//curState-Initial(m_man,m_box,NULL,m_bot-tomMap,m_goal,m_deadPoint);////NULLm_stAvailState-Push(curState);//STATE*newState=NULL;while(!m_stAvailState-Empty()){curState=m_stAvailState-Pop();//if(m_goal==curState-box)//{CompleteRoute(curState);//,break;}while(!curState-NoMove())//{newState=newSTATE;curState-MoveStep(newState,m_bottomMap,m_goal,m_deadPoint);//if(ReduplicateState(newState))//{deletenewState;//newState=NULL;continue;}if(!m_stAvailState-Add(newState))//m_lkAvailState{deletenewState;//newState=NULL;continue;}}m_vtRecycle.push_back(curState);////stlvector}ReleaseStateMemory();//m_lkAvailState//m_vtRecycle}3,350,10*10630s。,。,,。[1],..2007,9.[2],,,,..2003.[3]A*.[4],.(ACM/ICPC).2009.(:2010-08-01)4579

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功