Skip to content

Commit

Permalink
- USE_SFEN_PACKERのシンボルが定義されていない時にPackedSfenをclass定義しないように。
Browse files Browse the repository at this point in the history
  • Loading branch information
yaneurao committed Jan 10, 2024
1 parent ae815e4 commit 61cbde3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,7 @@ void Position::UnitTest(Test::UnitTester& tester)
tester.test("pos_is_ok()",pos.pos_is_ok());
}

#if defined(USE_SFEN_PACKER)
{
// packed sfenのテスト
auto section = tester.section("PackedSfen");
Expand Down Expand Up @@ -3114,6 +3115,7 @@ void Position::UnitTest(Test::UnitTester& tester)
}
tester.test("handicapped sfen",success);
}
#endif

{
// それ以外のテスト
Expand Down Expand Up @@ -3166,6 +3168,7 @@ void Position::UnitTest(Test::UnitTester& tester)
// packed sfenのtest
auto extra_test1 = [&](Position& pos)
{
#if defined(USE_SFEN_PACKER)
PackedSfen ps;
StateInfo si;
string sfen = pos.sfen();
Expand All @@ -3177,11 +3180,15 @@ void Position::UnitTest(Test::UnitTester& tester)
string sfen2 = pos2.sfen(game_ply);

return sfen == sfen2;
#else
return true;
#endif
};

// 駒落ちのpacked sfenのテスト
auto extra_test2 = [&](Position& pos)
{
#if defined(USE_SFEN_PACKER)
PackedSfen ps;
StateInfo si;
string sfen = pos.sfen();
Expand Down Expand Up @@ -3211,6 +3218,9 @@ void Position::UnitTest(Test::UnitTester& tester)
string sfen3 = pos3.sfen(game_ply);

return sfen2 == sfen3;
#else
return true;
#endif
};

{
Expand Down
3 changes: 3 additions & 0 deletions source/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ using StateListPtr = std::unique_ptr<StateList>;
// 盤面
// --------------------

#if defined(USE_SFEN_PACKER)

// packされたsfen
struct PackedSfen {
u8 data[32];
Expand Down Expand Up @@ -230,6 +232,7 @@ struct PackedSfenHash {
return s;
}
};
#endif

// 盤面
class Position
Expand Down

0 comments on commit 61cbde3

Please sign in to comment.