Rename Movements to Journal
This commit is contained in:
parent
1c96ea31ad
commit
86dc009231
@ -16,8 +16,8 @@ export default class Daemon {
|
|||||||
this.epsilon = epsilon;
|
this.epsilon = epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
predict(movements) {
|
predict(journal) {
|
||||||
const steps = this._getStepSlice(movements);
|
const steps = this._getStepSlice(journal);
|
||||||
const w0 = this._getWeight([...steps, 0]);
|
const w0 = this._getWeight([...steps, 0]);
|
||||||
const w1 = this._getWeight([...steps, 1]);
|
const w1 = this._getWeight([...steps, 1]);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Move from './Move';
|
import Move from './Move';
|
||||||
|
|
||||||
export default class Movements {
|
export default class Journal {
|
||||||
moves = [];
|
moves = [];
|
||||||
|
|
||||||
constructor(moves = []) {
|
constructor(moves = []) {
|
@ -1,4 +1,4 @@
|
|||||||
import Movements from './Movements';
|
import History from './Journal';
|
||||||
import Supervisor from './Supervisor';
|
import Supervisor from './Supervisor';
|
||||||
|
|
||||||
export default class Predictor {
|
export default class Predictor {
|
||||||
@ -7,7 +7,7 @@ export default class Predictor {
|
|||||||
score = 0;
|
score = 0;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.movements = new Movements();
|
this.movements = new History();
|
||||||
this.supervisor = new Supervisor();
|
this.supervisor = new Supervisor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import Daemon from '../source/Daemon';
|
import Daemon from '../source/Daemon';
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
import Movements from '../source/Movements';
|
import History from '../source/Journal';
|
||||||
|
|
||||||
test('Get prediction for beginning', function() {
|
test('Get prediction for beginning', function() {
|
||||||
const m = new Movements();
|
const m = new History();
|
||||||
const d = new Daemon(1, 1);
|
const d = new Daemon(1, 1);
|
||||||
expect(d.predict(m)).toEqual(0);
|
expect(d.predict(m)).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Daemon 1-1', function() {
|
test('Daemon 1-1', function() {
|
||||||
const m = new Movements();
|
const m = new History();
|
||||||
const d = new Daemon(1, 1);
|
const d = new Daemon(1, 1);
|
||||||
|
|
||||||
const step_slice = s => {
|
const step_slice = s => {
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
import Movements from '../source/Movements';
|
import Journal from '../source/Journal';
|
||||||
import Move from '../source/Move';
|
import Move from '../source/Move';
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
test('Create with empty constructor', function() {
|
test('Create with empty constructor', function() {
|
||||||
const m = new Movements();
|
const m = new Journal();
|
||||||
expect(m.getLastMovements(5, 5)).toEqual([]);
|
expect(m.getLastMovements(5, 5)).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Constructor with human steps', function() {
|
test('Constructor with human steps', function() {
|
||||||
const m = new Movements([new Move(1, 1)]);
|
const m = new Journal([new Move(1, 1)]);
|
||||||
expect(m.getLastMovements(5, 5)).toEqual([1, 1]);
|
expect(m.getLastMovements(5, 5)).toEqual([1, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Make steps', function() {
|
test('Make steps', function() {
|
||||||
const m = new Movements();
|
const m = new Journal();
|
||||||
m.makeMove(1, 0);
|
m.makeMove(1, 0);
|
||||||
expect(m.getLastMovements(5, 5)).toEqual([0, 1]);
|
expect(m.getLastMovements(5, 5)).toEqual([0, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Get slice', function() {
|
test('Get slice', function() {
|
||||||
const m = new Movements([
|
const m = new Journal([
|
||||||
new Move(1, 1),
|
new Move(1, 1),
|
||||||
new Move(0, 1),
|
new Move(0, 1),
|
||||||
new Move(0, 1),
|
new Move(0, 1),
|
Loading…
Reference in New Issue
Block a user