Entry 333
"CheckOperate run against the game: 600 random cases"
Documented in Entering The World - Kite in Mac Anu.
Filestools/test_event_vm.pycrates/piney-event/tests/vm.rscrates/piney-event/tests/vm_fixture.txtdocs/engine/field-game.md
90 noted that ccEvent::CheckOperate(9), the talk rule, had only been
checked in pieces. The target test was the interpreter's, but the function
as a whole had not been run against the game.
CheckOperate(num, flag) (INF SLUS_202.67:0x001b32f0, 224 bytes) is a
leaf:
num < 0answers 1;- with
flag0 andoperateSet(+0x778, s16) below 0, it storesnumthere; - the answer is 0 when
operate(+0x770, 64 bits) is not 0 and has the bit1 << num. The shift is a 32-bitsllvand sign-extends, sonum31 tests bits 31-63 andnum32 tests bit 0; - for
num9 withcmndTargetset, it storesoperateTarget(+0x780) and answers 0 when one oftarget[16](+0x40, s16 type and code) has1 << type(again 32-bit) amongcmndTarget->base+8's type flags and its code equal tobase+0xc. Empty targets (-1, -1) test bit 31 and code -1.
tools/test_event_vm.py now writes 600 operate lines (seed 9). Each
starts from ccEvent::Init with random registers:
operate(0 in 30% of cases);operateSet(-1 in half);- sixteen targets (60% empty);
cmndTargeteither NULL or a character whose type flags are random, given one live target's bit and code in 40% of cases;numfrom -1, 9, 9 and 0-63, withflag0 or 1.
Each line records the game's answer, operateSet after, and whether
operateTarget was set. They were appended to vm_fixture.txt; the rest
of the fixture is unchanged by the harness edit.
check_operate_matches_the_game (piney-event, tests/vm.rs) replays them
with Vm::check_operate on an OperateHost and needs no disc. All 600
match. Moving the type bit by one in the port fails it.
nothing about CheckOperate. The rest of [[90]]'s list (members in town, the gate's invite warp-in) is unchanged.