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,29 @@
import { Container, ContainerIterator } from "../../ContainerBase";
export declare type HashLinkNode<K, V> = {
_key: K;
_value: V;
_pre: HashLinkNode<K, V>;
_next: HashLinkNode<K, V>;
};
export declare abstract class HashContainerIterator<K, V> extends ContainerIterator<K | [K, V]> {
abstract readonly container: HashContainer<K, V>;
pre(): this;
next(): this;
}
export declare abstract class HashContainer<K, V> extends Container<K | [K, V]> {
/**
* @description Unique symbol used to tag object.
*/
readonly HASH_TAG: symbol;
clear(): void;
/**
* @description Remove the element of the specified key.
* @param key - The key you want to remove.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns Whether erase successfully.
*/
eraseElementByKey(key: K, isObject?: boolean): boolean;
eraseElementByIterator(iter: HashContainerIterator<K, V>): HashContainerIterator<K, V>;
eraseElementByPos(pos: number): number;
}

View File

@ -0,0 +1,201 @@
var __extends = this && this.t || function() {
var extendStatics = function(t, i) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(t, i) {
t.__proto__ = i;
} || function(t, i) {
for (var r in i) if (Object.prototype.hasOwnProperty.call(i, r)) t[r] = i[r];
};
return extendStatics(t, i);
};
return function(t, i) {
if (typeof i !== "function" && i !== null) throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
extendStatics(t, i);
function __() {
this.constructor = t;
}
t.prototype = i === null ? Object.create(i) : (__.prototype = i.prototype, new __);
};
}();
import { Container, ContainerIterator } from "../../ContainerBase";
import checkObject from "../../../utils/checkObject";
import { throwIteratorAccessError } from "../../../utils/throwError";
var HashContainerIterator = function(t) {
__extends(HashContainerIterator, t);
function HashContainerIterator(i, r, e) {
var n = t.call(this, e) || this;
n.o = i;
n.h = r;
if (n.iteratorType === 0) {
n.pre = function() {
if (this.o.L === this.h) {
throwIteratorAccessError();
}
this.o = this.o.L;
return this;
};
n.next = function() {
if (this.o === this.h) {
throwIteratorAccessError();
}
this.o = this.o.m;
return this;
};
} else {
n.pre = function() {
if (this.o.m === this.h) {
throwIteratorAccessError();
}
this.o = this.o.m;
return this;
};
n.next = function() {
if (this.o === this.h) {
throwIteratorAccessError();
}
this.o = this.o.L;
return this;
};
}
return n;
}
return HashContainerIterator;
}(ContainerIterator);
export { HashContainerIterator };
var HashContainer = function(t) {
__extends(HashContainer, t);
function HashContainer() {
var i = t.call(this) || this;
i._ = [];
i.I = {};
i.HASH_TAG = Symbol("@@HASH_TAG");
Object.setPrototypeOf(i.I, null);
i.h = {};
i.h.L = i.h.m = i.H = i.l = i.h;
return i;
}
HashContainer.prototype.G = function(t) {
var i = t.L, r = t.m;
i.m = r;
r.L = i;
if (t === this.H) {
this.H = r;
}
if (t === this.l) {
this.l = i;
}
this.M -= 1;
};
HashContainer.prototype.v = function(t, i, r) {
if (r === undefined) r = checkObject(t);
var e;
if (r) {
var n = t[this.HASH_TAG];
if (n !== undefined) {
this._[n].p = i;
return this.M;
}
Object.defineProperty(t, this.HASH_TAG, {
value: this._.length,
configurable: true
});
e = {
u: t,
p: i,
L: this.l,
m: this.h
};
this._.push(e);
} else {
var s = this.I[t];
if (s) {
s.p = i;
return this.M;
}
e = {
u: t,
p: i,
L: this.l,
m: this.h
};
this.I[t] = e;
}
if (this.M === 0) {
this.H = e;
this.h.m = e;
} else {
this.l.m = e;
}
this.l = e;
this.h.L = e;
return ++this.M;
};
HashContainer.prototype.g = function(t, i) {
if (i === undefined) i = checkObject(t);
if (i) {
var r = t[this.HASH_TAG];
if (r === undefined) return this.h;
return this._[r];
} else {
return this.I[t] || this.h;
}
};
HashContainer.prototype.clear = function() {
var t = this.HASH_TAG;
this._.forEach((function(i) {
delete i.u[t];
}));
this._ = [];
this.I = {};
Object.setPrototypeOf(this.I, null);
this.M = 0;
this.H = this.l = this.h.L = this.h.m = this.h;
};
HashContainer.prototype.eraseElementByKey = function(t, i) {
var r;
if (i === undefined) i = checkObject(t);
if (i) {
var e = t[this.HASH_TAG];
if (e === undefined) return false;
delete t[this.HASH_TAG];
r = this._[e];
delete this._[e];
} else {
r = this.I[t];
if (r === undefined) return false;
delete this.I[t];
}
this.G(r);
return true;
};
HashContainer.prototype.eraseElementByIterator = function(t) {
var i = t.o;
if (i === this.h) {
throwIteratorAccessError();
}
this.G(i);
return t.next();
};
HashContainer.prototype.eraseElementByPos = function(t) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var i = this.H;
while (t--) {
i = i.m;
}
this.G(i);
return this.M;
};
return HashContainer;
}(Container);
export { HashContainer };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,49 @@
import { initContainer, IteratorType } from "../ContainerBase";
import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
declare class HashMapIterator<K, V> extends HashContainerIterator<K, V> {
readonly container: HashMap<K, V>;
constructor(node: HashLinkNode<K, V>, header: HashLinkNode<K, V>, container: HashMap<K, V>, iteratorType?: IteratorType);
get pointer(): [K, V];
copy(): HashMapIterator<K, V>;
equals(iter: HashMapIterator<K, V>): boolean;
}
export type { HashMapIterator };
declare class HashMap<K, V> extends HashContainer<K, V> {
constructor(container?: initContainer<[K, V]>);
begin(): HashMapIterator<K, V>;
end(): HashMapIterator<K, V>;
rBegin(): HashMapIterator<K, V>;
rEnd(): HashMapIterator<K, V>;
front(): [K, V] | undefined;
back(): [K, V] | undefined;
/**
* @description Insert a key-value pair or set value by the given key.
* @param key - The key want to insert.
* @param value - The value want to set.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns The size of container after setting.
*/
setElement(key: K, value: V, isObject?: boolean): number;
/**
* @description Get the value of the element of the specified key.
* @param key - The key want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @example
* const val = container.getElementByKey(1);
*/
getElementByKey(key: K, isObject?: boolean): V | undefined;
getElementByPos(pos: number): [K, V];
/**
* @description Check key if exist in container.
* @param key - The element you want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns An iterator pointing to the element if found, or super end if not found.
*/
find(key: K, isObject?: boolean): HashMapIterator<K, V>;
forEach(callback: (element: [K, V], index: number, hashMap: HashMap<K, V>) => void): void;
[Symbol.iterator](): Generator<[K, V], void, unknown>;
}
export default HashMap;

