forked from ayberkydn/haxRL
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAgent.js
24 lines (22 loc) · 803 Bytes
/
Agent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Agent {
constructor() {
this.side = null;
this.env = null;
this.goal = null;
this.ball = null;
this.player = null;
this.opponent = null;
}
setSide(side) {
this.side = side;
let startX = (side == Side.red) ? 120 : cWidth - 120;
let color = (side == Side.red) ? Color.red : Color.blue;
this.player = new Player(startX, cHeight / 2, playerRadius, playerMass, playerRestitution, playerDamping, playerkickDamping, playerkickPower, color);
this.player.agent = this;
this.goal = this.env.scene.metaObjects.goals[side == Side.red ? 0 : 1];
this.forwardVec = side == Side.red ? Vector.Unit.right : Vector.Unit.left;
this.upVec = Vector.Unit.up;
}
act() {}
learn() {}
}