From a5a688230b89220a2bade4fd99eff52496bd6056 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 06:27:19 +0200 Subject: [PATCH 1/8] Prefer American spelling in non-API identifiers and filenames. Rename internal symbols and example/test targets to American forms while leaving legacy Analyse*/analyse_*_pbn public APIs unchanged. Co-authored-by: Cursor --- .github/instructions/cpp.instructions.md | 4 ++++ AGENTS.md | 2 ++ doc/dll-description.html | 2 +- doc/dll-description.md | 2 +- docs/wasm_build.md | 2 +- examples/BUILD.bazel | 20 +++++++++---------- examples/README | 4 ++-- ...lays_bin.cpp => analyze_all_plays_bin.cpp} | 0 ...lays_pbn.cpp => analyze_all_plays_pbn.cpp} | 0 ...lyse_play_bin.cpp => analyze_play_bin.cpp} | 0 ...lyse_play_pbn.cpp => analyze_play_pbn.cpp} | 0 library/src/init.cpp | 2 +- .../{play_analyser.cpp => play_analyzer.cpp} | 6 +++--- .../{play_analyser.hpp => play_analyzer.hpp} | 0 library/src/solver_if.cpp | 4 ++-- library/src/solver_if.hpp | 2 +- library/tests/solve_board/BUILD.bazel | 4 ++-- ...tency.cpp => analyze_play_consistency.cpp} | 4 ++-- python/BUILD.bazel | 6 +++--- .../{test_analyse.py => test_analyze.py} | 14 ++++++------- .../tests/create_list_for_dtest_test.py | 2 +- solution/DDS.vcxproj | 4 ++-- solution/Solution.slnx | 6 +++--- ....vcxproj => analyze_all_plays_bin.vcxproj} | 2 +- ... => analyze_all_plays_bin.vcxproj.filters} | 2 +- ...y_bin.vcxproj => analyze_play_bin.vcxproj} | 2 +- ...lters => analyze_play_bin.vcxproj.filters} | 2 +- ...y_pbn.vcxproj => analyze_play_pbn.vcxproj} | 2 +- ...lters => analyze_play_pbn.vcxproj.filters} | 2 +- solution/dds_native.vcxproj | 4 ++-- solution/dds_native.vcxproj.filters | 4 ++-- specs/examples-cli.md | 4 ++-- specs/wasm-emscripten.md | 2 +- wasm/BUILD.bazel | 4 ++-- 34 files changed, 63 insertions(+), 57 deletions(-) rename examples/{analyse_all_plays_bin.cpp => analyze_all_plays_bin.cpp} (100%) rename examples/{analyse_all_plays_pbn.cpp => analyze_all_plays_pbn.cpp} (100%) rename examples/{analyse_play_bin.cpp => analyze_play_bin.cpp} (100%) rename examples/{analyse_play_pbn.cpp => analyze_play_pbn.cpp} (100%) rename library/src/{play_analyser.cpp => play_analyzer.cpp} (98%) rename library/src/{play_analyser.hpp => play_analyzer.hpp} (100%) rename library/tests/solve_board/{analyse_play_consistency.cpp => analyze_play_consistency.cpp} (98%) rename python/tests/{test_analyse.py => test_analyze.py} (87%) rename solution/{analyse_all_plays_bin.vcxproj => analyze_all_plays_bin.vcxproj} (98%) rename solution/{analyse_all_plays_bin.vcxproj.filters => analyze_all_plays_bin.vcxproj.filters} (96%) rename solution/{analyse_play_bin.vcxproj => analyze_play_bin.vcxproj} (98%) rename solution/{analyse_play_bin.vcxproj.filters => analyze_play_bin.vcxproj.filters} (96%) rename solution/{analyse_play_pbn.vcxproj => analyze_play_pbn.vcxproj} (98%) rename solution/{analyse_play_pbn.vcxproj.filters => analyze_play_pbn.vcxproj.filters} (96%) diff --git a/.github/instructions/cpp.instructions.md b/.github/instructions/cpp.instructions.md index cabb855b7..277ec0e14 100644 --- a/.github/instructions/cpp.instructions.md +++ b/.github/instructions/cpp.instructions.md @@ -56,6 +56,10 @@ This project follows a consistent modern C++ style, inspired by Google/LLVM with ## Naming +Prefer American spelling in identifiers (files, functions, variables). Leave +legacy public-API names that already use British spelling unchanged (for +example `AnalysePlay*`). + ### Types - **PascalCase** - Examples: `FixedArray`, `ErrorCode`, `SimulationRunner` diff --git a/AGENTS.md b/AGENTS.md index 6d70dc4bc..725b436db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,6 +10,8 @@ Follow .github/instructions/cpp.instructions.md Follow .github/instructions/cpp.instructions.md +Prefer American spelling in file, function, and variable names. + Exceptions: - Match existing external or legacy APIs (for example, public C API names and types that already use a different style). - Do not rename unrelated legacy identifiers in the same change unless the task requires it. diff --git a/doc/dll-description.html b/doc/dll-description.html index 346fe9e3a..ed23ea0ac 100644 --- a/doc/dll-description.html +++ b/doc/dll-description.html @@ -770,7 +770,7 @@

Functions

SolveBoardPBN is just like SolveBoard, except for the input format. Historically it was one of the first functions, and it exposes the thread index directly to the user. Later functions generally don't do that, and they also hide the implementation details such as transposition tables, see below.

SolveBoard solves a single deal “dl” and returns the result in “*futp” which must be declared before calling SolveBoard.

If you have multiple hands to solve, it is always better to group them together into a single function call than to use SolveBoard.

-

SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the PlayAnalyse functions, this is the only function that exposes the thread number to the user.

+

SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the AnalysePlay* functions, this is the only function that exposes the thread number to the user.

There is a “transposition table” memory associated with each thread. Each node in the table is effectively a position after certain cards have been played and other certain cards remain. The table is not deleted automatically after each call to SolveBoard, so it can be reused from call to call. However, it only really makes sense to reuse the table when the hand is very similar in the two calls. The function will still run if this is not the case, but it won't be as efficient. The reuse of the transposition table can be controlled by the “mode” parameter, but normally this is not needed and should not be done.

The three parameters “target”, “solutions” and “mode” together control the function. Generally speaking, the target is the number of tricks to be won (at least) by the side to play; solutions controls how many solutions should be returned; and mode controls the search behavior. See next page for definitions.

For equivalent cards, only the highest is returned, and lower equivalent cards are encoded in the futureTricks structure (see “equals”).