View File

@ -0,0 +1,248 @@
var __extends = this && this.t || function() {
var extendStatics = function(t, r) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(t, r) {
t.__proto__ = r;
} || function(t, r) {
for (var n in r) if (Object.prototype.hasOwnProperty.call(r, n)) t[n] = r[n];
};
return extendStatics(t, r);
};
return function(t, r) {
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
extendStatics(t, r);
function __() {
this.constructor = t;
}
t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
};
}();
var __generator = this && this.i || function(t, r) {
var n = {
label: 0,
sent: function() {
if (a[0] & 1) throw a[1];
return a[1];
},
trys: [],
ops: []
}, e, i, a, s;
return s = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, typeof Symbol === "function" && (s[Symbol.iterator] = function() {
return this;
}), s;
function verb(t) {
return function(r) {
return step([ t, r ]);
};
}
function step(s) {
if (e) throw new TypeError("Generator is already executing.");
while (n) try {
if (e = 1, i && (a = s[0] & 2 ? i["return"] : s[0] ? i["throw"] || ((a = i["return"]) && a.call(i),
0) : i.next) && !(a = a.call(i, s[1])).done) return a;
if (i = 0, a) s = [ s[0] & 2, a.value ];
switch (s[0]) {
case 0:
case 1:
a = s;
break;
case 4:
n.label++;
return {
value: s[1],
done: false
};
case 5:
n.label++;
i = s[1];
s = [ 0 ];
continue;
case 7:
s = n.ops.pop();
n.trys.pop();
continue;
default:
if (!(a = n.trys, a = a.length > 0 && a[a.length - 1]) && (s[0] === 6 || s[0] === 2)) {
n = 0;
continue;
}
if (s[0] === 3 && (!a || s[1] > a[0] && s[1] < a[3])) {
n.label = s[1];
break;
}
if (s[0] === 6 && n.label < a[1]) {
n.label = a[1];
a = s;
break;
}
if (a && n.label < a[2]) {
n.label = a[2];
n.ops.push(s);
break;
}
if (a[2]) n.ops.pop();
n.trys.pop();
continue;
}
s = r.call(t, n);
} catch (t) {
s = [ 6, t ];
i = 0;
} finally {
e = a = 0;
}
if (s[0] & 5) throw s[1];
return {
value: s[0] ? s[1] : void 0,
done: true
};
}
};
import { HashContainer, HashContainerIterator } from "./Base";
import checkObject from "../../utils/checkObject";
import { throwIteratorAccessError } from "../../utils/throwError";
var HashMapIterator = function(t) {
__extends(HashMapIterator, t);
function HashMapIterator(r, n, e, i) {
var a = t.call(this, r, n, i) || this;
a.container = e;
return a;
}
Object.defineProperty(HashMapIterator.prototype, "pointer", {
get: function() {
if (this.o === this.h) {
throwIteratorAccessError();
}
var t = this;
return new Proxy([], {
get: function(r, n) {
if (n === "0") return t.o.u; else if (n === "1") return t.o.p;
},
set: function(r, n, e) {
if (n !== "1") {
throw new TypeError("props must be 1");
}
t.o.p = e;
return true;
}
});
},
enumerable: false,
configurable: true
});
HashMapIterator.prototype.copy = function() {
return new HashMapIterator(this.o, this.h, this.container, this.iteratorType);
};
return HashMapIterator;
}(HashContainerIterator);
var HashMap = function(t) {
__extends(HashMap, t);
function HashMap(r) {
if (r === void 0) {
r = [];
}
var n = t.call(this) || this;
var e = n;
r.forEach((function(t) {
e.setElement(t[0], t[1]);
}));
return n;
}
HashMap.prototype.begin = function() {
return new HashMapIterator(this.H, this.h, this);
};
HashMap.prototype.end = function() {
return new HashMapIterator(this.h, this.h, this);
};
HashMap.prototype.rBegin = function() {
return new HashMapIterator(this.l, this.h, this, 1);
};
HashMap.prototype.rEnd = function() {
return new HashMapIterator(this.h, this.h, this, 1);
};
HashMap.prototype.front = function() {
if (this.M === 0) return;
return [ this.H.u, this.H.p ];
};
HashMap.prototype.back = function() {
if (this.M === 0) return;
return [ this.l.u, this.l.p ];
};
HashMap.prototype.setElement = function(t, r, n) {
return this.v(t, r, n);
};
HashMap.prototype.getElementByKey = function(t, r) {
if (r === undefined) r = checkObject(t);
if (r) {
var n = t[this.HASH_TAG];
return n !== undefined ? this._[n].p : undefined;
}
var e = this.I[t];
return e ? e.p : undefined;
};
HashMap.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var r = this.H;
while (t--) {
r = r.m;
}
return [ r.u, r.p ];
};
HashMap.prototype.find = function(t, r) {
var n = this.g(t, r);
return new HashMapIterator(n, this.h, this);
};
HashMap.prototype.forEach = function(t) {
var r = 0;
var n = this.H;
while (n !== this.h) {
t([ n.u, n.p ], r++, this);
n = n.m;
}
};
HashMap.prototype[Symbol.iterator] = function() {
return function() {
var t;
return __generator(this, (function(r) {
switch (r.label) {
case 0:
t = this.H;
r.label = 1;
case 1:
if (!(t !== this.h)) return [ 3, 3 ];
return [ 4, [ t.u, t.p ] ];
case 2:
r.sent();
t = t.m;
return [ 3, 1 ];
case 3:
return [ 2 ];
}
}));
}.bind(this)();
};
return HashMap;
}(HashContainer);
export default HashMap;
//# sourceMappingURL=HashMap.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,39 @@
import { initContainer, IteratorType } from "../ContainerBase";
import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
declare class HashSetIterator<K> extends HashContainerIterator<K, undefined> {
readonly container: HashSet<K>;
constructor(node: HashLinkNode<K, undefined>, header: HashLinkNode<K, undefined>, container: HashSet<K>, iteratorType?: IteratorType);
get pointer(): K;
copy(): HashSetIterator<K>;
equals(iter: HashSetIterator<K>): boolean;
}
export type { HashSetIterator };
declare class HashSet<K> extends HashContainer<K, undefined> {
constructor(container?: initContainer<K>);
begin(): HashSetIterator<K>;
end(): HashSetIterator<K>;
rBegin(): HashSetIterator<K>;
rEnd(): HashSetIterator<K>;
front(): K | undefined;
back(): K | undefined;
/**
* @description Insert element to set.
* @param key - The key want to insert.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns The size of container after inserting.
*/
insert(key: K, isObject?: boolean): number;
getElementByPos(pos: number): K;
/**
* @description Check key if exist in container.
* @param key - The element you want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns An iterator pointing to the element if found, or super end if not found.
*/
find(key: K, isObject?: boolean): HashSetIterator<K>;
forEach(callback: (element: K, index: number, container: HashSet<K>) => void): void;
[Symbol.iterator](): Generator<K, void, unknown>;
}
export default HashSet;

