Tracking de l'application VApp (IHM du jeu)

This commit is contained in:
2025-05-11 18:04:12 +02:00
commit 89e9db9b62
17763 changed files with 3718499 additions and 0 deletions

View File

@ -0,0 +1,3 @@
import { TAddUniqueNumberFactory } from '../types';
export declare const createAddUniqueNumber: TAddUniqueNumberFactory;
//# sourceMappingURL=add-unique-number.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"add-unique-number.d.ts","sourceRoot":"","sources":["../../../src/factories/add-unique-number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,qBAAqB,EAAE,uBAQnC,CAAC"}

View File

@ -0,0 +1,8 @@
export const createAddUniqueNumber = (generateUniqueNumber) => {
return (set) => {
const number = generateUniqueNumber(set);
set.add(number);
return number;
};
};
//# sourceMappingURL=add-unique-number.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"add-unique-number.js","sourceRoot":"","sources":["../../../src/factories/add-unique-number.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAA4B,CAAC,oBAAoB,EAAE,EAAE;IACnF,OAAO,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAEzC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEhB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC,CAAC"}

View File

@ -0,0 +1,3 @@
import { TCacheFactory } from '../types';
export declare const createCache: TCacheFactory;
//# sourceMappingURL=cache.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/factories/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,WAAW,EAAE,aAMzB,CAAC"}

View File

@ -0,0 +1,7 @@
export const createCache = (lastNumberWeakMap) => {
return (collection, nextNumber) => {
lastNumberWeakMap.set(collection, nextNumber);
return nextNumber;
};
};
//# sourceMappingURL=cache.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/factories/cache.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAkB,CAAC,iBAAiB,EAAE,EAAE;IAC5D,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE;QAC9B,iBAAiB,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAE9C,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAC"}

View File

@ -0,0 +1,3 @@
import { TGenerateUniqueNumberFactory } from '../types';
export declare const createGenerateUniqueNumber: TGenerateUniqueNumberFactory;
//# sourceMappingURL=generate-unique-number.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"generate-unique-number.d.ts","sourceRoot":"","sources":["../../../src/factories/generate-unique-number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAUxD,eAAO,MAAM,0BAA0B,EAAE,4BA4CxC,CAAC"}

View File

@ -0,0 +1,46 @@
/*
* The value of the constant Number.MAX_SAFE_INTEGER equals (2 ** 53 - 1) but it
* is fairly new.
*/
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
export const createGenerateUniqueNumber = (cache, lastNumberWeakMap) => {
return (collection) => {
const lastNumber = lastNumberWeakMap.get(collection);
/*
* Let's try the cheapest algorithm first. It might fail to produce a new
* number, but it is so cheap that it is okay to take the risk. Just
* increase the last number by one or reset it to 0 if we reached the upper
* bound of SMIs (which stands for small integers). When the last number is
* unknown it is assumed that the collection contains zero based consecutive
* numbers.
*/
let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
if (!collection.has(nextNumber)) {
return cache(collection, nextNumber);
}
/*
* If there are less than half of 2 ** 30 numbers stored in the collection,
* the chance to generate a new random number in the range from 0 to 2 ** 30
* is at least 50%. It's benifitial to use only SMIs because they perform
* much better in any environment based on V8.
*/
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
}
return cache(collection, nextNumber);
}
// Quickly check if there is a theoretical chance to generate a new number.
if (collection.size > MAX_SAFE_INTEGER) {
throw new Error('Congratulations, you created a collection of unique numbers which uses all available integers!');
}
// Otherwise use the full scale of safely usable integers.
while (collection.has(nextNumber)) {
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
}
return cache(collection, nextNumber);
};
};
//# sourceMappingURL=generate-unique-number.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"generate-unique-number.js","sourceRoot":"","sources":["../../../src/factories/generate-unique-number.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAC5G,MAAM,+BAA+B,GAAG,SAAS,CAAC;AAClD,MAAM,0BAA0B,GAAG,+BAA+B,GAAG,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,0BAA0B,GAAiC,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAAE;IACjG,OAAO,CAAC,UAAU,EAAE,EAAE;QAClB,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAErD;;;;;;;WAOG;QACH,IAAI,UAAU,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,GAAG,0BAA0B,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3H,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACzC,CAAC;QAED;;;;;WAKG;QACH,IAAI,UAAU,CAAC,IAAI,GAAG,+BAA+B,EAAE,CAAC;YACpD,OAAO,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,0BAA0B,CAAC,CAAC;YACxE,CAAC;YAED,OAAO,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACzC,CAAC;QAED,2EAA2E;QAC3E,IAAI,UAAU,CAAC,IAAI,GAAG,gBAAgB,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;QACtH,CAAC;QAED,0DAA0D;QAC1D,OAAO,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC,CAAC;AACN,CAAC,CAAC"}

View File

