ai newsMi., 25. Nov.
EilmeldungEpochal launches with $100M to help developers train predictive AI models

A browser chess or board-game AI still ships its evaluation function and opening book

Browser chess, go, and other board-game sites often advertise a "strong built-in engine". The move arrives instantly, there is no server round-trip, and it works on a plane. That usually means the evaluation function, search heuristics, and a compressed opening book are sitting in the JavaScript bu

dev.toMittwoch 02:09 · 25.11.2 Min. Lesezeit
Bild: dev.to

If you spent months tuning piece-square tables, mobility weights, or a book of prepared lines, every visitor — including a competing site — can take them.

Open DevTools on a typical in-browser engine and you will find more than a UI:

None of this needs to be a neural net to be worth stealing. A carefully tuned evaluation of a few kilobytes is enough to make a free widget feel premium.

Attackers do not re-implement alpha-beta. They pretty-print the bundle and look for arrays of 64 numbers, centipawn constants, or strings from well-known opening names.

Here is the kind of function that is copied almost unchanged:

const PST_MG = { p: [ /* 64 midgame pawn scores */ ], n: [ /*... */ ] }; const BOOK = { "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3": [ "c7c5", "e7e5" ] }; export function evaluate ( pos ) { let score = 0; for ( const p of pos. pieces ) { const pst = pos. phase > 0.5? PST_MG [ p. type ]: PST_EG [ p. type ]; score += ( p. color === "w"? 1: - 1 ) * ( MATERIAL [ p. type ] + pst [ p. sq ] ); } return score + mobility ( pos ) * 6 + kingSafety ( pos ) * 12; } Enter fullscreen mode Exit fullscreen mode Once evaluate and BOOK are in a competitor's repo, your "unique" engine is a skin away from being theirs. Difficulty calibration is usually a thin wrapper around the same function, so even your casual mode leaks.

Offline mode and "instant analysis" still need a local function. For that chunk:

If a "win" is granted because the local engine resigned, anyone can hook evaluate and force a resignation. Official ratings must come from a server that ran, or at least verified, the game.

An in-browser chess AI ships the work that makes it strong: the evaluation, the search policy, and often the book. Run official games on the server, protect the offline engine you have to ship, and stop pretending that a hidden evaluate function is a competitive moat.

Quelle: dev.to (dev.to). Original öffnen