• xtrn/knk/knk_math.js knk_math_test.jsxtrn/knk/knk.js

    From Deucе@1:103/705 to Git commit to main/sbbs/master on Fri Jul 24 19:50:44 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/77a36dcb3edc35713d59ec42
    Added Files:
    xtrn/knk/knk_math.js knk_math_test.js
    Modified Files:
    xtrn/knk/knk.js
    Log Message:
    Update KNK JS mechanics from original QuickBASIC executable

    Replace the statistical reconstruction of Kannons & Katapults with mechanics recovered directly from the original 4.4 executable.

    Move the recovered arithmetic into a standalone knk_math.js module and update the door to use it for:

    - Initial kingdom generation and original random-draw ordering
    - Monthly immigration, taxes, payroll, defections, and starvation
    - Food-month calculation and display limits
    - Soldier combat, loss targets, and scoring
    - Assassin infiltration, guard losses, and successful-attempt scoring
    - Cannon and catapult damage, targeting, clamping, and scoring
    - The King's original 12-candidate priority system
    - AI purchase quantities, eligibility gates, drafting, and retirement

    Preserve QuickBASIC-specific behavior such as INT flooring, single-precision
    AI priority stores, compound-condition random draws, and fixed player/King combat draw ordering.

    Remove the previous heuristic combat, damage, and computer-player logic while retaining the existing Synchronet door interface and presentation.

    Add deterministic Node.js regression tests covering initialization, economy, combat, assassination, projectile damage, scoring, AI ordering, quantities,
    and random-draw consumption.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)