MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / AIAction

Class AIAction

Brain.js:1–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class AIAction {
2 constructor(isJump, holdTime, xDirection) {
3 this.isJump = isJump;
4 this.holdTime = holdTime;//number between 0 and 1
5 this.xDirection = xDirection;
6
7 }
8
9 clone() {
10 return new AIAction(this.isJump, this.holdTime, this.xDirection);
11 }
12
13 mutate() {
14 this.holdTime += random(-0.3,0.3);
15 this.holdTime = constrain(this.holdTime,0.1,1);
16 }
17}
18
19
20// let jumpChance = 0; //the chance that a random action is a jump

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected