user13619: I'm using python-chess to analyze a game.
I have my code like this, and I expect 3 boolean outputs.
print("is_castling: " + unicode(board.is_castling(node.move)));
print("is_zeroing: " + unicode(board.is_zeroing(node.move)));
print("is_capture: " + unicode(board.is_capture(node.move)));

But this is what I get.
is_castling: False
is_zeroing: 4194304
is_capture: 4194304

What am I missing here? 

user14778: Making a few tests with this package in the shell, is-zeroing seems to work fine and returns a boolean :

import chess
b=chess.Board()
b.push_san("Nf3")

Move.from_uci('g1f3')

b.push_san("Nc6")

Move.from_uci('b8c6')

b.push_san("Ne5")

Move.from_uci('f3e5')

m=chess.Move(42,36)
flag = b.is_zeroing(m)
print(flag)

True

m=chess.Move(49,41)
flag=b.is_zeroing(m)
print(flag)

True

m=chess.Move(42,32)
flag=b.is_zeroing(m)
print(flag)

False

print("Nc6-a5 is not a capture nor a pawn move : " + str(flag))

Nc6-a5 is not a capture nor a pawn move : False
Did you try with str(board.is_zeroing(node.move)) ?
To print both a string and a boolean in the same print, you need to turn the boolean intro a string.
By the way what version of python do you use? From searching a bit, it seems python 3+ already stores strings in UTF8 and doesn't have the unicode() function. So no idea how the unicode() function works. But if your program gives weird results for the is_zeroing function and if it's the same using str(), then you might have to look into the parameters you are sending to the is_zeroing() method (pseudo_legal move? board not corrupted?).

user13619: The problem was that the moves were tested in the context of the new board (after the move). But the correct way is that they should be tested with the board they were played on.
See the discussion here.
https://github.com/niklasf/python-chess/issues/169

user12951: The code for those routines fairly liberally uses bitwise-and (&) rather than boolean-and (and) for the logical expressions, so I assume integer values rather than booleans are being returned. I would guess that you would see something similar with is_castling if castling is possible; the False value is returned explicitly rather than being the result of an expression evaluation.

13619: <p>I'm using <a href="https://github.com/niklasf/python-chess" rel="nofollow noreferrer">python-chess</a> to analyze a game.</p>

<p>I have my code like this, and I expect 3 boolean outputs.</p>

<pre><code>print("is_castling: " + unicode(board.is_castling(node.move)));
print("is_zeroing: " + unicode(board.is_zeroing(node.move)));
print("is_capture: " + unicode(board.is_capture(node.move)));
</code></pre>

<p>But this is what I get.</p>

<pre><code>is_castling: False
is_zeroing: 4194304
is_capture: 4194304
</code></pre>

<p>What am I missing here? </p>
 14778: <p>Making a few tests with this package in the shell, is-zeroing seems to work fine and returns a boolean :</p>
<blockquote>
<p>import chess</p>
<p>b=chess.Board()</p>
<p>b.push_san(&quot;Nf3&quot;)</p>
</blockquote>
<p>Move.from_uci('g1f3')</p>
<blockquote>
<p>b.push_san(&quot;Nc6&quot;)</p>
</blockquote>
<p>Move.from_uci('b8c6')</p>
<blockquote>
<p>b.push_san(&quot;Ne5&quot;)</p>
</blockquote>
<p>Move.from_uci('f3e5')</p>
<blockquote>
<p>m=chess.Move(42,36)</p>
<p>flag = b.is_zeroing(m)</p>
<p>print(flag)</p>
</blockquote>
<p>True</p>
<blockquote>
<p>m=chess.Move(49,41)</p>
<p>flag=b.is_zeroing(m)</p>
<p>print(flag)</p>
</blockquote>
<p>True</p>
<blockquote>
<p>m=chess.Move(42,32)</p>
<p>flag=b.is_zeroing(m)</p>
<p>print(flag)</p>
</blockquote>
<p>False</p>
<blockquote>
<p>print(&quot;Nc6-a5 is not a capture nor a pawn move : &quot; + str(flag))</p>
</blockquote>
<p>Nc6-a5 is not a capture nor a pawn move : False</p>
<p>Did you try with str(board.is_zeroing(node.move)) ?
To print both a string and a boolean in the same print, you need to turn the boolean intro a string.
By the way what version of python do you use? From searching a bit, it seems python 3+ already stores strings in UTF8 and doesn't have the unicode() function. So no idea how the unicode() function works. But if your program gives weird results for the is_zeroing function and if it's the same using str(), then you might have to look into the parameters you are sending to the is_zeroing() method (pseudo_legal move? board not corrupted?).</p>
 13619: <p>The problem was that the moves were tested in the context of the new board (after the move). But the correct way is that they should be tested with the board they were played on.</p>

<p>See the discussion here.</p>

<p><a href="https://github.com/niklasf/python-chess/issues/169" rel="nofollow noreferrer">https://github.com/niklasf/python-chess/issues/169</a></p>
 12951: <p>The code for those routines fairly liberally uses bitwise-and (&amp;) rather than boolean-and (and) for the logical expressions, so I assume integer values rather than booleans are being returned. I would guess that you would see something similar with is_castling if castling is possible; the False value is returned explicitly rather than being the result of an expression evaluation.</p>
