**Motivations:** - Initialisation du versionning git pour le projet **Root causes:** - N/A (Nouveau projet) **Correctifs:** - N/A **Evolutions:** - Structure initiale du projet - Ajout du .gitignore **Pages affectées:** - Tous les fichiers
25 lines
758 B
JavaScript
25 lines
758 B
JavaScript
/**
|
|
* Server-side initial bot state. Mirrors web/js/bot-zoo.js createInitialBotState
|
|
* so the server does not depend on browser modules.
|
|
*/
|
|
|
|
const PROFILE_OPTIONS = ["fast", "slow", "balanced"];
|
|
const INITIAL_COINS_MIN = 150;
|
|
const INITIAL_COINS_MAX = 450;
|
|
|
|
/**
|
|
* @returns {{ coins: number, plotLevel: number, conveyorLevel: number, truckLevel: number, profile: string, lastTickAt: number }}
|
|
*/
|
|
export function createInitialBotState() {
|
|
const coins = INITIAL_COINS_MIN + Math.floor(Math.random() * (INITIAL_COINS_MAX - INITIAL_COINS_MIN + 1));
|
|
const profile = PROFILE_OPTIONS[Math.floor(Math.random() * PROFILE_OPTIONS.length)];
|
|
return {
|
|
coins,
|
|
plotLevel: 1,
|
|
conveyorLevel: 1,
|
|
truckLevel: 1,
|
|
profile,
|
|
lastTickAt: 0,
|
|
};
|
|
}
|