@ -0,0 +1,5 @@
export * from './types/index';
declare const generateUniqueNumber: import("./types/generate-unique-number-function").TGenerateUniqueNumberFunction;
declare const addUniqueNumber: import("./types/add-unique-number-function").TAddUniqueNumberFunction;
export { addUniqueNumber, generateUniqueNumber };
//# sourceMappingURL=module.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAQA,cAAc,eAAe,CAAC;AAK9B,QAAA,MAAM,oBAAoB,iFAA0D,CAAC;AACrF,QAAA,MAAM,eAAe,uEAA8C,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"}

View File

@ -0,0 +1,14 @@
import { createAddUniqueNumber } from './factories/add-unique-number';
import { createCache } from './factories/cache';
import { createGenerateUniqueNumber } from './factories/generate-unique-number';
/*
* @todo Explicitly referencing the barrel file seems to be necessary when enabling the
* isolatedModules compiler option.
*/
export * from './types/index';
const LAST_NUMBER_WEAK_MAP = new WeakMap();
const cache = createCache(LAST_NUMBER_WEAK_MAP);
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
const addUniqueNumber = createAddUniqueNumber(generateUniqueNumber);
export { addUniqueNumber, generateUniqueNumber };
//# sourceMappingURL=module.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF;;;GAGG;AACH,cAAc,eAAe,CAAC;AAE9B,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAA0C,CAAC;AAEnF,MAAM,KAAK,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAChD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;AACrF,MAAM,eAAe,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"}

View File

@ -0,0 +1,4 @@
import { TAddUniqueNumberFunction } from './add-unique-number-function';
import { TGenerateUniqueNumberFunction } from './generate-unique-number-function';
export type TAddUniqueNumberFactory = (generateUniqueNumber: TGenerateUniqueNumberFunction) => TAddUniqueNumberFunction;
//# sourceMappingURL=add-unique-number-factory.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"add-unique-number-factory.d.ts","sourceRoot":"","sources":["../../../src/types/add-unique-number-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF,MAAM,MAAM,uBAAuB,GAAG,CAAC,oBAAoB,EAAE,6BAA6B,KAAK,wBAAwB,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=add-unique-number-factory.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"add-unique-number-factory.js","sourceRoot":"","sources":["../../../src/types/add-unique-number-factory.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,2 @@
export type TAddUniqueNumberFunction = (set: Set<number>) => number;
//# sourceMappingURL=add-unique-number-function.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"add-unique-number-function.d.ts","sourceRoot":"","sources":["../../../src/types/add-unique-number-function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=add-unique-number-function.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"add-unique-number-function.js","sourceRoot":"","sources":["../../../src/types/add-unique-number-function.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
import { TCacheFunction } from './cache-function';
export type TCacheFactory = (lastNumberWeakMap: WeakMap<Map<number, any> | Set<number>, number>) => TCacheFunction;
//# sourceMappingURL=cache-factory.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"cache-factory.d.ts","sourceRoot":"","sources":["../../../src/types/cache-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,cAAc,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=cache-factory.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"cache-factory.js","sourceRoot":"","sources":["../../../src/types/cache-factory.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,2 @@
export type TCacheFunction = (collection: Map<number, any> | Set<number>, nextNumber: number) => number;
//# sourceMappingURL=cache-function.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"cache-function.d.ts","sourceRoot":"","sources":["../../../src/types/cache-function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=cache-function.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"cache-function.js","sourceRoot":"","sources":["../../../src/types/cache-function.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,4 @@
import { TCacheFunction } from './cache-function';
import { TGenerateUniqueNumberFunction } from './generate-unique-number-function';
export type TGenerateUniqueNumberFactory = (cache: TCacheFunction, lastNumberWeakMap: WeakMap<Map<number, any> | Set<number>, number>) => TGenerateUniqueNumberFunction;
//# sourceMappingURL=generate-unique-number-factory.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"generate-unique-number-factory.d.ts","sourceRoot":"","sources":["../../../src/types/generate-unique-number-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF,MAAM,MAAM,4BAA4B,GAAG,CACvC,KAAK,EAAE,cAAc,EACrB,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,KACjE,6BAA6B,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=generate-unique-number-factory.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"generate-unique-number-factory.js","sourceRoot":"","sources":["../../../src/types/generate-unique-number-factory.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,2 @@
export type TGenerateUniqueNumberFunction = (collection: Map<number, any> | Set<number>) => number;
//# sourceMappingURL=generate-unique-number-function.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"generate-unique-number-function.d.ts","sourceRoot":"","sources":["../../../src/types/generate-unique-number-function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=generate-unique-number-function.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"generate-unique-number-function.js","sourceRoot":"","sources":["../../../src/types/generate-unique-number-function.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,7 @@
export * from './add-unique-number-factory';
export * from './add-unique-number-function';
export * from './cache-factory';
export * from './cache-function';
export * from './generate-unique-number-factory';
export * from './generate-unique-number-function';
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC"}

View File

@ -0,0 +1,7 @@
export * from './add-unique-number-factory';
export * from './add-unique-number-function';
export * from './cache-factory';
export * from './cache-function';
export * from './generate-unique-number-factory';
export * from './generate-unique-number-function';
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC"}