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

Method getRandomAction

Brain.js:41–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39 }
40
41 getRandomAction() {
42 let isJump = false;
43
44 if (random() > jumpChance) {
45 isJump = true;
46 }
47
48 let holdTime = random(0.1, 1);
49 if(random()<chanceOfFullJump){
50 holdTime = 1;
51 }
52
53
54 let directions = [-1, -1, -1, 0, 1, 1, 1]
55 let xDirection = random(directions)
56
57
58 return new AIAction(isJump, holdTime, xDirection)
59 }
60
61 getNextAction() {
62 if(this.currentInstructionNumber >= this.instructions.length){

Callers 4

randomizeMethod · 0.95
mutateMethod · 0.95
mutateActionNumberMethod · 0.95
increaseMovesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected