Apricot-S / xiangting

A library for calculation of deficiency number (a.k.a. xiangting number, 向聴数).
MIT License
1 stars 0 forks source link

他のシャンテン数計算ライブラリでの検証 / Verification with other deficiency number calculation libraries #7

Open Apricot-S opened 2 months ago

Apricot-S commented 2 months ago

概要

計算結果が正しいことを検証するため、他のライブラリと比較する 各手牌枚数での組み合わせ総数は https://gist.github.com/Apricot-S/f59903a44909206ad9e79390665f7253 を参照のこと

四人麻雀・副露牌を計算に含めない場合

既存ライブラリ: Nyanten (https://github.com/Cryolite/nyanten)

検証コード: 作成済み

検証状況

三人麻雀・副露牌を計算に含めない場合

既存ライブラリ: Shanten Number (https://github.com/tomohxx/shanten-number)

検証コード: 未作成

検証状況

副露牌を計算に含める場合 (四人麻雀・三人麻雀とも)

既存ライブラリ: 正確さが検証済み または 理論的に保証されているものが未発見

検証コード: 未作成

検証状況

Apricot-S commented 2 months ago

四人麻雀・副露牌を計算に含めない場合 1, 2, 4, 5, 7, 8 枚の検証結果

commit: 7b66098d13d227dd3c6479ec7647d110ea067955

vscode ➜ /workspaces/xiangting (main) $ makers test_verify_correctness
[cargo-make] INFO - makers 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Project: xiangting
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test_verify_correctness
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cargo" "test" "verify_correctness_0" "--release" "--features" "correctness" "--" "--ignored"
   Compiling xiangting v0.1.0 (/workspaces/xiangting)
warning: xiangting@0.1.0: In file included from /workspaces/nyanten/nyanten/replacement_number.hpp:10,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/include/cxx_nyanten.hpp:6,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:1:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp: In instantiation of ‘uint_fast8_t Nyanten::Standard_::calculateReplacementNumber(ForwardIterator, ForwardIterator, uint_fast8_t) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/replacement_number.hpp:46:78:   required from ‘uint_fast8_t Nyanten::calculateReplacementNumber(ForwardIterator, ForwardIterator) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’
warning: xiangting@0.1.0: /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:7:110:   required from here
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp:66:42: warning: unused parameter ‘last’ [-Wunused-parameter]
warning: xiangting@0.1.0:    66 |   ForwardIterator first, ForwardIterator last, std::uint_fast8_t const n)
warning: xiangting@0.1.0:       |                          ~~~~~~~~~~~~~~~~^~~~
    Finished `release` profile [optimized] target(s) in 8.82s
     Running unittests src/lib.rs (target/release/deps/xiangting-39300c774503dea4)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 119 filtered out; finished in 0.00s

     Running tests/correctness.rs (target/release/deps/correctness-5dd416d06c82eabe)

running 6 tests
test tests::verify_correctness_01 ... ok
test tests::verify_correctness_02 ... ok
test tests::verify_correctness_04 ... ok
test tests::verify_correctness_05 ... ok
test tests::verify_correctness_07 ... ok
test tests::verify_correctness_08 has been running for over 60 seconds
test tests::verify_correctness_08 ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 109.79s

     Running tests/nyanten.rs (target/release/deps/nyanten-c69f4217025dad28)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

[cargo-make] INFO - Build Done in 119.82 seconds.
Apricot-S commented 2 months ago

四人麻雀・副露牌を計算に含めない場合 1, 2, 4, 5, 7, 8 枚の検証結果

commit: 70addd967de5402895cd196ea098ac3b54ee3935

vscode ➜ /workspaces/xiangting (main) $ makers test_verify_correctness
[cargo-make] INFO - makers 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Project: xiangting
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test_verify_correctness
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cargo" "test" "verify_correctness_0" "--release" "--features" "correctness" "--" "--ignored"
   Compiling xiangting v0.1.0 (/workspaces/xiangting)
warning: xiangting@0.1.0: In file included from /workspaces/nyanten/nyanten/replacement_number.hpp:10,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/include/cxx_nyanten.hpp:6,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:1:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp: In instantiation of ‘uint_fast8_t Nyanten::Standard_::calculateReplacementNumber(ForwardIterator, ForwardIterator, uint_fast8_t) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/replacement_number.hpp:46:78:   required from ‘uint_fast8_t Nyanten::calculateReplacementNumber(ForwardIterator, ForwardIterator) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’
warning: xiangting@0.1.0: /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:7:110:   required from here
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp:66:42: warning: unused parameter ‘last’ [-Wunused-parameter]
warning: xiangting@0.1.0:    66 |   ForwardIterator first, ForwardIterator last, std::uint_fast8_t const n)
warning: xiangting@0.1.0:       |                          ~~~~~~~~~~~~~~~~^~~~
    Finished `release` profile [optimized] target(s) in 9.72s
     Running unittests src/lib.rs (target/release/deps/xiangting-39300c774503dea4)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 119 filtered out; finished in 0.00s

     Running tests/correctness.rs (target/release/deps/correctness-5dd416d06c82eabe)

