📄 group__move.html
字号:
01483 <span class="keywordflow">if</span> (x == <a class="code" href="group__mac.html#gga56a56">NOMOVE</a>) {01484 s[0] = <span class="charliteral">' '</span>;01485 s[1] = <span class="charliteral">' '</span>;01486 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x == <a class="code" href="group__mac.html#gga56a57">PASS</a>) {01487 s[0] = <span class="charliteral">'p'</span>;01488 s[1] = <span class="charliteral">'s'</span>;01489 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (x >= <a class="code" href="group__mac.html#gga56a58">A1</a> && x <= H8 && x % 9 > 0) {01490 s[0] = x % 9 + <span class="charliteral">'a'</span> - 1;01491 s[1] = x / 9 + <span class="charliteral">'1'</span> - 1;01492 } <span class="keywordflow">else</span> {01493 s[0] = <span class="charliteral">'?'</span>;01494 s[1] = <span class="charliteral">'?'</span>;01495 }01496 01497 <span class="keywordflow">if</span> (player == <a class="code" href="group__mac.html#gga58a130">BLACK</a>) {01498 s[0] = toupper(s[0]);01499 s[1] = toupper(s[1]);01500 }01501 fputc(s[0], f);01502 fputc(s[1], f);01503 }</pre></div> </td> </tr></table><a class="anchor" name="ga2" doxytag="solver.c::movelist_sort_bestmove" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void movelist_sort_bestmove </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="structMoveList.html">MoveList</a> * </td> <td class="mdname" nowrap> <em>movelist</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>move</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Sort a move as best. <p>Put a move at the head of the list. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>movelist</em> </td><td>list of moves to sort. </td></tr> <tr><td valign=top><em>move</em> </td><td>best move to to set first. </td></tr> </table></dl><p><div class="fragment"><pre>01557 {01558 <a class="code" href="structMoveList.html">MoveList</a> *iter, *previous;01559 01560 <span class="keywordflow">for</span> (iter = (previous = movelist)-><a class="code" href="structMoveList.html#o1">next</a>; iter != NULL; iter = (previous = iter)-><a class="code" href="structMoveList.html#o1">next</a>) {01561 <span class="keywordflow">if</span> (*iter-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o0">position</a> == move) {01562 previous->next = iter-><a class="code" href="structMoveList.html#o1">next</a>;01563 iter-><a class="code" href="structMoveList.html#o1">next</a> = movelist-><a class="code" href="structMoveList.html#o1">next</a>;01564 movelist-><a class="code" href="structMoveList.html#o1">next</a> = iter;01565 <span class="keywordflow">break</span>;01566 }01567 }01568 }</pre></div> </td> </tr></table><a class="anchor" name="ga3" doxytag="solver.c::movelist_sort_fastfirst" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void movelist_sort_fastfirst </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="structMoveList.html">MoveList</a> * </td> <td class="mdname" nowrap> <em>movelist</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="structBoard.html">Board</a> * </td> <td class="mdname" nowrap> <em>board</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Sort a list of move, fastest-first. <p>Sort a list to accelerate the alphabeta research. The moves that minimize opponent mobility and increase player's relative stability will be played first. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>movelist</em> </td><td>: list of moves to sort. </td></tr> <tr><td valign=top><em>board</em> </td><td>: board on which the moves applied. </td></tr> </table></dl><p><div class="fragment"><pre>01580 {01581 <a class="code" href="structMoveList.html">MoveList</a> *iter, *best, *previous_best, *previous;01582 <a class="code" href="structSquareList.html">SquareList</a> *empties;01583 <span class="keyword">const</span> <span class="keywordtype">char</span> p = board-><a class="code" href="structBoard.html#o1">player</a>;01584 <span class="keyword">const</span> <span class="keywordtype">char</span> o = <a class="code" href="group__mac.html#ga50">OPPONENT</a>(p);01585 01586 <span class="keywordflow">for</span> (iter = movelist-><a class="code" href="structMoveList.html#o1">next</a>; iter != NULL; iter = iter-><a class="code" href="structMoveList.html#o1">next</a>) {01587 <a class="code" href="group__mac.html#ga36">BOARD_UPDATE_SQUARE</a>(board, &(iter-><a class="code" href="structMoveList.html#o0">move</a>));01588 <a class="code" href="group__mac.html#ga46">BOARD_LAST_UPDATE_EMPTIES</a>(board, empties, *iter-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o0">position</a>);01589 <a class="code" href="group__mac.html#ga29">BOARD_UPDATE_ALL_NODES</a>();01590 <span class="preprocessor">#if PLAY_STABLEST_SUBTREE</span>01591 <span class="preprocessor"></span> iter-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o2">score</a> = (<a class="code" href="group__board.html#ga10">board_get_mobility</a>(board, o) << 4) - <a class="code" href="group__board.html#ga11">board_get_corner_stability</a>(board, p);01592 <span class="preprocessor">#else</span>01593 <span class="preprocessor"></span> iter-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o2">score</a> = <a class="code" href="group__board.html#ga10">board_get_mobility</a>(board, o);01594 <span class="preprocessor">#endif</span>01595 <span class="preprocessor"></span> <a class="code" href="group__mac.html#ga37">BOARD_RESTORE_SQUARE</a>(board, &(iter-><a class="code" href="structMoveList.html#o0">move</a>));01596 <a class="code" href="group__mac.html#ga47">BOARD_LAST_RESTORE_EMPTIES</a>(board, empties, *iter-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o0">position</a>);01597 }01598 <span class="keywordflow">for</span> (iter = movelist; iter-><a class="code" href="structMoveList.html#o1">next</a> != NULL; iter = iter-><a class="code" href="structMoveList.html#o1">next</a>) {01599 previous_best = iter;01600 <span class="keywordflow">for</span> (previous = previous_best-><a class="code" href="structMoveList.html#o1">next</a>; previous-><a class="code" href="structMoveList.html#o1">next</a> != NULL;01601 previous = previous-><a class="code" href="structMoveList.html#o1">next</a>) {01602 <span class="keywordflow">if</span> (previous_best-><a class="code" href="structMoveList.html#o1">next</a>-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o2">score</a> > previous-><a class="code" href="structMoveList.html#o1">next</a>-><a class="code" href="structMoveList.html#o0">move</a>.<a class="code" href="structMove.html#o2">score</a>) {01603 previous_best = previous;01604 }01605 }01606 <span class="keywordflow">if</span> (previous_best != iter) {01607 best = previous_best-><a class="code" href="structMoveList.html#o1">next</a>;01608 previous_best-><a class="code" href="structMoveList.html#o1">next</a> = best-><a class="code" href="structMoveList.html#o1">next</a>;01609 best-><a class="code" href="structMoveList.html#o1">next</a> = iter-><a class="code" href="structMoveList.html#o1">next</a>;01610 iter-><a class="code" href="structMoveList.html#o1">next</a> = best;01611 }01612 }01613 }</pre></div> </td> </tr></table><hr size="1"><address style="align: right;"><small>Generated on Mon Apr 12 19:31:52 2004 for Othello Solver by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.5 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -