From bf123d5fc2fed28ff00204ecd190c695b6e37675 Mon Sep 17 00:00:00 2001 From: IllusiveBagel Date: Sun, 27 Mar 2022 22:58:03 +0100 Subject: [PATCH] Removed Generic Types --- src/lib/Creature.tsx | 2 +- src/lib/Interfaces.tsx | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/Creature.tsx b/src/lib/Creature.tsx index ba20085..e628a3f 100644 --- a/src/lib/Creature.tsx +++ b/src/lib/Creature.tsx @@ -35,7 +35,7 @@ export class Creature implements ICreature { this.color = "#0066ff"; } - moveTo(networkOutput: any) { + moveTo(networkOutput: number[]) { var force = new Vector(0, 0); var target = new Vector(networkOutput[0] * this.world.width, networkOutput[1] * this.world.height); diff --git a/src/lib/Interfaces.tsx b/src/lib/Interfaces.tsx index 4ee326c..e0f7a2c 100644 --- a/src/lib/Interfaces.tsx +++ b/src/lib/Interfaces.tsx @@ -24,7 +24,7 @@ export interface ICreature { velocity: IVector; acceleration: IVector; color: string; - moveTo: AnyAnyFunction; + moveTo: NumberArrayFunction; draw: VoidFunction; update: VoidFunction; applyForce: VectorVoidFunction; @@ -54,7 +54,7 @@ export interface IVector { dot: VectorNumberFunction; lerp: VectorNumberVectorFunction; dist: VectorNumberFunction; - copy: AnyFunction; + copy: VectorFunction; random: VectorFunction; } @@ -63,7 +63,7 @@ type CoordinateVectorFunction = (x: number, y: number) => IVector; type VectorVectorFunction = (v: IVector) => IVector; -type NumberVectorFunction = (s: number) => IVector; +type NumberVectorFunction = (n: number) => IVector; type NumberFunction = () => number; @@ -71,11 +71,9 @@ type VectorFunction = () => IVector; type VectorNumberFunction = (v: IVector) => number; -type VectorNumberVectorFunction = (v: IVector, amt: number) => IVector; +type VectorNumberVectorFunction = (v: IVector, n: number) => IVector; -type AnyFunction = () => any; - -type AnyAnyFunction = (a: any) => any; +type NumberArrayFunction = (n: number[]) => void; type VoidFunction = () => void;