<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gehts auch einfacher (für Logiker) ?]]></title><description><![CDATA[<p>Ich habe folgende Konstruktion:</p>
<pre><code class="language-cpp">if (
(bb_rank_attack(square, blockers) &amp; bb_set[white_king_square]) 
&amp;&amp;       
(bb_rank_attack(square, blockers) &amp; (black_rook_bb | black_queen_bb))) return 1;
</code></pre>
<p><code>bb_rank_attack</code> ist eine etwas zeitintensivere Function und muss in meiner Konstruktion 2x aufgerufen werden. <strong>Allerdings</strong> möchte ich den Ergebniswert von <code>bb_rank_attack</code> <strong>nicht</strong> in einer temporären Variable zwischenspeichern.</p>
<p>Lässt sich der logische Ausdruck irgendwie anders zusammensetzen?</p>
<p>Vielen Dank schonmal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/252980/gehts-auch-einfacher-für-logiker</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 04:10:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/252980.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 27 Oct 2009 10:21:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 10:21:04 GMT]]></title><description><![CDATA[<p>Ich habe folgende Konstruktion:</p>
<pre><code class="language-cpp">if (
(bb_rank_attack(square, blockers) &amp; bb_set[white_king_square]) 
&amp;&amp;       
(bb_rank_attack(square, blockers) &amp; (black_rook_bb | black_queen_bb))) return 1;
</code></pre>
<p><code>bb_rank_attack</code> ist eine etwas zeitintensivere Function und muss in meiner Konstruktion 2x aufgerufen werden. <strong>Allerdings</strong> möchte ich den Ergebniswert von <code>bb_rank_attack</code> <strong>nicht</strong> in einer temporären Variable zwischenspeichern.</p>
<p>Lässt sich der logische Ausdruck irgendwie anders zusammensetzen?</p>
<p>Vielen Dank schonmal <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798974</guid><dc:creator><![CDATA[Tomahawk]]></dc:creator><pubDate>Tue, 27 Oct 2009 10:21:04 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 11:48:48 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">if (bb_rank_attack(square, blockers) 
    &amp; bb_set[white_king_square] 
    &amp; (black_rook_bb | black_queen_bb)) return 1;
</code></pre>
<p>?</p>
<p>Edit: Jo, das ist wohl undurchdachter Käse <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798977</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 27 Oct 2009 11:48:48 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 10:37:37 GMT]]></title><description><![CDATA[<p>Ich hätte jetzt</p>
<pre><code class="language-cpp">if (
(bb_rank_attack(square, blockers) &amp; 
       ( bb_set[white_king_square] | black_rook_bb | black_queen_bb ) )
            return 1;
</code></pre>
<p>gesagt, weil in bb_set[white_king_square] kann ja was gesetzt sein, was in (black_rook_bb | black_queen_bb) nicht gesetzt ist.</p>
<p>bsp:</p>
<p>bb_rank_attack(square, blockers) = 110 = A<br />
bb_set[white_king_square] = 100 = B<br />
(black_rook_bb | black_queen_bb) = 010 = C</p>
<p>A&amp;B = 100<br />
A&amp;C = 010<br />
=&gt; A&amp;B&amp;C = 000 -&gt; falsch</p>
<p>B|C = 110<br />
A&amp;(B|C) = 110 -&gt; wahr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798985</guid><dc:creator><![CDATA[dekcarki]]></dc:creator><pubDate>Tue, 27 Oct 2009 10:37:37 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 10:40:55 GMT]]></title><description><![CDATA[<p>Nein, das geht nicht.</p>
<p><strong>Beispiel aus dem Schach:</strong></p>
<p><code>bb_rank_attack</code> sei:</p>
<p>`</p>
<hr />
<hr />
<p>xx-xxxx-</p>
<hr />
<hr />
<hr />
<hr />
<hr />
<p>`</p>
<p><code>bb_set[white_king_square]</code> sei:</p>
<p>`</p>
<hr />
<hr />
<p>------x-</p>
<hr />
<hr />
<hr />
<hr />
<hr />
<p>`</p>
<p><code>(black_rook_bb | black_queen_bb)</code> sei:</p>
<p>`</p>
<hr />
<hr />
<p>x-------</p>
<hr />
<hr />
<hr />
<hr />
<hr />
<p>`</p>
<p>Also wäre Deine Formulierung <strong>nicht wahr</strong>, obwohl sie <strong>wahr</strong> ist (siehe oben).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798990</guid><dc:creator><![CDATA[Tomahawk]]></dc:creator><pubDate>Tue, 27 Oct 2009 10:40:55 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 10:48:14 GMT]]></title><description><![CDATA[<blockquote>
<p>Lässt sich der logische Ausdruck irgendwie anders zusammensetzen?</p>
</blockquote>
<p>Es ist kein logischer Ausdruck, da du Bitoperationen hast.</p>
<blockquote>
<p>Allerdings möchte ich den Ergebniswert von bb_rank_attack nicht in einer temporären Variable zwischenspeichern.</p>
</blockquote>
<p>Warum auch immer. Die 4 Byte auf dem Stack tun schon weh. Aber im Allgemeinen muss man Ergebnisse zwischenspeichern, wenn man sie wiederverwenden will ohne Neuberechnung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798997</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Tue, 27 Oct 2009 10:48:14 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 10:48:31 GMT]]></title><description><![CDATA[<p>dekcarki schrieb:</p>
<blockquote>
<p>Ich hätte jetzt</p>
<pre><code class="language-cpp">if (
(bb_rank_attack(square, blockers) &amp; 
       ( bb_set[white_king_square] | black_rook_bb | black_queen_bb ) )
            return 1;
</code></pre>
<p>gesagt, weil in bb_set[white_king_square] kann ja was gesetzt sein, was in (black_rook_bb | black_queen_bb) nicht gesetzt ist.</p>
<p>bsp:</p>
<p>bb_rank_attack(square, blockers) = 110 = A<br />
bb_set[white_king_square] = 100 = B<br />
(black_rook_bb | black_queen_bb) = 010 = C</p>
<p>A&amp;B = 100<br />
A&amp;C = 010<br />
=&gt; A&amp;B&amp;C = 000 -&gt; falsch</p>
<p>B|C = 110<br />
A&amp;(B|C) = 110 -&gt; wahr</p>
</blockquote>
<p><strong>Ist auch nicht dasselbe!</strong></p>
<p>bsp:</p>
<p>bb_rank_attack(square, blockers) = 110 = A<br />
bb_set[white_king_square] = 100 = B<br />
(black_rook_bb | black_queen_bb) = 000 = C</p>
<p>A&amp;B = 100<br />
A&amp;C = 000<br />
=&gt; A&amp;B&amp;C = 000 -&gt; falsch</p>
<p>B|C = 100<br />
A&amp;(B|C) = 100 -&gt; wahr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1798998</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1798998</guid><dc:creator><![CDATA[Tomahawk]]></dc:creator><pubDate>Tue, 27 Oct 2009 10:48:31 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 11:37:21 GMT]]></title><description><![CDATA[<p>So, Edit die 3.</p>
<p>A = bb_rank_attack(square, blockers)<br />
B = bb_set[white_king_square]<br />
C = (black_rook_bb | black_queen_bb)</p>
<p>if( ( A^(B|C) ) &amp; (B|C) == 0 ) return 1;</p>
<p>A = 1100<br />
B = 1000<br />
C = 0100</p>
<p>(B|C) = 1100<br />
A^(B|C) = 0000<br />
(A^(B|C))&amp;(B|C) = 0000 passt.</p>
<p>A = 1100<br />
B = 1000<br />
C = 0010</p>
<p>(B|C) = 1010<br />
A^(B|C) = 0110<br />
(A^(B|C))&amp;(B|C) = 0010 &lt;-- ist ungleich 0, also passt das auch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1799007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1799007</guid><dc:creator><![CDATA[dekcarki]]></dc:creator><pubDate>Tue, 27 Oct 2009 11:37:21 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 11:43:25 GMT]]></title><description><![CDATA[<p>Tomahawk schrieb:</p>
<blockquote>
<p><code>bb_rank_attack</code> ist eine etwas zeitintensivere Function und muss in meiner Konstruktion 2x aufgerufen werden. <strong>Allerdings</strong> möchte ich den Ergebniswert von <code>bb_rank_attack</code> <strong>nicht</strong> in einer temporären Variable zwischenspeichern.</p>
</blockquote>
<p>Wieso nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1799033</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1799033</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 27 Oct 2009 11:43:25 GMT</pubDate></item><item><title><![CDATA[Reply to Gehts auch einfacher (für Logiker) ? on Tue, 27 Oct 2009 12:32:27 GMT]]></title><description><![CDATA[<p>dekcarki schrieb:</p>
<blockquote>
<p>if( ( A^(B|C) ) &amp; (B|C) == 0 ) return 1;</p>
</blockquote>
<p>Das ist doch jetzt bloß noch Rumprobieren.</p>
<p>Gegenbeispiel:<br />
A = 0001010<br />
B = 1101100<br />
C = 0110110</p>
<p>B|C = 1111110<br />
A^(B|C) = 1110100<br />
A^(B|C) &amp; (B|C) = 1110100 != 0</p>
<p>Aber:<br />
A &amp; B = 0001000<br />
A &amp; C = 0000010<br />
Also: (A&amp;B) &amp;&amp; (A&amp;C) == true</p>
<p>Mein Tipp: Es geht nicht, man braucht insgesamt zwei Vergleiche auf 0.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1799074</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1799074</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 27 Oct 2009 12:32:27 GMT</pubDate></item></channel></rss>