📄 group__move.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Othello Solver: Move module</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.5 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>Move module</h1><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__move.html#ga0">move_print</a> (int x, int player, FILE *f)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Print out a move. <a href="#ga0"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__move.html#ga1">line_print</a> (<a class="el" href="structBoard.html">Board</a> *board, <a class="el" href="structHashTable.html">HashTable</a> *hash_table, int depth, FILE *f)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Print a PV. <a href="#ga1"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__move.html#ga2">movelist_sort_bestmove</a> (<a class="el" href="structMoveList.html">MoveList</a> *movelist, int move)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Sort a move as best. <a href="#ga2"></a><br><br></td></tr><tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__move.html#ga3">movelist_sort_fastfirst</a> (<a class="el" href="structMoveList.html">MoveList</a> *movelist, <a class="el" href="structBoard.html">Board</a> *board)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Sort a list of move, fastest-first. <a href="#ga3"></a><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Functions to print a move or a list of moves and to sort list of moves. <hr><h2>Function Documentation</h2><a class="anchor" name="ga1" doxytag="solver.c::line_print" ></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 line_print </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="structBoard.html">Board</a> * </td> <td class="mdname" nowrap> <em>board</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap><a class="el" href="structHashTable.html">HashTable</a> * </td> <td class="mdname" nowrap> <em>hash_table</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>depth</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>FILE * </td> <td class="mdname" nowrap> <em>f</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>Print a PV. <p>Get the Principal Variation (best move sequence) from the hash table, and print it to the output stream. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>board</em> </td><td>starting position. </td></tr> <tr><td valign=top><em>hash_table</em> </td><td>hash table where to retrieve the moves. </td></tr> <tr><td valign=top><em>depth</em> </td><td>maximum number of moves to print. </td></tr> <tr><td valign=top><em>f</em> </td><td>output stream. </td></tr> </table></dl><p><div class="fragment"><pre>01516 {01517 <span class="keyword">const</span> <span class="keywordtype">char</span> p = board-><a class="code" href="structBoard.html#o1">player</a>;01518 <span class="keyword">const</span> <span class="keywordtype">char</span> o = <a class="code" href="group__mac.html#ga50">OPPONENT</a>(p);01519 <a class="code" href="structHash.html">Hash</a> *hash = <a class="code" href="group__hash.html#ga5">hash_get</a>(hash_table, board);01520 <a class="code" href="structMove.html">Move</a> move[1];01521 01522 <span class="keywordflow">if</span> (depth <= 0) <span class="keywordflow">return</span>;01523 <span class="keywordflow">if</span> (hash != NULL) {01524 <a class="code" href="group__move.html#ga0">move_print</a>(hash-><a class="code" href="structHash.html#o3">move</a>, board-><a class="code" href="structBoard.html#o1">player</a>, f);01525 fputc(<span class="charliteral">' '</span>,f);01526 <span class="keywordflow">if</span> (<a class="code" href="group__board.html#ga4">board_get_move</a>(board, hash-><a class="code" href="structHash.html#o3">move</a>, move)) {01527 <a class="code" href="group__mac.html#ga36">BOARD_UPDATE_SQUARE</a>(board, move);01528 <a class="code" href="group__mac.html#ga38">BOARD_UPDATE_PLAYER</a>(board);01529 <a class="code" href="group__mac.html#ga48">BOARD_UPDATE_HASH_CODE</a>(board, move-><a class="code" href="structMove.html#o3">hash_code</a>);01530 <a class="code" href="group__move.html#ga1">line_print</a>(board, hash_table, depth - 1, f);01531 <a class="code" href="group__mac.html#ga37">BOARD_RESTORE_SQUARE</a>(board, move);01532 <a class="code" href="group__mac.html#ga39">BOARD_RESTORE_PLAYER</a>(board);01533 <a class="code" href="group__mac.html#ga49">BOARD_RESTORE_HASH_CODE</a>(board, move-><a class="code" href="structMove.html#o3">hash_code</a>);01534 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (hash-><a class="code" href="structHash.html#o3">move</a> == <a class="code" href="group__mac.html#gga56a57">PASS</a>) {01535 <a class="code" href="group__mac.html#ga38">BOARD_UPDATE_PLAYER</a>(board);01536 <a class="code" href="group__mac.html#ga48">BOARD_UPDATE_HASH_CODE</a>(board, hash_code_swap_player);01537 <a class="code" href="group__move.html#ga1">line_print</a>(board, hash_table, depth - 1, f);01538 <a class="code" href="group__mac.html#ga39">BOARD_RESTORE_PLAYER</a>(board);01539 <a class="code" href="group__mac.html#ga49">BOARD_RESTORE_HASH_CODE</a>(board, hash_code_swap_player);01540 } <span class="keywordflow">else</span> {01541 <a class="code" href="group__move.html#ga1">line_print</a>(board, hash_table, depth - 1, f);01542 }01543 } <span class="keywordflow">else</span> {01544 fputs(<span class="stringliteral">"-- "</span>, f);01545 <a class="code" href="group__move.html#ga1">line_print</a>(board, hash_table, depth - 1, f);01546 }01547 }</pre></div> </td> </tr></table><a class="anchor" name="ga0" doxytag="solver.c::move_print" ></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 move_print </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname" nowrap> <em>x</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>player</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>FILE * </td> <td class="mdname" nowrap> <em>f</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>Print out a move. <p>Print the move, using letter case to distinguish player's color, to an output stream. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>x</em> </td><td>square coordinate to print. </td></tr> <tr><td valign=top><em>player</em> </td><td>player color. </td></tr> <tr><td valign=top><em>f</em> </td><td>output stream. </td></tr> </table></dl><p><div class="fragment"><pre>01480 {01481 <span class="keywordtype">int</span> s[2];01482
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -