Remove check indicator from WXF notation
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 28 Oct 2021 17:10:34 +0000 (19:10 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 28 Oct 2021 17:10:34 +0000 (19:10 +0200)
setup.py
src/apiutil.h
src/pyffish.cpp
test.py

index 87df6d5..a6937d1 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -39,7 +39,7 @@ pyffish_module = Extension(
     sources=sources,
     extra_compile_args=args)
 
-setup(name="pyffish", version="0.0.64",
+setup(name="pyffish", version="0.0.65",
       description="Fairy-Stockfish Python wrapper",
       long_description=long_description,
       long_description_content_type="text/markdown",
index 97e3fe0..1934276 100644 (file)
@@ -291,7 +291,7 @@ inline const std::string move_to_san(Position& pos, Move m, Notation n) {
     }
 
     // Check and checkmate
-    if (pos.gives_check(m) && !is_shogi(n))
+    if (pos.gives_check(m) && !is_shogi(n) && n != NOTATION_XIANGQI_WXF)
     {
         StateInfo st;
         pos.do_move(m, st);
index 785a778..ff1ced6 100644 (file)
@@ -54,7 +54,7 @@ void buildPosition(Position& pos, StateListPtr& states, const char *variant, con
 }
 
 extern "C" PyObject* pyffish_version(PyObject* self) {
-    return Py_BuildValue("(iii)", 0, 0, 64);
+    return Py_BuildValue("(iii)", 0, 0, 65);
 }
 
 extern "C" PyObject* pyffish_info(PyObject* self) {
diff --git a/test.py b/test.py
index f11fc79..a260dfe 100644 (file)
--- a/test.py
+++ b/test.py
@@ -526,6 +526,17 @@ class TestPyffish(unittest.TestCase):
         result = sf.get_san("xiangqi", XIANGQI, "h3h5")
         self.assertEqual(result, "Ch5")
 
+        # WXF notation does not denote check or checkmate
+        fen = "4k4/4a3R/9/9/9/9/9/9/4K4/9 w - - 0 1"
+        result = sf.get_san("xiangqi", fen, "i9e9", False)
+        self.assertEqual(result, "Rxe9+")
+        result = sf.get_san("xiangqi", fen, "i9e9", False, sf.NOTATION_XIANGQI_WXF)
+        self.assertEqual(result, "R1=5")
+        result = sf.get_san("xiangqi", fen, "i9i10", False)
+        self.assertEqual(result, "Ri10#")
+        result = sf.get_san("xiangqi", fen, "i9i10", False, sf.NOTATION_XIANGQI_WXF)
+        self.assertEqual(result, "R1+1")
+
         # skip disambiguation for elephants and advisors, but not for pieces that require it
         fen = "rnbakabnr/9/1c5c1/p1p1p1p1p/9/1NB6/P1P1P1P1P/1C1A3C1/9/RNBAK21R w - - 0 1"
         result = sf.get_san("xiangqi", fen, "c5e3", False, sf.NOTATION_XIANGQI_WXF)