Adds the half of the AI's turn that is arithmetic rather than judgement: what an
order looks like in the command block, which orders advance the save's
modification counter and by how much, and the phase/pass skeleton the decisions
hang in.
The counter's per-command cost turns out to have a sharp boundary. Applying an
element of command lists 1..16 advances it; applying an element of lists 17..27
does not, and one of the six flag-gated single commands is free as well. So a
uniform per-element cost model is wrong on any turn that touches the free half.
Two behaviours here are not conveniences and change the output:
* every submitted block costs at least one, because the send-buffer build sets
the research-rate gate unconditionally whatever the player did. On a quiet
board that is the largest term in the turn's delta -- four of the ten command
bumps on the reference turn are exactly this, and one of the four is the
human's;
* an AI fleet order costs three where the interface's costs two, because the
AI's bridge issues the fleet-task command twice, mode 0 then mode 1, and the
adder keys on (fleet, mode).
The phase spine records the one thing a literal port gets wrong: the turn submits
at phase 28 of 34, the submit latches the client closed before it builds the send
buffer, and every order the last five phases issue -- one of which is a colonize
order -- is refused. Tested through the client rather than by asserting a flag.
The task walk reproduces the two passes: rank once, walk twice, and refuse every
write in the first pass at the client rather than trusting the caller to check.
Nothing here decides anything. Which tasks exist and what each one wants are
questions about the board, and no part of this models the board; the module
supplies the order API, the pass gate and the cost function, and a caller
supplies the decisions.
game/ai tests 233 -> 423 checks; ctest 51/51 -> 53/53. Not linked into the
standalone driver, whose divergence on the reference pair is unchanged at 128.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARBgSooAfokKUy6wKUKEyZ
30 lines
1.9 KiB
CMake
30 lines
1.9 KiB
CMake
# game/ai tests: the task vocabulary, the priority table read off the original, and the ranking.
|
|
add_executable(game_ai_test_tasks test_tasks.cpp)
|
|
target_link_libraries(game_ai_test_tasks PRIVATE sots_game_ai)
|
|
target_include_directories(game_ai_test_tasks PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_options(game_ai_test_tasks PRIVATE -Wall -Wextra -pedantic)
|
|
add_test(NAME game_ai_tasks COMMAND game_ai_test_tasks)
|
|
|
|
# The AI stepping order and the two-pass model: which AI players run, in what order, and which
|
|
# pass may write commands. Pure data -- the ModCount sequence, computed offline.
|
|
add_executable(game_ai_test_turn_order test_turn_order.cpp)
|
|
target_link_libraries(game_ai_test_turn_order PRIVATE sots_game_ai)
|
|
target_include_directories(game_ai_test_turn_order PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_options(game_ai_test_turn_order PRIVATE -Wall -Wextra -pedantic)
|
|
add_test(NAME game_ai_turn_order COMMAND game_ai_test_turn_order)
|
|
|
|
# The command block, the order API and the modification counter's arithmetic: what an order costs,
|
|
# which lists cost nothing, and the two reconstructions of the reference turn.
|
|
add_executable(game_ai_test_orders test_orders.cpp)
|
|
target_link_libraries(game_ai_test_orders PRIVATE sots_game_ai)
|
|
target_include_directories(game_ai_test_orders PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_options(game_ai_test_orders PRIVATE -Wall -Wextra -pedantic)
|
|
add_test(NAME game_ai_orders COMMAND game_ai_test_orders)
|
|
|
|
# The turn's phase list and the two-pass task walk: the dead tail after the submit, the one
|
|
# species-restricted phase, and the first pass writing nothing.
|
|
add_executable(game_ai_test_agent test_agent.cpp)
|
|
target_link_libraries(game_ai_test_agent PRIVATE sots_game_ai)
|
|
target_include_directories(game_ai_test_agent PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
target_compile_options(game_ai_test_agent PRIVATE -Wall -Wextra -pedantic)
|
|
add_test(NAME game_ai_agent COMMAND game_ai_test_agent)
|