diff --git a/doc/dll-description.md b/doc/dll-description.md index a14941b61..f289e386b 100644 --- a/doc/dll-description.md +++ b/doc/dll-description.md @@ -796,7 +796,7 @@ SolveBoard solves a single deal “dl” and returns the re If you have multiple hands to solve, it is always better to group them together into a single function call than to use SolveBoard. -SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the PlayAnalyse functions, this is the only function that exposes the thread number to the user. +SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the AnalysePlay* functions, this is the only function that exposes the thread number to the user. There is a “transposition table” memory associated with each thread. Each node in the table is effectively a position after certain cards have been played and other certain cards remain. The table is not deleted automatically after each call to SolveBoard, so it can be reused from call to call. However, it only really makes sense to reuse the table when the hand is very similar in the two calls. The function will still run if this is not the case, but it won't be as efficient. The reuse of the transposition table can be controlled by the “mode” parameter, but normally this is not needed and should not be done. diff --git a/docs/wasm_build.md b/docs/wasm_build.md index 2dc7c11b3..7fdd6bb86 100644 --- a/docs/wasm_build.md +++ b/docs/wasm_build.md @@ -53,7 +53,7 @@ Outputs are under `bazel-bin/wasm/`: Rules in `wasm/BUILD.bazel` wrap native binaries: - `solve_board_wasm` — solves a single board (`//examples:solve_board`) -- `analyse_play_bin_wasm` — analyze play from binary format +- `analyze_play_bin_wasm` — analyze play from binary format - `calc_dd_table_pbn_wasm` — double-dummy table from PBN - `dtest_wasm` — the `dtest` hand-list harness for Node (`//library/tests:dtest`) diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index 54021bf81..43027e394 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -46,8 +46,8 @@ cc_library( # Example binaries cc_binary( - name = "analyse_all_plays_bin", - srcs = ["analyse_all_plays_bin.cpp"], + name = "analyze_all_plays_bin", + srcs = ["analyze_all_plays_bin.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -59,8 +59,8 @@ cc_binary( ) cc_binary( - name = "analyse_all_plays_pbn", - srcs = ["analyse_all_plays_pbn.cpp"], + name = "analyze_all_plays_pbn", + srcs = ["analyze_all_plays_pbn.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -73,7 +73,7 @@ cc_binary( cc_binary( name = "AnalysePlayBin", - srcs = ["analyse_play_bin.cpp"], + srcs = ["analyze_play_bin.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS + EXAMPLES_LINKOPTS_WASM, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -86,8 +86,8 @@ cc_binary( ) cc_binary( - name = "analyse_play_pbn", - srcs = ["analyse_play_pbn.cpp"], + name = "analyze_play_pbn", + srcs = ["analyze_play_pbn.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -247,10 +247,10 @@ cc_binary( filegroup( name = "all_examples", srcs = [ - ":analyse_all_plays_bin", - ":analyse_all_plays_pbn", + ":analyze_all_plays_bin", + ":analyze_all_plays_pbn", ":AnalysePlayBin", - ":analyse_play_pbn", + ":analyze_play_pbn", ":calc_all_tables", ":calc_all_tables_pbn", ":calc_dd_table", diff --git a/examples/README b/examples/README index 477ef9fa8..6cc021bef 100644 --- a/examples/README +++ b/examples/README @@ -27,8 +27,8 @@ Run an example: ./dotnet/DdTableForDeal/e2e.sh # requires DDS_LIBRARY_PATH; Windows: e2e.ps1 Available examples: -- analyse_all_plays_bin, analyse_all_plays_pbn -- analyse_play_bin, analyse_play_pbn +- analyze_all_plays_bin, analyze_all_plays_pbn +- analyze_play_bin, analyze_play_pbn - calc_all_tables, calc_all_tables_pbn - calc_dd_table, calc_dd_table_pbn - dd_table_for_deal (C++; Python: //python/examples:dd_table_for_deal; .NET: dotnet/DdTableForDeal) diff --git a/examples/analyse_all_plays_bin.cpp b/examples/analyze_all_plays_bin.cpp similarity index 100% rename from examples/analyse_all_plays_bin.cpp rename to examples/analyze_all_plays_bin.cpp diff --git a/examples/analyse_all_plays_pbn.cpp b/examples/analyze_all_plays_pbn.cpp similarity index 100% rename from examples/analyse_all_plays_pbn.cpp rename to examples/analyze_all_plays_pbn.cpp diff --git a/examples/analyse_play_bin.cpp b/examples/analyze_play_bin.cpp similarity index 100% rename from examples/analyse_play_bin.cpp rename to examples/analyze_play_bin.cpp diff --git a/examples/analyse_play_pbn.cpp b/examples/analyze_play_pbn.cpp similarity index 100% rename from examples/analyse_play_pbn.cpp rename to examples/analyze_play_pbn.cpp diff --git a/library/src/init.cpp b/library/src/init.cpp index 73881c026..b4296ea2c 100644 --- a/library/src/init.cpp +++ b/library/src/init.cpp @@ -17,7 +17,7 @@ #include #include "init.hpp" -#include +#include #include #include #include diff --git a/library/src/play_analyser.cpp b/library/src/play_analyzer.cpp similarity index 98% rename from library/src/play_analyser.cpp rename to library/src/play_analyzer.cpp index 8848a2edf..436cbda8d 100644 --- a/library/src/play_analyser.cpp +++ b/library/src/play_analyzer.cpp @@ -7,7 +7,7 @@ See LICENSE and README. */ -#include "play_analyser.hpp" +#include "play_analyzer.hpp" #include #include #include @@ -50,7 +50,7 @@ int STDCALL AnalysePlayBin( { // Create an owned context for this analysis. The same context (and its // transposition table) is reused for the initial solve and every subsequent - // analyse_later_board call, so the hint-bounded incremental searches see a + // analyze_later_board call, so the hint-bounded incremental searches see a // warm TT -- see the analogous calc_dd_table fix (commit 27030ba). SolverContext outer_ctx; @@ -200,7 +200,7 @@ int STDCALL AnalysePlayBin( if (usingCurrent) continue; - if ((ret = analyse_later_board(ctx, dl.first, &move, hint, + if ((ret = analyze_later_board(ctx, dl.first, &move, hint, hintDir, &fut)) != RETURN_NO_FAULT) { diff --git a/library/src/play_analyser.hpp b/library/src/play_analyzer.hpp similarity index 100% rename from library/src/play_analyser.hpp rename to library/src/play_analyzer.hpp diff --git a/library/src/solver_if.cpp b/library/src/solver_if.cpp index f935f004e..b90031986 100644 --- a/library/src/solver_if.cpp +++ b/library/src/solver_if.cpp @@ -819,7 +819,7 @@ auto solve_same_board( } -auto analyse_later_board( +auto analyze_later_board( SolverContext& ctx, const int leadHand, MoveType const * move, @@ -827,7 +827,7 @@ auto analyse_later_board( const int hintDir, FutureTricks * futp) -> int { - // Specialized function for PlayAnalyser for cards after the + // Specialized function for play analyzer for cards after the // opening lead. No further parameter checks! This function // makes heavy reuse of parameters that are already stored in // various places. It corresponds to: diff --git a/library/src/solver_if.hpp b/library/src/solver_if.hpp index e5b6fcb0f..fbbe21c00 100644 --- a/library/src/solver_if.hpp +++ b/library/src/solver_if.hpp @@ -27,7 +27,7 @@ auto solve_same_board( FutureTricks * futp, const int hint) -> int; -auto analyse_later_board( +auto analyze_later_board( SolverContext& ctx, const int leadHand, MoveType const * move, diff --git a/library/tests/solve_board/BUILD.bazel b/library/tests/solve_board/BUILD.bazel index eec3b09b5..def6fe5be 100644 --- a/library/tests/solve_board/BUILD.bazel +++ b/library/tests/solve_board/BUILD.bazel @@ -21,10 +21,10 @@ cc_test( # .bazelrc so MSAN (can exceed 120s on this suite) keeps headroom without # timeout="moderate" (which trips --test_verbose_timeout_warnings on fast runs). cc_test( - name = "analyse_play_consistency_test", + name = "analyze_play_consistency_test", size = "small", srcs = [ - "analyse_play_consistency.cpp", + "analyze_play_consistency.cpp", ], deps = [ "//library/src:testable_dds", diff --git a/library/tests/solve_board/analyse_play_consistency.cpp b/library/tests/solve_board/analyze_play_consistency.cpp similarity index 98% rename from library/tests/solve_board/analyse_play_consistency.cpp rename to library/tests/solve_board/analyze_play_consistency.cpp index 14d5f22b6..bfe76a53f 100644 --- a/library/tests/solve_board/analyse_play_consistency.cpp +++ b/library/tests/solve_board/analyze_play_consistency.cpp @@ -1,10 +1,10 @@ -/// @file analyse_play_consistency.cpp +/// @file analyze_play_consistency.cpp /// @brief Self-consistency regression tests for AnalysePlay. /// @details For any deal and play, the trick count AnalysePlayPBN reports after /// each card must equal an independent SolveBoardPBN of that same position. /// These two code paths share no transposition-table state, so agreement is a /// strong correctness check that needs no external reference solver. This guards -/// the regression in issue #156, where analyse_later_board used a fresh (cold) +/// the regression in issue #156, where analyze_later_board used a fresh (cold) /// transposition table per card and under-counted tricks. // C++ standard library headers diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 8ae15bfd7..61766b7e1 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -168,10 +168,10 @@ py_test( ) py_test( - name = "analyse_test", + name = "analyze_test", size = "small", - main = "tests/test_analyse.py", - srcs = ["tests/test_analyse.py"], + main = "tests/test_analyze.py", + srcs = ["tests/test_analyze.py"], deps = [":dds3_lib"], ) diff --git a/python/tests/test_analyse.py b/python/tests/test_analyze.py similarity index 87% rename from python/tests/test_analyse.py rename to python/tests/test_analyze.py index 544c5b3e9..0693fd08e 100644 --- a/python/tests/test_analyse.py +++ b/python/tests/test_analyze.py @@ -1,4 +1,4 @@ -"""Tests for analyse_play_pbn, analyse_all_plays_pbn and dealer_par.""" +"""Tests for analyse_play_pbn / analyse_all_plays_pbn (legacy British API names) and dealer_par.""" import unittest @@ -28,13 +28,13 @@ } -class TestAnalysePlay(unittest.TestCase): - """Tests for analyse_play_pbn / analyse_all_plays_pbn.""" +class TestAnalyzePlay(unittest.TestCase): + """Coverage for the published analyse_play_pbn / analyse_all_plays_pbn APIs.""" def setUp(self) -> None: set_max_threads(0) - def test_analyse_play_pbn_basic(self) -> None: + def test_analyze_play_pbn_basic(self) -> None: # North leads the spade 6 in NT. result = analyse_play_pbn(DEAL, play="S6", trump=4, first=0) self.assertIn("number", result) @@ -42,11 +42,11 @@ def test_analyse_play_pbn_basic(self) -> None: self.assertIsInstance(result["tricks"], list) self.assertEqual(len(result["tricks"]), result["number"]) - def test_analyse_play_pbn_odd_length(self) -> None: + def test_analyze_play_pbn_odd_length(self) -> None: with self.assertRaises(ValueError): analyse_play_pbn(DEAL, play="S6S", trump=4, first=0) - def test_analyse_all_plays_pbn(self) -> None: + def test_analyze_all_plays_pbn(self) -> None: deals = [ {"remain_cards": DEAL, "play": "S6", "trump": 4, "first": 0}, {"remain_cards": DEAL, "play": "S6", "trump": 1, "first": 0}, @@ -57,7 +57,7 @@ def test_analyse_all_plays_pbn(self) -> None: self.assertIn("tricks", result) self.assertIsInstance(result["tricks"], list) - def test_analyse_all_plays_missing_play(self) -> None: + def test_analyze_all_plays_missing_play(self) -> None: with self.assertRaises(KeyError): analyse_all_plays_pbn([{"remain_cards": DEAL}]) diff --git a/python/utilities/tests/create_list_for_dtest_test.py b/python/utilities/tests/create_list_for_dtest_test.py index 079858b33..9599785a1 100644 --- a/python/utilities/tests/create_list_for_dtest_test.py +++ b/python/utilities/tests/create_list_for_dtest_test.py @@ -64,7 +64,7 @@ def _check_play_self_consistency( first: int, play: str, ) -> None: - """Match analyse_play_consistency.cpp: AnalysePlay vs SolveBoard each ply.""" + """Match analyze_play_consistency.cpp: AnalysePlay vs SolveBoard each ply.""" hands = cld._parse_remain_cards(remain_cards) cards = _play_to_cards(play) solved = analyse_play_pbn(remain_cards, play=play, trump=trump, first=first) diff --git a/solution/DDS.vcxproj b/solution/DDS.vcxproj index 8ba20e0f2..88d3d34b6 100644 --- a/solution/DDS.vcxproj +++ b/solution/DDS.vcxproj @@ -80,7 +80,7 @@ - + @@ -128,7 +128,7 @@ - + diff --git a/solution/Solution.slnx b/solution/Solution.slnx index 68626a696..73230190f 100644 --- a/solution/Solution.slnx +++ b/solution/Solution.slnx @@ -6,17 +6,17 @@ - + - + - + diff --git a/solution/analyse_all_plays_bin.vcxproj b/solution/analyze_all_plays_bin.vcxproj similarity index 98% rename from solution/analyse_all_plays_bin.vcxproj rename to solution/analyze_all_plays_bin.vcxproj index b50ada4e3..264d7061a 100644 --- a/solution/analyse_all_plays_bin.vcxproj +++ b/solution/analyze_all_plays_bin.vcxproj @@ -31,7 +31,7 @@ ..\Build\int\$(platform)\$(Configuration)\$(ProjectName)\ - + diff --git a/solution/analyse_all_plays_bin.vcxproj.filters b/solution/analyze_all_plays_bin.vcxproj.filters similarity index 96% rename from solution/analyse_all_plays_bin.vcxproj.filters rename to solution/analyze_all_plays_bin.vcxproj.filters index 976a4b510..c9812a0ae 100644 --- a/solution/analyse_all_plays_bin.vcxproj.filters +++ b/solution/analyze_all_plays_bin.vcxproj.filters @@ -40,6 +40,6 @@ - + \ No newline at end of file diff --git a/solution/analyse_play_bin.vcxproj b/solution/analyze_play_bin.vcxproj similarity index 98% rename from solution/analyse_play_bin.vcxproj rename to solution/analyze_play_bin.vcxproj index b9cd5b0d1..d3175b33a 100644 --- a/solution/analyse_play_bin.vcxproj +++ b/solution/analyze_play_bin.vcxproj @@ -30,7 +30,7 @@ ..\Build\int\$(platform)\$(Configuration)\$(ProjectName)\ - + diff --git a/solution/analyse_play_bin.vcxproj.filters b/solution/analyze_play_bin.vcxproj.filters similarity index 96% rename from solution/analyse_play_bin.vcxproj.filters rename to solution/analyze_play_bin.vcxproj.filters index cba48096b..6b8679bdd 100644 --- a/solution/analyse_play_bin.vcxproj.filters +++ b/solution/analyze_play_bin.vcxproj.filters @@ -38,6 +38,6 @@ - + \ No newline at end of file diff --git a/solution/analyse_play_pbn.vcxproj b/solution/analyze_play_pbn.vcxproj similarity index 98% rename from solution/analyse_play_pbn.vcxproj rename to solution/analyze_play_pbn.vcxproj index 4b5d4d4ef..0e8ad572a 100644 --- a/solution/analyse_play_pbn.vcxproj +++ b/solution/analyze_play_pbn.vcxproj @@ -30,7 +30,7 @@ ..\Build\int\$(platform)\$(Configuration)\$(ProjectName)\ - + diff --git a/solution/analyse_play_pbn.vcxproj.filters b/solution/analyze_play_pbn.vcxproj.filters similarity index 96% rename from solution/analyse_play_pbn.vcxproj.filters rename to solution/analyze_play_pbn.vcxproj.filters index ab8a7b48c..65afde172 100644 --- a/solution/analyse_play_pbn.vcxproj.filters +++ b/solution/analyze_play_pbn.vcxproj.filters @@ -38,6 +38,6 @@ - + \ No newline at end of file diff --git a/solution/dds_native.vcxproj b/solution/dds_native.vcxproj index 7e06a5705..9b147e22f 100644 --- a/solution/dds_native.vcxproj +++ b/solution/dds_native.vcxproj @@ -83,7 +83,7 @@ - + @@ -129,7 +129,7 @@ - + diff --git a/solution/dds_native.vcxproj.filters b/solution/dds_native.vcxproj.filters index e8786fe93..71de6b17b 100644 --- a/solution/dds_native.vcxproj.filters +++ b/solution/dds_native.vcxproj.filters @@ -87,7 +87,7 @@ library\src - + library\src @@ -221,7 +221,7 @@ library\src - + library\src diff --git a/specs/examples-cli.md b/specs/examples-cli.md index 9e5b3a281..b057bbef2 100644 --- a/specs/examples-cli.md +++ b/specs/examples-cli.md @@ -26,8 +26,8 @@ build ports to the browser. They are demonstrations, not a supported product CLI - **Double-dummy tables:** `calc_dd_table`, `calc_dd_table_pbn`, `calc_all_tables`, `calc_all_tables_pbn`. - **Par scoring:** `par`, `dealer_par`. - - **Play analysis:** `AnalysePlayBin` (source `analyse_play_bin.cpp`), - `analyse_play_pbn`, `analyse_all_plays_bin`, `analyse_all_plays_pbn`. + - **Play analysis:** `AnalysePlayBin` (source `analyze_play_bin.cpp`), + `analyze_play_pbn`, `analyze_all_plays_bin`, `analyze_all_plays_pbn`. - **Modern context API demos:** `migration_example`, `calc_par_context_example`. - **Many entry points have PBN and binary twins.** Solve/table/play pairs often diff --git a/specs/wasm-emscripten.md b/specs/wasm-emscripten.md index 74ecb8ea4..e60ecdf83 100644 --- a/specs/wasm-emscripten.md +++ b/specs/wasm-emscripten.md @@ -24,7 +24,7 @@ core solver builds and runs correctly under Emscripten. - **A curated subset of CLIs is ported.** `wasm_cc_binary` wraps three [examples-cli](examples-cli.md) binaries: `solve_board_wasm` (← `//examples:solve_board`), - `analyse_play_bin_wasm` (← `//examples:AnalysePlayBin`), and + `analyze_play_bin_wasm` (← `//examples:AnalysePlayBin`), and `calc_dd_table_pbn_wasm` (← `//examples:calc_dd_table_pbn`), each emitting a `.js` loader + `.wasm`. `all_examples_wasm` groups them. Separately, `dtest_wasm` (← `//library/tests:dtest`) ports the hand-list test harness for diff --git a/wasm/BUILD.bazel b/wasm/BUILD.bazel index cd8076fa5..b3284c3d8 100644 --- a/wasm/BUILD.bazel +++ b/wasm/BUILD.bazel @@ -14,7 +14,7 @@ wasm_cc_binary( ) wasm_cc_binary( - name = "analyse_play_bin_wasm", + name = "analyze_play_bin_wasm", cc_target = "//examples:AnalysePlayBin", threads = "emscripten", outputs = [ @@ -66,7 +66,7 @@ py_test( filegroup( name = "all_examples_wasm", srcs = [ - ":analyse_play_bin_wasm", + ":analyze_play_bin_wasm", ":calc_dd_table_pbn_wasm", ":solve_board_wasm", ], From 0d148fbc49329484406b1d5f01fb978df86028c0 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 08:46:38 +0200 Subject: [PATCH 2/8] Document AnalysePlayBin as the Bazel target for analyze_play_bin. The README listed a non-existent //examples:analyze_play_bin label; the binary example target remains AnalysePlayBin to match the legacy API. Co-authored-by: Cursor --- examples/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README b/examples/README index 6cc021bef..e01d8b31f 100644 --- a/examples/README +++ b/examples/README @@ -28,7 +28,7 @@ Run an example: Available examples: - analyze_all_plays_bin, analyze_all_plays_pbn -- analyze_play_bin, analyze_play_pbn +- AnalysePlayBin (source `analyze_play_bin.cpp`), analyze_play_pbn - calc_all_tables, calc_all_tables_pbn - calc_dd_table, calc_dd_table_pbn - dd_table_for_deal (C++; Python: //python/examples:dd_table_for_deal; .NET: dotnet/DdTableForDeal) From 528d4999e238182bc5814d6fe93cf3d4fb871923 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 08:51:56 +0200 Subject: [PATCH 3/8] Revert "Document AnalysePlayBin as the Bazel target for analyze_play_bin." This reverts commit 0d148fbc49329484406b1d5f01fb978df86028c0. --- examples/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README b/examples/README index e01d8b31f..6cc021bef 100644 --- a/examples/README +++ b/examples/README @@ -28,7 +28,7 @@ Run an example: Available examples: - analyze_all_plays_bin, analyze_all_plays_pbn -- AnalysePlayBin (source `analyze_play_bin.cpp`), analyze_play_pbn +- analyze_play_bin, analyze_play_pbn - calc_all_tables, calc_all_tables_pbn - calc_dd_table, calc_dd_table_pbn - dd_table_for_deal (C++; Python: //python/examples:dd_table_for_deal; .NET: dotnet/DdTableForDeal) From 96e9ebf9cf11552668cc01b93bf6c8ab88c71621 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 08:51:56 +0200 Subject: [PATCH 4/8] Revert "Prefer American spelling in non-API identifiers and filenames." This reverts commit a5a688230b89220a2bade4fd99eff52496bd6056. --- .github/instructions/cpp.instructions.md | 4 ---- AGENTS.md | 2 -- doc/dll-description.html | 2 +- doc/dll-description.md | 2 +- docs/wasm_build.md | 2 +- examples/BUILD.bazel | 20 +++++++++---------- examples/README | 4 ++-- ...lays_bin.cpp => analyse_all_plays_bin.cpp} | 0 ...lays_pbn.cpp => analyse_all_plays_pbn.cpp} | 0 ...lyze_play_bin.cpp => analyse_play_bin.cpp} | 0 ...lyze_play_pbn.cpp => analyse_play_pbn.cpp} | 0 library/src/init.cpp | 2 +- .../{play_analyzer.cpp => play_analyser.cpp} | 6 +++--- .../{play_analyzer.hpp => play_analyser.hpp} | 0 library/src/solver_if.cpp | 4 ++-- library/src/solver_if.hpp | 2 +- library/tests/solve_board/BUILD.bazel | 4 ++-- ...tency.cpp => analyse_play_consistency.cpp} | 4 ++-- python/BUILD.bazel | 6 +++--- .../{test_analyze.py => test_analyse.py} | 14 ++++++------- .../tests/create_list_for_dtest_test.py | 2 +- solution/DDS.vcxproj | 4 ++-- solution/Solution.slnx | 6 +++--- ....vcxproj => analyse_all_plays_bin.vcxproj} | 2 +- ... => analyse_all_plays_bin.vcxproj.filters} | 2 +- ...y_bin.vcxproj => analyse_play_bin.vcxproj} | 2 +- ...lters => analyse_play_bin.vcxproj.filters} | 2 +- ...y_pbn.vcxproj => analyse_play_pbn.vcxproj} | 2 +- ...lters => analyse_play_pbn.vcxproj.filters} | 2 +- solution/dds_native.vcxproj | 4 ++-- solution/dds_native.vcxproj.filters | 4 ++-- specs/examples-cli.md | 4 ++-- specs/wasm-emscripten.md | 2 +- wasm/BUILD.bazel | 4 ++-- 34 files changed, 57 insertions(+), 63 deletions(-) rename examples/{analyze_all_plays_bin.cpp => analyse_all_plays_bin.cpp} (100%) rename examples/{analyze_all_plays_pbn.cpp => analyse_all_plays_pbn.cpp} (100%) rename examples/{analyze_play_bin.cpp => analyse_play_bin.cpp} (100%) rename examples/{analyze_play_pbn.cpp => analyse_play_pbn.cpp} (100%) rename library/src/{play_analyzer.cpp => play_analyser.cpp} (98%) rename library/src/{play_analyzer.hpp => play_analyser.hpp} (100%) rename library/tests/solve_board/{analyze_play_consistency.cpp => analyse_play_consistency.cpp} (98%) rename python/tests/{test_analyze.py => test_analyse.py} (87%) rename solution/{analyze_all_plays_bin.vcxproj => analyse_all_plays_bin.vcxproj} (98%) rename solution/{analyze_all_plays_bin.vcxproj.filters => analyse_all_plays_bin.vcxproj.filters} (96%) rename solution/{analyze_play_bin.vcxproj => analyse_play_bin.vcxproj} (98%) rename solution/{analyze_play_bin.vcxproj.filters => analyse_play_bin.vcxproj.filters} (96%) rename solution/{analyze_play_pbn.vcxproj => analyse_play_pbn.vcxproj} (98%) rename solution/{analyze_play_pbn.vcxproj.filters => analyse_play_pbn.vcxproj.filters} (96%) diff --git a/.github/instructions/cpp.instructions.md b/.github/instructions/cpp.instructions.md index 277ec0e14..cabb855b7 100644 --- a/.github/instructions/cpp.instructions.md +++ b/.github/instructions/cpp.instructions.md @@ -56,10 +56,6 @@ This project follows a consistent modern C++ style, inspired by Google/LLVM with ## Naming -Prefer American spelling in identifiers (files, functions, variables). Leave -legacy public-API names that already use British spelling unchanged (for -example `AnalysePlay*`). - ### Types - **PascalCase** - Examples: `FixedArray`, `ErrorCode`, `SimulationRunner` diff --git a/AGENTS.md b/AGENTS.md index 725b436db..6d70dc4bc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,8 +10,6 @@ Follow .github/instructions/cpp.instructions.md Follow .github/instructions/cpp.instructions.md -Prefer American spelling in file, function, and variable names. - Exceptions: - Match existing external or legacy APIs (for example, public C API names and types that already use a different style). - Do not rename unrelated legacy identifiers in the same change unless the task requires it. diff --git a/doc/dll-description.html b/doc/dll-description.html index ed23ea0ac..346fe9e3a 100644 --- a/doc/dll-description.html +++ b/doc/dll-description.html @@ -770,7 +770,7 @@