View File

@ -0,0 +1,223 @@
var __extends = this && this.t || function() {
var extendStatics = function(t, r) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(t, r) {
t.__proto__ = r;
} || function(t, r) {
for (var e in r) if (Object.prototype.hasOwnProperty.call(r, e)) t[e] = r[e];
};
return extendStatics(t, r);
};
return function(t, r) {
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
extendStatics(t, r);
function __() {
this.constructor = t;
}
t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
};
}();
var __generator = this && this.i || function(t, r) {
var e = {
label: 0,
sent: function() {
if (s[0] & 1) throw s[1];
return s[1];
},
trys: [],
ops: []
}, n, i, s, a;
return a = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, typeof Symbol === "function" && (a[Symbol.iterator] = function() {
return this;
}), a;
function verb(t) {
return function(r) {
return step([ t, r ]);
};
}
function step(a) {
if (n) throw new TypeError("Generator is already executing.");
while (e) try {
if (n = 1, i && (s = a[0] & 2 ? i["return"] : a[0] ? i["throw"] || ((s = i["return"]) && s.call(i),
0) : i.next) && !(s = s.call(i, a[1])).done) return s;
if (i = 0, s) a = [ a[0] & 2, s.value ];
switch (a[0]) {
case 0:
case 1:
s = a;
break;
case 4:
e.label++;
return {
value: a[1],
done: false
};
case 5:
e.label++;
i = a[1];
a = [ 0 ];
continue;
case 7:
a = e.ops.pop();
e.trys.pop();
continue;
default:
if (!(s = e.trys, s = s.length > 0 && s[s.length - 1]) && (a[0] === 6 || a[0] === 2)) {
e = 0;
continue;
}
if (a[0] === 3 && (!s || a[1] > s[0] && a[1] < s[3])) {
e.label = a[1];
break;
}
if (a[0] === 6 && e.label < s[1]) {
e.label = s[1];
s = a;
break;
}
if (s && e.label < s[2]) {
e.label = s[2];
e.ops.push(a);
break;
}
if (s[2]) e.ops.pop();
e.trys.pop();
continue;
}
a = r.call(t, e);
} catch (t) {
a = [ 6, t ];
i = 0;
} finally {
n = s = 0;
}
if (a[0] & 5) throw a[1];
return {
value: a[0] ? a[1] : void 0,
done: true
};
}
};
import { HashContainer, HashContainerIterator } from "./Base";
import { throwIteratorAccessError } from "../../utils/throwError";
var HashSetIterator = function(t) {
__extends(HashSetIterator, t);
function HashSetIterator(r, e, n, i) {
var s = t.call(this, r, e, i) || this;
s.container = n;
return s;
}
Object.defineProperty(HashSetIterator.prototype, "pointer", {
get: function() {
if (this.o === this.h) {
throwIteratorAccessError();
}
return this.o.u;
},
enumerable: false,
configurable: true
});
HashSetIterator.prototype.copy = function() {
return new HashSetIterator(this.o, this.h, this.container, this.iteratorType);
};
return HashSetIterator;
}(HashContainerIterator);
var HashSet = function(t) {
__extends(HashSet, t);
function HashSet(r) {
if (r === void 0) {
r = [];
}
var e = t.call(this) || this;
var n = e;
r.forEach((function(t) {
n.insert(t);
}));
return e;
}
HashSet.prototype.begin = function() {
return new HashSetIterator(this.H, this.h, this);
};
HashSet.prototype.end = function() {
return new HashSetIterator(this.h, this.h, this);
};
HashSet.prototype.rBegin = function() {
return new HashSetIterator(this.l, this.h, this, 1);
};
HashSet.prototype.rEnd = function() {
return new HashSetIterator(this.h, this.h, this, 1);
};
HashSet.prototype.front = function() {
return this.H.u;
};
HashSet.prototype.back = function() {
return this.l.u;
};
HashSet.prototype.insert = function(t, r) {
return this.v(t, undefined, r);
};
HashSet.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var r = this.H;
while (t--) {
r = r.m;
}
return r.u;
};
HashSet.prototype.find = function(t, r) {
var e = this.g(t, r);
return new HashSetIterator(e, this.h, this);
};
HashSet.prototype.forEach = function(t) {
var r = 0;
var e = this.H;
while (e !== this.h) {
t(e.u, r++, this);
e = e.m;
}
};
HashSet.prototype[Symbol.iterator] = function() {
return function() {
var t;
return __generator(this, (function(r) {
switch (r.label) {
case 0:
t = this.H;
r.label = 1;
case 1:
if (!(t !== this.h)) return [ 3, 3 ];
return [ 4, t.u ];
case 2:
r.sent();
t = t.m;
return [ 3, 1 ];
case 3:
return [ 2 ];
}
}));
}.bind(this)();
};
return HashSet;
}(HashContainer);
export default HashSet;
//# sourceMappingURL=HashSet.js.map

File diff suppressed because one or more lines are too long