麻将mte西安程序麻将机是什么下载的

WACOM Bamboo MTE-450驱动下载
接口类型USB产品尺寸约200x186x10.2产品重量约330克(不含数兼容系统Windows 2000 &其它参数精确度,笔:+/- 感应方式电磁式活动区域4x6英寸读取速度133点/秒读取分辨2540LPI
其他工具驱动品牌排行
WACOM Bamboo MTE-450驱动下载
WACOM Bamboo MTE-450通用驱动下载(当您不确定具体型号的时候)
下载的人还下载了
热门其他工具驱动排行?您当前的位置: >
[AS3]as3.0中国麻将算法中国牌技算法源代码实例
时间: 17:29oschina.net
as3.0中国麻将算法中国牌技算法源代码实例,看着头大。as3麻将算法,as3牌技算法
as3.0中国麻将算法中国牌技算法源代码实例,看着头大。
/**&*&麻将算法&*&@author&Michael&*&@home&/wwwanq/&*&@E-mail&&*&@qq&&*/&&package&{&&public&class&Search&{&&&private&static&const&HASH_ALPHA:int&=&1;&&&private&static&const&HASH_BETA:int&=&2;&&&private&static&const&HASH_PV:int&=&3;&&&private&static&const&LIMIT_DEPTH:int&=&64;&&&private&static&const&NULL_DEPTH:int&=&2;&&&private&static&const&RANDOM_MASK:int&=&7;&&&private&static&const&MAX_GEN_MOVES:int&=&Position.MAX_GEN_MOVES;&&&private&static&const&MATE_VALUE:int&=&Position.MATE_VALUE;&&&private&static&const&BAN_VALUE:int&=&Position.BAN_VALUE;&&&private&static&const&WIN_VALUE:int&=&Position.WIN_VALUE;&&&private&static&const&NO_NULL:Boolean&=&true;&&&&private&var&nHashMask:int,&mvResult:int,&nAllNodes:int,&nAllMillis:&&&private&var&hshTable:A&&&&public&var&pos:P&&&public&var&nHistoryTable&=&new&Array(4096);&&&public&var&mvKiller1&=&new&Array(LIMIT_DEPTH);&&&public&var&mvKiller2&=&new&Array(LIMIT_DEPTH);&&&&public&function&Search(pos_:Position,&nHashLevel:int)&{&&&&pos&=&pos_;&&&&nHashMask&=&(1&&)&-&1;&&&&hshTable&=&new&Array(nHashMask&+&1);&&&&var&i:&&&&for&(i&=&0;&i&=&nHashM&i&++)&{&&&&&hshTable[i]&=&new&HashItem();&&&&}&&&}&&&&private&function&getHashItem():HashItem&{&&&&return&hshTable[pos.dwKey&&&nHashMask];&&&}&&&&private&function&probeHash(vlAlpha:int,&vlBeta:int,&nDepth:int,&mv:Array):int&{&&&&var&hsh:HashItem&=&getHashItem();&&&&if&(hsh.dwLock&!=&pos.dwLock)&{&&&&&mv[0]&=&0;&&&&&return&-MATE_VALUE;&&&&}&&&&mv[0]&=&hsh.&&&&var&bMate:Boolean&=&false;&&&&if&(hsh.vl&&WIN_VALUE)&{&&&&&if&(hsh.vl&=&BAN_VALUE)&{&&&&&&return&-MATE_VALUE;&&&&&}&&&&&hsh.vl&-=&pos.nD&&&&&bMate&=&true;&&&&}&else&if&(hsh.vl&&)&{&&&&&if&(hsh.vl&=&-BAN_VALUE)&{&&&&&&return&-MATE_VALUE;&&&&&}&&&&&hsh.vl&+=&pos.nD&&&&&bMate&=&true;&&&&}&else&if&(hsh.vl&==&pos.drawValue())&{&&&&&return&-MATE_VALUE;&&&&}&&&&if&(hsh.nDepth&=&nDepth&||&bMate)&{&&&&&if&(hsh.nFlag&==&HASH_BETA)&{&&&&&&return&(hsh.vl&=&vlBeta&?&hsh.vl&:&-MATE_VALUE);&&&&&}&else&if&(hsh.nFlag&==&HASH_ALPHA)&{&&&&&&return&(hsh.vl&=&vlAlpha&?&hsh.vl&:&-MATE_VALUE);&&&&&}&&&&&return&hsh.&&&&}&&&&return&-MATE_VALUE;&&&}&&&&private&function&recordHash(nFlag:int,&vl:int,&nDepth:int,&mv:int):void&{&&&&var&hsh:HashItem&=&getHashItem();&&&&if&(hsh.nDepth&&nDepth)&{&&&&&&&&&}&&&&hsh.nFlag&=&nF&&&&hsh.nDepth&=&nD&&&&if&(vl&&WIN_VALUE)&{&&&&&if&(mv&==&0&&&&vl&=&BAN_VALUE)&{&&&&&&&&&&&}&&&&&hsh.vl&=&vl&+&pos.nD&&&&}&else&if&(vl&&)&{&&&&&if&(mv&==&0&&&&vl&=&-BAN_VALUE)&{&&&&&&&&&&&}&&&&&hsh.vl&=&vl&-&pos.nD&&&&}&else&if&(vl&==&pos.drawValue()&&&&mv&==&0)&{&&&&&&&&&}&else&{&&&&&hsh.vl&=&&&&&}&&&&hsh.mv&=&&&&&hsh.dwLock&=&pos.dwL&&&}&&&&private&function&setBestMove(mv:int,&nDepth:int):void&{&&&&nHistoryTable[pos.historyIndex(mv)]&+=&nDepth&*&nD&&&&if&(mvKiller1[pos.nDistance]&!=&mv)&{&&&&&mvKiller2[pos.nDistance]&=&mvKiller1[pos.nDistance];&&&&&mvKiller1[pos.nDistance]&=&&&&&}&&&}&&&&private&function&searchQuiesc(vlAlpha:int,&vlBeta:int):int&{&&&&nAllNodes&++;&&&&var&vl:int&=&pos.nDistance&-&MATE_VALUE;&&&&if&(vl&=&vlBeta)&{&&&&&return&&&&&}&&&&var&vlRep:int&=&pos.repStatus();&&&&if&(vlRep&&0)&{&&&&&return&pos.repValue(vlRep);&&&&}&&&&if&(pos.nDistance&==&LIMIT_DEPTH)&{&&&&&return&pos.evaluate();&&&&}&&&&var&vlBest:int&=&-MATE_VALUE;&&&&var&i:int,&nGenMoves:&&&&var&mvs:Array&=&new&Array(MAX_GEN_MOVES);&&&&var&vls:Array&=&new&Array(MAX_GEN_MOVES);&&&&if&(pos.inCheck())&{&&&&&nGenMoves&=&pos.generateMoves(mvs);&&&&&for&(i&=&0;&i&&;&i&++)&{&&&&&&vls[i]&=&nHistoryTable[pos.historyIndex(mvs[i])];&&&&&}&&&&&Util.shellSort(mvs,&vls,&0,&nGenMoves);&&&&}&else&{&&&&&vl&=&pos.evaluate();&&&&&if&(vl&&vlBest)&{&&&&&&if&(vl&=&vlBeta)&{&&&&&&&return&&&&&&&}&&&&&&vlvlBest&=&&&&&&&if&(vl&&vlAlpha)&{&&&&&&&vlvlAlpha&=&&&&&&&}&&&&&}&&&&&nGenMoves&=&pos.generateMoves(mvs,&vls);&&&&&Util.shellSort(mvs,&vls,&0,&nGenMoves);&&&&&for&(i&=&0;&i&&;&i&++)&{&&&&&&if&(vls[i]&&&||&(vls[i]&&&&&&Position.HOME_HALF(Position.DST(mvs[i]),&pos.sdPlayer)))&{&&&&&&&nGenMoves&=&i;&&&&&&&&&&&&&}&&&&&}&&&&}&&&&for&(i&=&0;&i&&;&i&++)&{&&&&&if&(!pos.makeMove(mvs[i]))&{&&&&&&&&&&&}&&&&&vl&=&-searchQuiesc(-vlBeta,&-vlAlpha);&&&&&pos.undoMakeMove();&&&&&if&(vl&&vlBest)&{&&&&&&if&(vl&=&vlBeta)&{&&&&&&&return&&&&&&&}&&&&&&vlvlBest&=&&&&&&&if&(vl&&vlAlpha)&{&&&&&&&vlvlAlpha&=&&&&&&&}&&&&&}&&&&}&&&&return&vlBest&==&-MATE_VALUE&?&pos.nDistance&-&MATE_VALUE:&vlB&&&}&&&&private&function&searchFull(vlAlpha:int,&vlBeta:int,&nDepth:int,&bNoNull:Boolean&=&false):int&{&&&&if&(nDepth&=&0)&{&&&&&return&searchQuiesc(vlAlpha,&vlBeta);&&&&}&&&&nAllNodes&++;&&&&var&vl:int&=&pos.nDistance&-&MATE_VALUE;&&&&if&(vl&=&vlBeta)&{&&&&&return&&&&&}&&&&var&vlRep:int&=&pos.repStatus();&&&&if&(vlRep&&0)&{&&&&&return&pos.repValue(vlRep);&&&&}&&&&var&mvHash:Array&=&new&Array(1);&&&&vl&=&probeHash(vlAlpha,&vlBeta,&nDepth,&mvHash);&&&&if&(vl&&-MATE_VALUE)&{&&&&&return&&&&&}&&&&if&(pos.nDistance&==&LIMIT_DEPTH)&{&&&&&return&pos.evaluate();&&&&}&&&&if&(!bNoNull&&&&!pos.inCheck()&&&&pos.nullOkay())&{&&&&&pos.nullMove();&&&&&vl&=&-searchFull(-vlBeta,&1&-&vlBeta,&nDepth&-&NULL_DEPTH&-&1,&NO_NULL);&&&&&pos.undoNullMove();&&&&&if&(vl&=&vlBeta&&&&(pos.nullSafe()&&&&searchFull(vlAlpha,&vlBeta,&nDepth,&NO_NULL)&=&vlBeta))&{&&&&&&return&&&&&&}&&&&}&&&&var&nHashFlag:int&=&HASH_ALPHA;&&&&var&vlBest:int&=&-MATE_VALUE;&&&&var&mvBest:int&=&0;&&&&var&sort:SortItem&=&new&SortItem(this,&mvHash[0]);&&&&var&mv:&&&&while&((mv&=&sort.nextMove())&&0)&{&&&&&if&(!pos.makeMove(mv))&{&&&&&&&&&&&}&&&&&var&nNewDepth:int&=&pos.inCheck()&?&nDepth&:&nDepth&-&1;&&&&&if&(vlBest&==&-MATE_VALUE)&{&&&&&&vl&=&-searchFull(-vlBeta,&-vlAlpha,&nNewDepth);&&&&&}&else&{&&&&&&vl&=&-searchFull(-vlAlpha&-&1,&-vlAlpha,&nNewDepth);&&&&&&if&(vl&&vlAlpha&&&&vl&&)&{&&&&&&&vl&=&-searchFull(-vlBeta,&-vlAlpha,&nNewDepth);&&&&&&}&&&&&}&&&&&pos.undoMakeMove();&&&&&if&(vl&&vlBest)&{&&&&&&vlvlBest&=&&&&&&&if&(vl&=&vlBeta)&{&&&&&&&nHashFlag&=&HASH_BETA;&&&&&&&mvmvBest&=&&&&&&&&&&&&&&}&&&&&&if&(vl&&vlAlpha)&{&&&&&&&vlvlAlpha&=&&&&&&&&nHashFlag&=&HASH_PV;&&&&&&&mvmvBest&=&&&&&&&}&&&&&}&&&&}&&&&if&(vlBest&==&-MATE_VALUE)&{&&&&&return&pos.nDistance&-&MATE_VALUE;&&&&}&&&&recordHash(nHashFlag,&vlBest,&nDepth,&mvBest);&&&&if&(mvBest&&0)&{&&&&&setBestMove(mvBest,&nDepth);&&&&}&&&&return&vlB&&&}&&&&private&function&searchRoot(nDepth):int&{&&&&var&vlBest:int&=&-MATE_VALUE;&&&&var&sort:SortItem&=&new&SortItem(this,&mvResult);&&&&var&mv:&&&&while&((mv&=&sort.nextMove())&&0)&{&&&&&if&(!pos.makeMove(mv))&{&&&&&&&&&&&}&&&&&var&nNewDepth&=&pos.inCheck()&?&nDepth&:&nDepth&-&1;&&&&&var&vl:&&&&&if&(vlBest&==&-MATE_VALUE)&{&&&&&&vl&=&-searchFull(-MATE_VALUE,&MATE_VALUE,&nNewDepth,&NO_NULL);&&&&&}&else&{&&&&&&vl&=&-searchFull(-vlBest&-&1,&-vlBest,&nNewDepth);&&&&&&if&(vl&&vlBest)&{&&&&&&&vl&=&-searchFull(-MATE_VALUE,&-vlBest,&nNewDepth,&NO_NULL);&&&&&&}&&&&&}&&&&&pos.undoMakeMove();&&&&&if&(vl&&vlBest)&{&&&&&&vlvlBest&=&&&&&&&mvmvResult&=&&&&&&&if&(vlBest&&-WIN_VALUE&&&&vlBest&&)&{&&&&&&&vlBest&+=&int(Math.random()&*&RANDOM_MASK)&-&int(Math.random()&*&RANDOM_MASK);&&&&&&&vlBest&=&(vlBest&==&pos.drawValue()&?&vlBest&-&1&:&vlBest);&&&&&&}&&&&&}&&&&}&&&&setBestMove(mvResult,&nDepth);&&&&return&vlB&&&}&&&&public&function&searchMain(nMillis:int,&nDepth:int&=&LIMIT_DEPTH):int&{&&&&mvResult&=&pos.bookMove();&&&&if&(mvResult&&0)&{&&&&&pos.makeMove(mvResult);&&&&&if&(pos.repStatus(3)&==&0)&{&&&&&&pos.undoMakeMove();&&&&&&return&mvR&&&&&}&&&&&pos.undoMakeMove();&&&&}&&&&var&vl:int&=&0;&&&&var&mvs:Array&=&new&Array(MAX_GEN_MOVES);&&&&var&nGenMoves:int&=&pos.generateMoves(mvs);&&&&var&i:&&&&for&(i&=&0;&i&&;&i&++)&{&&&&&if&(pos.makeMove(mvs[i]))&{&&&&&&pos.undoMakeMove();&&&&&&mvResult&=&mvs[i];&&&&&&vl&++;&&&&&}&&&&}&&&&if&(vl&==&1)&{&&&&&return&mvR&&&&}&&&&for&(i&=&0;&i&=&nHashM&i&++)&{&&&&&var&hsh:HashItem&=&hshTable[i];&&&&&hshhsh.nDepth&=&hsh.nFlag&=&hsh.vl&=&hsh.mv&=&0;&&&&&hsh.dwLock&=&0;&&&&}&&&&for&(i&=&0;&i&&;&i&++)&{&&&&&mvKiller1[i]&=&mvKiller2[i]&=&0;&&&&}&&&&for&(i&=&0;&i&&;&i&++)&{&&&&&nHistoryTable[i]&=&0;&&&&}&&&&mvResult&=&0;&&&&nAllNodes&=&0;&&&&pos.nDistance&=&0;&&&&var&t:Number&=&new&Date().getTime();&&&&for&(i&=&1;&i&=&nD&i&++)&{&&&&&vl&=&searchRoot(i);&&&&&if&(vl&&WIN_VALUE&||&vl&&)&{&&&&&&&&&&&}&&&&&nAllMillis&=&new&Date().getTime()&-&t;&&&&&if&(nAllMillis&&nMillis)&{&&&&&&&&&&&}&&&&}&&&&return&mvR&&&}&&&&public&function&getKNPS():int&{&&&&return&nAllNodes&/&nAllM&&&}&&}&}&
酷播交流2群:(新群)
酷播交流1群:(已满)

我要回帖

更多关于 不装程序的麻将作弊器 的文章

 

随机推荐