Functions

SolveBoardPBN is just like SolveBoard, except for the input format. Historically it was one of the first functions, and it exposes the thread index directly to the user. Later functions generally don't do that, and they also hide the implementation details such as transposition tables, see below.

SolveBoard solves a single deal “dl” and returns the result in “*futp” which must be declared before calling SolveBoard.

If you have multiple hands to solve, it is always better to group them together into a single function call than to use SolveBoard.

-

SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the AnalysePlay* functions, this is the only function that exposes the thread number to the user.

+

SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the PlayAnalyse functions, this is the only function that exposes the thread number to the user.

There is a “transposition table” memory associated with each thread. Each node in the table is effectively a position after certain cards have been played and other certain cards remain. The table is not deleted automatically after each call to SolveBoard, so it can be reused from call to call. However, it only really makes sense to reuse the table when the hand is very similar in the two calls. The function will still run if this is not the case, but it won't be as efficient. The reuse of the transposition table can be controlled by the “mode” parameter, but normally this is not needed and should not be done.

The three parameters “target”, “solutions” and “mode” together control the function. Generally speaking, the target is the number of tricks to be won (at least) by the side to play; solutions controls how many solutions should be returned; and mode controls the search behavior. See next page for definitions.

For equivalent cards, only the highest is returned, and lower equivalent cards are encoded in the futureTricks structure (see “equals”).

