Skip to content

Commit

Permalink
Removed Generic Types
Browse files Browse the repository at this point in the history
  • Loading branch information
IllusiveBagel committed Mar 27, 2022
1 parent a440e81 commit bf123d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib/Creature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 5 additions & 7 deletions src/lib/Interfaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ICreature {
velocity: IVector;
acceleration: IVector;
color: string;
moveTo: AnyAnyFunction;
moveTo: NumberArrayFunction;
draw: VoidFunction;
update: VoidFunction;
applyForce: VectorVoidFunction;
Expand Down Expand Up @@ -54,7 +54,7 @@ export interface IVector {
dot: VectorNumberFunction;
lerp: VectorNumberVectorFunction;
dist: VectorNumberFunction;
copy: AnyFunction;
copy: VectorFunction;
random: VectorFunction;
}

Expand All @@ -63,19 +63,17 @@ 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;

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;

Expand Down

0 comments on commit bf123d5

Please sign in to comment.