running 6 tests
test tests::verify_correctness_01 ... ok
test tests::verify_correctness_02 ... ok
test tests::verify_correctness_04 ... ok
test tests::verify_correctness_05 ... ok
test tests::verify_correctness_07 ... ok
test tests::verify_correctness_08 has been running for over 60 seconds
test tests::verify_correctness_08 ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 107.01s

     Running tests/nyanten.rs (target/release/deps/nyanten-c69f4217025dad28)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

[cargo-make] INFO - Build Done in 117.96 seconds.
Apricot-S commented 2 months ago

四人麻雀・副露牌を計算に含めない場合 10 枚の検証結果

commit: 0c3395b256a1605f658bfec555434a5f0735862d

vscode ➜ /workspaces/xiangting (main) $ makers test_verify_correctness
[cargo-make] INFO - makers 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Project: xiangting
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test_verify_correctness
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cargo" "test" "verify_correctness_10" "--release" "--features" "correctness" "--" "--ignored"
   Compiling xiangting v0.1.0 (/workspaces/xiangting)
warning: xiangting@0.1.0: In file included from /workspaces/nyanten/nyanten/replacement_number.hpp:10,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/include/cxx_nyanten.hpp:10,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:1:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp: In instantiation of ‘uint_fast8_t Nyanten::Standard_::calculateReplacementNumber(ForwardIterator, ForwardIterator, uint_fast8_t) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/replacement_number.hpp:46:78:   required from ‘uint_fast8_t Nyanten::calculateReplacementNumber(ForwardIterator, ForwardIterator) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’
warning: xiangting@0.1.0: /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:7:110:   required from here
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp:66:42: warning: unused parameter ‘last’ [-Wunused-parameter]
warning: xiangting@0.1.0:    66 |   ForwardIterator first, ForwardIterator last, std::uint_fast8_t const n)
warning: xiangting@0.1.0:       |                          ~~~~~~~~~~~~~~~~^~~~
    Finished `release` profile [optimized] target(s) in 11.01s
     Running unittests src/lib.rs (target/release/deps/xiangting-39300c774503dea4)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 121 filtered out; finished in 0.00s

     Running tests/correctness.rs (target/release/deps/correctness-5dd416d06c82eabe)

running 1 test
test tests::verify_correctness_10 has been running for over 60 seconds
test tests::verify_correctness_10 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 9 filtered out; finished in 4023.91s

     Running tests/nyanten.rs (target/release/deps/nyanten-c69f4217025dad28)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

[cargo-make] INFO - Build Done in 4035.80 seconds.
Apricot-S commented 2 months ago

四人麻雀・副露牌を計算に含めない場合 11 枚の検証結果

commit: 0c3395b256a1605f658bfec555434a5f0735862d

vscode ➜ /workspaces/xiangting (main) $ makers test_verify_correctness
[cargo-make] INFO - makers 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Project: xiangting
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: test_verify_correctness
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Execute Command: "cargo" "test" "verify_correctness_11" "--release" "--features" "correctness" "--" "--ignored"
   Compiling xiangting v0.1.0 (/workspaces/xiangting)
warning: xiangting@0.1.0: In file included from /workspaces/nyanten/nyanten/replacement_number.hpp:10,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/include/cxx_nyanten.hpp:10,
warning: xiangting@0.1.0:                  from /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:1:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp: In instantiation of ‘uint_fast8_t Nyanten::Standard_::calculateReplacementNumber(ForwardIterator, ForwardIterator, uint_fast8_t) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’:
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/replacement_number.hpp:46:78:   required from ‘uint_fast8_t Nyanten::calculateReplacementNumber(ForwardIterator, ForwardIterator) [with ForwardIterator = const unsigned char*; uint_fast8_t = unsigned char]’
warning: xiangting@0.1.0: /workspaces/xiangting/target/release/build/xiangting-204925bd639d87ae/out/cxxbridge/sources/xiangting/tests/nyanten.rs.cc:7:110:   required from here
warning: xiangting@0.1.0: /workspaces/nyanten/nyanten/standard/replacement_number.hpp:66:42: warning: unused parameter ‘last’ [-Wunused-parameter]
warning: xiangting@0.1.0:    66 |   ForwardIterator first, ForwardIterator last, std::uint_fast8_t const n)
warning: xiangting@0.1.0:       |                          ~~~~~~~~~~~~~~~~^~~~
    Finished `release` profile [optimized] target(s) in 8.89s
     Running unittests src/lib.rs (target/release/deps/xiangting-39300c774503dea4)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 121 filtered out; finished in 0.00s

     Running tests/correctness.rs (target/release/deps/correctness-5dd416d06c82eabe)

running 1 test
test tests::verify_correctness_11 has been running for over 60 seconds
test tests::verify_correctness_11 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 9 filtered out; finished in 19420.90s

     Running tests/nyanten.rs (target/release/deps/nyanten-c69f4217025dad28)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

[cargo-make] INFO - Build Done in 19430.10 seconds.
Apricot-S commented 2 weeks ago

v2.0.0 でアルゴリズムを変更したので再度検証する。