diff --git a/doc/dll-description.md b/doc/dll-description.md index f289e386b..a14941b61 100644 --- a/doc/dll-description.md +++ b/doc/dll-description.md @@ -796,7 +796,7 @@ SolveBoard solves a single deal “dl” and returns the re If you have multiple hands to solve, it is always better to group them together into a single function call than to use SolveBoard. -SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the AnalysePlay* functions, this is the only function that exposes the thread number to the user. +SolveBoard is thread-safe, so several threads can call SolveBoard in parallel. Thus the user of DDS can create threads and call SolveBoard in parallel over them. The maximum number of threads is fixed in the DLL at compile time and is currently 16. So “threadIndex” must be between 0 and 15 inclusive; see also the function SetMaxThreads. Together with the PlayAnalyse functions, this is the only function that exposes the thread number to the user. There is a “transposition table” memory associated with each thread. Each node in the table is effectively a position after certain cards have been played and other certain cards remain. The table is not deleted automatically after each call to SolveBoard, so it can be reused from call to call. However, it only really makes sense to reuse the table when the hand is very similar in the two calls. The function will still run if this is not the case, but it won't be as efficient. The reuse of the transposition table can be controlled by the “mode” parameter, but normally this is not needed and should not be done. diff --git a/docs/wasm_build.md b/docs/wasm_build.md index 7fdd6bb86..2dc7c11b3 100644 --- a/docs/wasm_build.md +++ b/docs/wasm_build.md @@ -53,7 +53,7 @@ Outputs are under `bazel-bin/wasm/`: Rules in `wasm/BUILD.bazel` wrap native binaries: - `solve_board_wasm` — solves a single board (`//examples:solve_board`) -- `analyze_play_bin_wasm` — analyze play from binary format +- `analyse_play_bin_wasm` — analyze play from binary format - `calc_dd_table_pbn_wasm` — double-dummy table from PBN - `dtest_wasm` — the `dtest` hand-list harness for Node (`//library/tests:dtest`) diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index 43027e394..54021bf81 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -46,8 +46,8 @@ cc_library( # Example binaries cc_binary( - name = "analyze_all_plays_bin", - srcs = ["analyze_all_plays_bin.cpp"], + name = "analyse_all_plays_bin", + srcs = ["analyse_all_plays_bin.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -59,8 +59,8 @@ cc_binary( ) cc_binary( - name = "analyze_all_plays_pbn", - srcs = ["analyze_all_plays_pbn.cpp"], + name = "analyse_all_plays_pbn", + srcs = ["analyse_all_plays_pbn.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -73,7 +73,7 @@ cc_binary( cc_binary( name = "AnalysePlayBin", - srcs = ["analyze_play_bin.cpp"], + srcs = ["analyse_play_bin.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS + EXAMPLES_LINKOPTS_WASM, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -86,8 +86,8 @@ cc_binary( ) cc_binary( - name = "analyze_play_pbn", - srcs = ["analyze_play_pbn.cpp"], + name = "analyse_play_pbn", + srcs = ["analyse_play_pbn.cpp"], copts = EXAMPLES_CPPOPTS, linkopts = DDS_LINKOPTS, local_defines = EXAMPLES_LOCAL_DEFINES, @@ -247,10 +247,10 @@ cc_binary( filegroup( name = "all_examples", srcs = [ - ":analyze_all_plays_bin", - ":analyze_all_plays_pbn", + ":analyse_all_plays_bin", + ":analyse_all_plays_pbn", ":AnalysePlayBin", - ":analyze_play_pbn", + ":analyse_play_pbn", ":calc_all_tables", ":calc_all_tables_pbn", ":calc_dd_table", diff --git a/examples/README b/examples/README index 6cc021bef..477ef9fa8 100644 --- a/examples/README +++ b/examples/README @@ -27,8 +27,8 @@ Run an example: ./dotnet/DdTableForDeal/e2e.sh # requires DDS_LIBRARY_PATH; Windows: e2e.ps1 Available examples: -- analyze_all_plays_bin, analyze_all_plays_pbn -- analyze_play_bin, analyze_play_pbn +- analyse_all_plays_bin, analyse_all_plays_pbn +- analyse_play_bin, analyse_play_pbn - calc_all_tables, calc_all_tables_pbn - calc_dd_table, calc_dd_table_pbn - dd_table_for_deal (C++; Python: //python/examples:dd_table_for_deal; .NET: dotnet/DdTableForDeal) diff --git a/examples/analyze_all_plays_bin.cpp b/examples/analyse_all_plays_bin.cpp similarity index 100% rename from examples/analyze_all_plays_bin.cpp rename to examples/analyse_all_plays_bin.cpp diff --git a/examples/analyze_all_plays_pbn.cpp b/examples/analyse_all_plays_pbn.cpp similarity index 100% rename from examples/analyze_all_plays_pbn.cpp rename to examples/analyse_all_plays_pbn.cpp diff --git a/examples/analyze_play_bin.cpp b/examples/analyse_play_bin.cpp similarity index 100% rename from examples/analyze_play_bin.cpp rename to examples/analyse_play_bin.cpp diff --git a/examples/analyze_play_pbn.cpp b/examples/analyse_play_pbn.cpp similarity index 100% rename from examples/analyze_play_pbn.cpp rename to examples/analyse_play_pbn.cpp diff --git a/library/src/init.cpp b/library/src/init.cpp index b4296ea2c..73881c026 100644 --- a/library/src/init.cpp +++ b/library/src/init.cpp @@ -17,7 +17,7 @@ #include #include "init.hpp" -#include +#include #include #include #include diff --git a/library/src/play_analyzer.cpp b/library/src/play_analyser.cpp similarity index 98% rename from library/src/play_analyzer.cpp rename to library/src/play_analyser.cpp index 436cbda8d..8848a2edf 100644 --- a/library/src/play_analyzer.cpp +++ b/library/src/play_analyser.cpp @@ -7,7 +7,7 @@ See LICENSE and README. */ -#include "play_analyzer.hpp" +#include "play_analyser.hpp" #include #include #include @@ -50,7 +50,7 @@ int STDCALL AnalysePlayBin( { // Create an owned context for this analysis. The same context (and its // transposition table) is reused for the initial solve and every subsequent - // analyze_later_board call, so the hint-bounded incremental searches see a + // analyse_later_board call, so the hint-bounded incremental searches see a // warm TT -- see the analogous calc_dd_table fix (commit 27030ba). SolverContext outer_ctx; @@ -200,7 +200,7 @@ int STDCALL AnalysePlayBin( if (usingCurrent) continue; - if ((ret = analyze_later_board(ctx, dl.first, &move, hint, + if ((ret = analyse_later_board(ctx, dl.first, &move, hint, hintDir, &fut)) != RETURN_NO_FAULT) { diff --git a/library/src/play_analyzer.hpp b/library/src/play_analyser.hpp similarity index 100% rename from library/src/play_analyzer.hpp rename to library/src/play_analyser.hpp diff --git a/library/src/solver_if.cpp b/library/src/solver_if.cpp index b90031986..f935f004e 100644 --- a/library/src/solver_if.cpp +++ b/library/src/solver_if.cpp @@ -819,7 +819,7 @@ auto solve_same_board( } -auto analyze_later_board( +auto analyse_later_board( SolverContext& ctx, const int leadHand, MoveType const * move, @@ -827,7 +827,7 @@ auto analyze_later_board( const int hintDir, FutureTricks * futp) -> int { - // Specialized function for play analyzer for cards after the + // Specialized function for PlayAnalyser for cards after the // opening lead. No further parameter checks! This function // makes heavy reuse of parameters that are already stored in // various places. It corresponds to: diff --git a/library/src/solver_if.hpp b/library/src/solver_if.hpp index fbbe21c00..e5b6fcb0f 100644 --- a/library/src/solver_if.hpp +++ b/library/src/solver_if.hpp @@ -27,7 +27,7 @@ auto solve_same_board( FutureTricks * futp, const int hint) -> int; -auto analyze_later_board( +auto analyse_later_board( SolverContext& ctx, const int leadHand, MoveType const * move, diff --git a/library/tests/solve_board/BUILD.bazel b/library/tests/solve_board/BUILD.bazel index def6fe5be..eec3b09b5 100644 --- a/library/tests/solve_board/BUILD.bazel +++ b/library/tests/solve_board/BUILD.bazel @@ -21,10 +21,10 @@ cc_test( # .bazelrc so MSAN (can exceed 120s on this suite) keeps headroom without # timeout="moderate" (which trips --test_verbose_timeout_warnings on fast runs). cc_test( - name = "analyze_play_consistency_test", + name = "analyse_play_consistency_test", size = "small", srcs = [ - "analyze_play_consistency.cpp", + "analyse_play_consistency.cpp", ], deps = [ "//library/src:testable_dds", diff --git a/library/tests/solve_board/analyze_play_consistency.cpp b/library/tests/solve_board/analyse_play_consistency.cpp similarity index 98% rename from library/tests/solve_board/analyze_play_consistency.cpp rename to library/tests/solve_board/analyse_play_consistency.cpp index bfe76a53f..14d5f22b6 100644 --- a/library/tests/solve_board/analyze_play_consistency.cpp +++ b/library/tests/solve_board/analyse_play_consistency.cpp @@ -1,10 +1,10 @@ -/// @file analyze_play_consistency.cpp +/// @file analyse_play_consistency.cpp /// @brief Self-consistency regression tests for AnalysePlay. /// @details For any deal and play, the trick count AnalysePlayPBN reports after /// each card must equal an independent SolveBoardPBN of that same position. /// These two code paths share no transposition-table state, so agreement is a /// strong correctness check that needs no external reference solver. This guards -/// the regression in issue #156, where analyze_later_board used a fresh (cold) +/// the regression in issue #156, where analyse_later_board used a fresh (cold) /// transposition table per card and under-counted tricks. // C++ standard library headers diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 61766b7e1..8ae15bfd7 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -168,10 +168,10 @@ py_test( ) py_test( - name = "analyze_test", + name = "analyse_test", size = "small", - main = "tests/test_analyze.py", - srcs = ["tests/test_analyze.py"], + main = "tests/test_analyse.py", + srcs = ["tests/test_analyse.py"], deps = [":dds3_lib"], ) diff --git a/python/tests/test_analyze.py b/python/tests/test_analyse.py similarity index 87% rename from python/tests/test_analyze.py rename to python/tests/test_analyse.py index 0693fd08e..544c5b3e9 100644 --- a/python/tests/test_analyze.py +++ b/python/tests/test_analyse.py @@ -1,4 +1,4 @@ -"""Tests for analyse_play_pbn / analyse_all_plays_pbn (legacy British API names) and dealer_par.""" +"""Tests for analyse_play_pbn, analyse_all_plays_pbn and dealer_par.""" import unittest @@ -28,13 +28,13 @@ } -class TestAnalyzePlay(unittest.TestCase): - """Coverage for the published analyse_play_pbn / analyse_all_plays_pbn APIs.""" +class TestAnalysePlay(unittest.TestCase): + """Tests for analyse_play_pbn / analyse_all_plays_pbn.""" def setUp(self) -> None: set_max_threads(0) - def test_analyze_play_pbn_basic(self) -> None: + def test_analyse_play_pbn_basic(self) -> None: # North leads the spade 6 in NT. result = analyse_play_pbn(DEAL, play="S6", trump=4, first=0) self.assertIn("number", result) @@ -42,11 +42,11 @@ def test_analyze_play_pbn_basic(self) -> None: self.assertIsInstance(result["tricks"], list) self.assertEqual(len(result["tricks"]), result["number"]) - def test_analyze_play_pbn_odd_length(self) -> None: + def test_analyse_play_pbn_odd_length(self) -> None: with self.assertRaises(ValueError): analyse_play_pbn(DEAL, play="S6S", trump=4, first=0) - def test_analyze_all_plays_pbn(self) -> None: + def test_analyse_all_plays_pbn(self) -> None: deals = [ {"remain_cards": DEAL, "play": "S6", "trump": 4, "first": 0}, {"remain_cards": DEAL, "play": "S6", "trump": 1, "first": 0}, @@ -57,7 +57,7 @@ def test_analyze_all_plays_pbn(self) -> None: self.assertIn("tricks", result) self.assertIsInstance(result["tricks"], list) - def test_analyze_all_plays_missing_play(self) -> None: + def test_analyse_all_plays_missing_play(self) -> None: with self.assertRaises(KeyError): analyse_all_plays_pbn([{"remain_cards": DEAL}]) diff --git a/python/utilities/tests/create_list_for_dtest_test.py b/python/utilities/tests/create_list_for_dtest_test.py index 9599785a1..079858b33 100644 --- a/python/utilities/tests/create_list_for_dtest_test.py +++ b/python/utilities/tests/create_list_for_dtest_test.py @@ -64,7 +64,7 @@ def _check_play_self_consistency( first: int, play: str, ) -> None: - """Match analyze_play_consistency.cpp: AnalysePlay vs SolveBoard each ply.""" + """Match analyse_play_consistency.cpp: AnalysePlay vs SolveBoard each ply.""" hands = cld._parse_remain_cards(remain_cards) cards = _play_to_cards(play) solved = analyse_play_pbn(remain_cards, play=play, trump=trump, first=first) diff --git a/solution/DDS.vcxproj b/solution/DDS.vcxproj index 88d3d34b6..8ba20e0f2 100644 --- a/solution/DDS.vcxproj +++ b/solution/DDS.vcxproj @@ -80,7 +80,7 @@ - + @@ -128,7 +128,7 @@ - + diff --git a/solution/Solution.slnx b/solution/Solution.slnx index 73230190f..68626a696 100644 --- a/solution/Solution.slnx +++ b/solution/Solution.slnx @@ -6,17 +6,17 @@ - + - + - + diff --git a/solution/analyze_all_plays_bin.vcxproj b/solution/analyse_all_plays_bin.vcxproj similarity index 98% rename from solution/analyze_all_plays_bin.vcxproj rename to solution/analyse_all_plays_bin.vcxproj index 264d7061a..b50ada4e3 100644 --- a/solution/analyze_all_plays_bin.vcxproj +++ b/solution/analyse_all_plays_bin.vcxproj @@ -31,7 +31,7 @@ ..\Build\int\$(platform)\$(Configuration)\$(ProjectName)\ - + diff --git a/solution/analyze_all_plays_bin.vcxproj.filters b/solution/analyse_all_plays_bin.vcxproj.filters similarity index 96% rename from solution/analyze_all_plays_bin.vcxproj.filters rename to solution/analyse_all_plays_bin.vcxproj.filters index c9812a0ae..976a4b510 100644 --- a/solution/analyze_all_plays_bin.vcxproj.filters +++ b/solution/analyse_all_plays_bin.vcxproj.filters @@ -40,6 +40,6 @@ - + \ No newline at end of file diff --git a/solution/analyze_play_bin.vcxproj b/solution/analyse_play_bin.vcxproj similarity index 98% rename from solution/analyze_play_bin.vcxproj rename to solution/analyse_play_bin.vcxproj index d3175b33a..b9cd5b0d1 100644 --- a/solution/analyze_play_bin.vcxproj +++ b/solution/analyse_play_bin.vcxproj @@ -30,7 +30,7 @@ ..\Build\int\$(platform)\$(Configuration)\$(ProjectName)\ - + diff --git a/solution/analyze_play_bin.vcxproj.filters b/solution/analyse_play_bin.vcxproj.filters similarity index 96% rename from solution/analyze_play_bin.vcxproj.filters rename to solution/analyse_play_bin.vcxproj.filters index 6b8679bdd..cba48096b 100644 --- a/solution/analyze_play_bin.vcxproj.filters +++ b/solution/analyse_play_bin.vcxproj.filters @@ -38,6 +38,6 @@ - + \ No newline at end of file diff --git a/solution/analyze_play_pbn.vcxproj b/solution/analyse_play_pbn.vcxproj similarity index 98% rename from solution/analyze_play_pbn.vcxproj rename to solution/analyse_play_pbn.vcxproj index 0e8ad572a..4b5d4d4ef 100644 --- a/solution/analyze_play_pbn.vcxproj +++ b/solution/analyse_play_pbn.vcxproj @@ -30,7 +30,7 @@ ..\Build\int\$(platform)\$(Configuration)\$(ProjectName)\ - + diff --git a/solution/analyze_play_pbn.vcxproj.filters b/solution/analyse_play_pbn.vcxproj.filters similarity index 96% rename from solution/analyze_play_pbn.vcxproj.filters rename to solution/analyse_play_pbn.vcxproj.filters index 65afde172..ab8a7b48c 100644 --- a/solution/analyze_play_pbn.vcxproj.filters +++ b/solution/analyse_play_pbn.vcxproj.filters @@ -38,6 +38,6 @@ - + \ No newline at end of file diff --git a/solution/dds_native.vcxproj b/solution/dds_native.vcxproj index 9b147e22f..7e06a5705 100644 --- a/solution/dds_native.vcxproj +++ b/solution/dds_native.vcxproj @@ -83,7 +83,7 @@ - + @@ -129,7 +129,7 @@ - + diff --git a/solution/dds_native.vcxproj.filters b/solution/dds_native.vcxproj.filters index 71de6b17b..e8786fe93 100644 --- a/solution/dds_native.vcxproj.filters +++ b/solution/dds_native.vcxproj.filters @@ -87,7 +87,7 @@ library\src - + library\src @@ -221,7 +221,7 @@ library\src - + library\src diff --git a/specs/examples-cli.md b/specs/examples-cli.md index b057bbef2..9e5b3a281 100644 --- a/specs/examples-cli.md +++ b/specs/examples-cli.md @@ -26,8 +26,8 @@ build ports to the browser. They are demonstrations, not a supported product CLI - **Double-dummy tables:** `calc_dd_table`, `calc_dd_table_pbn`, `calc_all_tables`, `calc_all_tables_pbn`. - **Par scoring:** `par`, `dealer_par`. - - **Play analysis:** `AnalysePlayBin` (source `analyze_play_bin.cpp`), - `analyze_play_pbn`, `analyze_all_plays_bin`, `analyze_all_plays_pbn`. + - **Play analysis:** `AnalysePlayBin` (source `analyse_play_bin.cpp`), + `analyse_play_pbn`, `analyse_all_plays_bin`, `analyse_all_plays_pbn`. - **Modern context API demos:** `migration_example`, `calc_par_context_example`. - **Many entry points have PBN and binary twins.** Solve/table/play pairs often diff --git a/specs/wasm-emscripten.md b/specs/wasm-emscripten.md index e60ecdf83..74ecb8ea4 100644 --- a/specs/wasm-emscripten.md +++ b/specs/wasm-emscripten.md @@ -24,7 +24,7 @@ core solver builds and runs correctly under Emscripten. - **A curated subset of CLIs is ported.** `wasm_cc_binary` wraps three [examples-cli](examples-cli.md) binaries: `solve_board_wasm` (← `//examples:solve_board`), - `analyze_play_bin_wasm` (← `//examples:AnalysePlayBin`), and + `analyse_play_bin_wasm` (← `//examples:AnalysePlayBin`), and `calc_dd_table_pbn_wasm` (← `//examples:calc_dd_table_pbn`), each emitting a `.js` loader + `.wasm`. `all_examples_wasm` groups them. Separately, `dtest_wasm` (← `//library/tests:dtest`) ports the hand-list test harness for diff --git a/wasm/BUILD.bazel b/wasm/BUILD.bazel index b3284c3d8..cd8076fa5 100644 --- a/wasm/BUILD.bazel +++ b/wasm/BUILD.bazel @@ -14,7 +14,7 @@ wasm_cc_binary( ) wasm_cc_binary( - name = "analyze_play_bin_wasm", + name = "analyse_play_bin_wasm", cc_target = "//examples:AnalysePlayBin", threads = "emscripten", outputs = [ @@ -66,7 +66,7 @@ py_test( filegroup( name = "all_examples_wasm", srcs = [ - ":analyze_play_bin_wasm", + ":analyse_play_bin_wasm", ":calc_dd_table_pbn_wasm", ":solve_board_wasm", ], From ce0d00b7e0d26ca3009b1d3ee6e593c7c0294f83 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 08:52:20 +0200 Subject: [PATCH 5/8] Revert play-analysis identifier Americanization. Restore analyse_* / play_analyser naming and Analyse wording in play-analysis docs; document AnalysePlayBin in examples/README. Co-authored-by: Cursor --- examples/README | 2 +- library/src/play_analyser.cpp | 4 ++-- python/src/bindings.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/README b/examples/README index 477ef9fa8..f0176c3b2 100644 --- a/examples/README +++ b/examples/README @@ -28,7 +28,7 @@ Run an example: Available examples: - analyse_all_plays_bin, analyse_all_plays_pbn -- analyse_play_bin, analyse_play_pbn +- AnalysePlayBin (source `analyse_play_bin.cpp`), analyse_play_pbn - calc_all_tables, calc_all_tables_pbn - calc_dd_table, calc_dd_table_pbn - dd_table_for_deal (C++; Python: //python/examples:dd_table_for_deal; .NET: dotnet/DdTableForDeal) diff --git a/library/src/play_analyser.cpp b/library/src/play_analyser.cpp index 8848a2edf..20f496621 100644 --- a/library/src/play_analyser.cpp +++ b/library/src/play_analyser.cpp @@ -31,7 +31,7 @@ extern Scheduler scheduler; /** - * @brief Analyze a sequence of played cards (binary format) and determine the tricks taken. + * @brief Analyse a sequence of played cards (binary format) and determine the tricks taken. * * This function simulates play of a bridge Deal according to the provided play trace, * using double dummy analysis to determine the number of tricks won at each step. @@ -241,7 +241,7 @@ int STDCALL AnalysePlayBin( /** - * @brief Analyze a sequence of played cards (PBN format) and determine the tricks taken. + * @brief Analyse a sequence of played cards (PBN format) and determine the tricks taken. * * This function converts a PBN-format Deal and play trace to internal format, * then simulates play using double dummy analysis to determine the number of tricks won. diff --git a/python/src/bindings.cpp b/python/src/bindings.cpp index 096016433..c009c854a 100644 --- a/python/src/bindings.cpp +++ b/python/src/bindings.cpp @@ -711,7 +711,7 @@ auto register_analysis_bindings(py::module_& module) -> void py::arg("current_trick_suit") = py::make_tuple(0, 0, 0), py::arg("current_trick_rank") = py::make_tuple(0, 0, 0), py::arg("thread_index") = 0, - "Analyze a played deal: double-dummy trick count after each card played.\n\n" + "Analyse a played deal: double-dummy trick count after each card played.\n\n" "Wraps the DDS AnalysePlayPBN C API.\n\n" "Args:\n" " remain_cards (str): Full deal in PBN format before any card of 'play'.\n" @@ -792,7 +792,7 @@ auto register_analysis_bindings(py::module_& module) -> void return results; }, py::arg("deals"), - "Analyze multiple played deals in one batched call.\n\n" + "Analyse multiple played deals in one batched call.\n\n" "Wraps the DDS AnalyseAllPlaysPBN C API. Note: this batch entry point\n" "currently solves the deals sequentially (one board at a time).\n\n" "Args:\n" From cacf06dee49c372f2c3db8d3cc26a2c49b5d68f5 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 09:02:00 +0200 Subject: [PATCH 6/8] Document American spelling for new identifiers, keep legacy APIs. Prefer American forms for new code and non-API names; leave existing British public-API names such as AnalysePlay* unchanged. Co-authored-by: Cursor --- .github/instructions/cpp.instructions.md | 4 ++++ AGENTS.md | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/instructions/cpp.instructions.md b/.github/instructions/cpp.instructions.md index cabb855b7..435664c84 100644 --- a/.github/instructions/cpp.instructions.md +++ b/.github/instructions/cpp.instructions.md @@ -56,6 +56,10 @@ This project follows a consistent modern C++ style, inspired by Google/LLVM with ## Naming +Prefer American spelling in identifiers (files, functions, variables) for new +code and for anything not tied to an existing API. Leave legacy public-API +names that already use British spelling unchanged (for example `AnalysePlay*`). + ### Types - **PascalCase** - Examples: `FixedArray`, `ErrorCode`, `SimulationRunner` diff --git a/AGENTS.md b/AGENTS.md index 6d70dc4bc..f63220fe1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,8 +10,11 @@ Follow .github/instructions/cpp.instructions.md Follow .github/instructions/cpp.instructions.md +Prefer American spelling in file, function, and variable names for new code +and for anything not tied to an existing API. + Exceptions: -- Match existing external or legacy APIs (for example, public C API names and types that already use a different style). +- Match existing external or legacy APIs (for example, public C API names and types that already use a different style, such as `AnalysePlay*`). - Do not rename unrelated legacy identifiers in the same change unless the task requires it. # Test-driven development From 7df9bc714cc32816a3fa9f131d603b92a34e16c5 Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 09:10:01 +0200 Subject: [PATCH 7/8] Keep American Analyze in AnalysePlay* @brief prose. Public symbol names stay British; docblock prose should match the existing American @param wording in the same comments. Co-authored-by: Cursor --- library/src/play_analyser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/play_analyser.cpp b/library/src/play_analyser.cpp index 20f496621..8848a2edf 100644 --- a/library/src/play_analyser.cpp +++ b/library/src/play_analyser.cpp @@ -31,7 +31,7 @@ extern Scheduler scheduler; /** - * @brief Analyse a sequence of played cards (binary format) and determine the tricks taken. + * @brief Analyze a sequence of played cards (binary format) and determine the tricks taken. * * This function simulates play of a bridge Deal according to the provided play trace, * using double dummy analysis to determine the number of tricks won at each step. @@ -241,7 +241,7 @@ int STDCALL AnalysePlayBin( /** - * @brief Analyse a sequence of played cards (PBN format) and determine the tricks taken. + * @brief Analyze a sequence of played cards (PBN format) and determine the tricks taken. * * This function converts a PBN-format Deal and play trace to internal format, * then simulates play using double dummy analysis to determine the number of tricks won. From 8ec8af0c5b546c9e44ba01875086875570b77b9b Mon Sep 17 00:00:00 2001 From: Adam Wildavsky Date: Tue, 15 Sep 2026 09:13:54 +0200 Subject: [PATCH 8/8] Keep American Analyze in Python Analyse* docstrings. User-facing prose follows American spelling; leave analyse_*_pbn binding names and Analyse* C API references unchanged. Co-authored-by: Cursor --- python/src/bindings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/src/bindings.cpp b/python/src/bindings.cpp index c009c854a..096016433 100644 --- a/python/src/bindings.cpp +++ b/python/src/bindings.cpp @@ -711,7 +711,7 @@ auto register_analysis_bindings(py::module_& module) -> void py::arg("current_trick_suit") = py::make_tuple(0, 0, 0), py::arg("current_trick_rank") = py::make_tuple(0, 0, 0), py::arg("thread_index") = 0, - "Analyse a played deal: double-dummy trick count after each card played.\n\n" + "Analyze a played deal: double-dummy trick count after each card played.\n\n" "Wraps the DDS AnalysePlayPBN C API.\n\n" "Args:\n" " remain_cards (str): Full deal in PBN format before any card of 'play'.\n" @@ -792,7 +792,7 @@ auto register_analysis_bindings(py::module_& module) -> void return results; }, py::arg("deals"), - "Analyse multiple played deals in one batched call.\n\n" + "Analyze multiple played deals in one batched call.\n\n" "Wraps the DDS AnalyseAllPlaysPBN C API. Note: this batch entry point\n" "currently solves the deals sequentially (one board at a time).\n\n" "Args:\n"