BotRegistry

dicechess.engine.search.BotRegistry
object BotRegistry

Central registry for all available search algorithms in the engine.

Attributes

Source
BotRegistry.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final class Registration extends AutoCloseable

A live registration created by registerCustomBot. Closing it removes the entry from the registry and, if the registered algorithm is itself java.lang.AutoCloseable (e.g. an ONNX bot holding a native onnxruntime session), closes the algorithm too — pairing the two by construction instead of leaving the caller to remember both halves (#589).

A live registration created by registerCustomBot. Closing it removes the entry from the registry and, if the registered algorithm is itself java.lang.AutoCloseable (e.g. an ONNX bot holding a native onnxruntime session), closes the algorithm too — pairing the two by construction instead of leaving the caller to remember both halves (#589).

Closing is a no-op on the registry side if id has since been replaced by another registration: a stale handle carries its own registration token and can only remove the exact entry it created, never a newer one — even one that happens to share both the id and the algorithm instance (e.g. the same singleton bot registered twice). Removal is guarded by the same lock registerCustomBot writes under, so a concurrent registration and close cannot race on bots. Closing more than once is safe: only the first call removes the entry or closes algorithm.

Attributes

Source
BotRegistry.scala
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Value members

Concrete methods

def availableBots: List[BotInfo]

Returns all available bots sorted by difficulty, including any registered via registerCustomBot.

Returns all available bots sorted by difficulty, including any registered via registerCustomBot.

Attributes

Source
BotRegistry.scala

Returns the default algorithm (Greedy).

Returns the default algorithm (Greedy).

Attributes

Source
BotRegistry.scala
def getAlgorithm(id: String): Option[SearchAlgorithm]

Looks up a search algorithm by its bot ID.

Looks up a search algorithm by its bot ID.

Value parameters

id

The bot ID to lookup (case-insensitive)

Attributes

Returns

The algorithm if found, or None.

Source
BotRegistry.scala

Registers (or replaces) a bot at runtime under info.id, used to add decorator bots such as an OpeningBookBot supplied by a host application (the JS API's registerOpeningBookBot).

Registers (or replaces) a bot at runtime under info.id, used to add decorator bots such as an OpeningBookBot supplied by a host application (the JS API's registerOpeningBookBot).

The registry is a process-wide singleton. Writes are synchronized and bots is @volatile, so a registration is published safely to concurrent readers (availableBots / getAlgorithm) on the JVM; it is still intended for host setup (e.g. a JS worker boot) rather than a high-churn write path.

Value parameters

algorithm

the search algorithm to register

info

metadata for the bot; info.id is the lookup key (lower-cased)

Attributes

Returns

a Registration handle; close it (e.g. via scala.util.Using) to remove the entry and close algorithm if it owns a closeable resource. Discarding the handle is equivalent to the old permanent-registration behavior.

Source
BotRegistry.scala
def registerTacticianBot(config: TacticianConfig, newBotId: String, newBotName: String): Option[Registration]

Registers a host-configured TacticianSearch under an unused, case-insensitive id. Returns a removable registration on success, or None for a missing profile, blank identity or occupied id. Checking and installing the id happen under the same lock, so concurrent setup cannot replace an existing opponent.

Registers a host-configured TacticianSearch under an unused, case-insensitive id. Returns a removable registration on success, or None for a missing profile, blank identity or occupied id. Checking and installing the id happen under the same lock, so concurrent setup cannot replace an existing opponent.

There is no built-in profile: hosts supply the work limit and evaluation weights explicitly.

Attributes

Source
BotRegistry.scala