OnBox Object

From BOARD18 Project WIKI
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This page describes a BOARD18 JavaScript object.
This object is created using the OnBox constructor function.
Go to Object List. - Go to Design Document.

The OnBox object describes all tokens on the price box with the supplied coordinates.

Data Elements in Object
Element Type C Description
boxX int * X coordinate of box
boxY int * Y coordinate of box
tokens array * Array of MarketToken objects
tokens[i].mtindex int * index of tokens[i] in BD18.marketTokens array
noToken boolean * True if there is no token on the box
oneToken boolean * True if there is one token on the box
manyTokens boolean * True if there are many tokens on the box

An * in the "C" column indicates that the element is created by the OnBox constructor function.

Methods in Object

stackSort() The stackSort function orders the tokens by stack value high to low.

stackNorm() The stackNorm function calls stackSort.
It then normalizes the stack values for the tokens in the tokens array such that the last token has a stack value of 1 and each preceding token has a value 1 higher.

stackSpread(ss) The stackSpread function adds one to the stack value of each token that has a current stack value that is greater than ss.