Nicolas Winkler 8 年之前
父节点
当前提交
7e5e15b984
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 3 3
      src/BitBoard.h
  2. 1 1
      src/MoveGeneration.h

+ 3 - 3
src/BitBoard.h

@@ -25,19 +25,19 @@ union chessy::Index
     Index(void) = default;
     inline Index(int8_t ind) : index{ ind } {}
     inline Index(const std::string& name) :
-        Index{name[0] - '1', name[1] - 'a'} {}
+        Index{ '8' - name[0], name[1] - 'a' } {}
     inline Index(int row, int column) :
         index{int8_t(((row & 0x7) << 3) + (column & 0x7))} {}
 
 
-    inline operator int8_t   (void) const   { return index; }
+    inline operator int8_t  (void) const    { return index; }
 
     inline int getColumn    (void) const    { return index & 0x7; }
     inline int getRow       (void) const    { return (index >> 3) & 0x7; }
 
     inline std::string getName(void) const
     {
-        return { char('a' + getColumn()), char('1' + getRow()) };
+        return { char('a' + getColumn()), char('8' - getRow()) };
     }
 };
 

+ 1 - 1
src/MoveGeneration.h

@@ -85,7 +85,7 @@ class chessy::MoveGenerator
         inline Move operator *(void) const
         {
             Index pp = *pawnPushes;
-            return Move{ int8_t(pp + side == 0 ? 8 : -8), pp };
+            return Move{ pp, int8_t(pp + (side == 0 ? 8 : -8)) };
         }
 
         inline void operator ++(void)