Initial commit
**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
This commit is contained in:
24
server/bot-state.js
Normal file
24
server/bot-state.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user