enum and fixed products generation

This commit is contained in:
Robert Bendun 2021-04-19 14:34:20 +02:00
parent 5653fa6b02
commit 46156f34b8
3 changed files with 11 additions and 5 deletions

View File

@ -8,10 +8,7 @@
* @property {IPosition} position
*/
const PATHFINDING_ACTION = {
ROTATE: 0,
MOVE: 1,
}
const PATHFINDING_ACTION = Enum('ROTATE', 'MOVE')
class Pathfinding {

View File

@ -11,7 +11,7 @@ class Products {
const gridProductsAmountColumn = []
for (let j = 0; j < 9; ++j) {
if (j % 3 != 1) {
if (j % 3 !== 1 && i % 7 !== 0) {
gridProductsColumn.push(Product.RANDOM_FROM_REGISTRY());
gridProductsAmountColumn.push(floor(random() * 51));
} else {

View File

@ -32,3 +32,12 @@ function waitFor(miliseconds) {
setTimeout(() => resolve(), miliseconds);
})
}
function Enum(...labels) {
const e = {}
let i = 0
for (const label of labels) {
e[e[label] = i] = label;
}
return e
}