⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 group__board.html

📁 黑白棋终局解算程序
💻 HTML
📖 第 1 页 / 共 5 页
字号:
01148         *move-&gt;<a class="code" href="structMove.html#o0">position</a> = x;01149         *square = p;01150         <a class="code" href="group__mac.html#ga38">BOARD_UPDATE_PLAYER</a>(board);01151         <a class="code" href="group__mac.html#ga26">BOARD_UPDATE_INTERNAL_NODES</a>();01152     }01153     <span class="keywordflow">return</span> move-&gt;<a class="code" href="structMove.html#o1">n</a>;01154 }</pre></div>    </td>  </tr></table><a class="anchor" name="ga11" doxytag="solver.c::board_get_corner_stability" ></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"> int board_get_corner_stability </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="structBoard.html">Board</a> *&nbsp;</td>          <td class="mdname" nowrap> <em>board</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap> <em>player</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Estimate corner stability. <p>Count the number of stable discs around the corner. Limiting the count to the corner keep the function fast but still get this information, particularly important at Othello. Corner stability will be used for move sorting. <dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign=top><em>board</em>&nbsp;</td><td>: the board. </td></tr>    <tr><td valign=top><em>player</em>&nbsp;</td><td>: the player. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>: the number of stable discs around the corner. </dd></dl><p><div class="fragment"><pre>01370 {01371     <span class="keyword">const</span> <span class="keywordtype">char</span> *square = board-&gt;<a class="code" href="structBoard.html#o0">square</a>;01372     <span class="keyword">const</span> <span class="keywordtype">char</span> p = player;01373     <span class="keywordtype">int</span> n_stables = 0;01374 01375     <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a58">A1</a>] == p) {01376         n_stables++;01377         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a59">B1</a>] == p) n_stables++;01378         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a66">A2</a>] == p) n_stables++;01379     }01380     <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a114">A8</a>] == p) {01381         n_stables++;01382         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a115">B8</a>] == p) n_stables++;01383         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a106">A7</a>] == p) n_stables++;01384     }01385     <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a65">H1</a>] == p) {01386         n_stables++;01387         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a64">G1</a>] == p) n_stables++;01388         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a73">H2</a>] == p) n_stables++;01389     }01390     <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a121">H8</a>] == p) {01391         n_stables++;01392         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a120">G8</a>] == p) n_stables++;01393         <span class="keywordflow">if</span> (square[<a class="code" href="group__mac.html#gga56a113">H7</a>] == p) n_stables++;01394     }01395 01396     <span class="keywordflow">return</span> n_stables;01397 }</pre></div>    </td>  </tr></table><a class="anchor" name="ga10" doxytag="solver.c::board_get_mobility" ></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"> int board_get_mobility </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="structBoard.html">Board</a> *&nbsp;</td>          <td class="mdname" nowrap> <em>board</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap> <em>player</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Estimate the mobility. <p>Count a number of legal moves for a player. The mobility is an important concept in Othello, used here for move sorting. <dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign=top><em>board</em>&nbsp;</td><td>: the board to test. </td></tr>    <tr><td valign=top><em>player</em>&nbsp;</td><td>: the player to test. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>: the number of legal moves. </dd></dl><p><div class="fragment"><pre>01346 {01347     <a class="code" href="structSquareList.html">SquareList</a> *empties;01348     <span class="keywordtype">int</span> n_moves = 0;01349 01350     <span class="keywordflow">for</span> (empties = board-&gt;<a class="code" href="structBoard.html#o7">empties</a>-&gt;<a class="code" href="structSquareList.html#o2">next</a>; empties-&gt;<a class="code" href="structSquareList.html#o0">position</a> != <a class="code" href="group__mac.html#gga56a56">NOMOVE</a>; empties = empties-&gt;<a class="code" href="structSquareList.html#o2">next</a>) {01351         <span class="keywordflow">if</span> (<a class="code" href="group__board.html#ga1">board_check_move</a>(board, empties-&gt;<a class="code" href="structSquareList.html#o0">position</a>, player))01352             n_moves++;01353     }01354 01355     <span class="keywordflow">return</span> n_moves;01356 }</pre></div>    </td>  </tr></table><a class="anchor" name="ga4" doxytag="solver.c::board_get_move" ></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"> int board_get_move </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="structBoard.html">Board</a> *&nbsp;</td>          <td class="mdname" nowrap> <em>board</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap> <em>x</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="structMove.html">Move</a> *&nbsp;</td>          <td class="mdname" nowrap> <em>move</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Compute a move. <p>Compute how the board will be modified by a move without playing it. <dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign=top><em>board</em>&nbsp;</td><td>board </td></tr>    <tr><td valign=top><em>x</em>&nbsp;</td><td>square on which to move. </td></tr>    <tr><td valign=top><em>move</em>&nbsp;</td><td>a <a class="el" href="structMove.html">Move</a> structure remembering the modification. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>the number of disc(s) flipped. </dd></dl><p><div class="fragment"><pre>01166 {01167     <span class="keyword">const</span> <span class="keywordtype">char</span> p = board-&gt;<a class="code" href="structBoard.html#o1">player</a>;01168     <span class="keyword">const</span> <span class="keywordtype">char</span> o = <a class="code" href="group__mac.html#ga50">OPPONENT</a>(p);01169     <span class="keyword">const</span> <span class="keywordtype">char</span> *square = board-&gt;<a class="code" href="structBoard.html#o0">square</a> + x;01170 01171     move-&gt;<a class="code" href="structMove.html#o1">n</a> = 0;01172     move-&gt;<a class="code" href="structMove.html#o3">hash_code</a>[0] = hash_code_set_disc[x][(<span class="keywordtype">int</span>)p][0];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -