UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

48 lines (42 loc) 1.3 kB
import { assert } from "../../../core/assert.js"; import { ActionSequence } from "./ActionSequence.js"; /** * @template A * A bid represents a tactical action. As such, it is atomic, either all required resources are allocated, or none. * * @author Alex Goldring * @copyright Company Named Limited (c) 2025 */ export class ResourceAllocationBid { /** * @template A * @param {ResourceAllocation} allocation * @param {number} value */ constructor(allocation, value) { assert.defined(allocation, 'allocation'); assert.notNull(allocation, 'allocation'); assert.isNumber(value, 'value'); /** * * @type {ResourceAllocation} */ this.allocation = allocation; /** * Perceived value of a bid from perspective of the bidder. Must be normalized to value between 0 and 1 * @type {number} */ this.value = value; /** * Represents action * @readonly * @type {ActionSequence<A>} */ this.actions = new ActionSequence(); /** * Weight assigned to the bid, this is dictated externally * @type {number} */ this.weight = 1; } }