Add base and format code

This commit is contained in:
2018-06-30 17:21:27 +03:00
parent 065e325b26
commit cb96183a7d
10 changed files with 240 additions and 43 deletions

View File

@ -1,21 +1,21 @@
import Daemon from '../source/Daemon';
import expect from 'expect';
import History from '../source/Journal';
import Daemon from '../source/Daemon';
import Journal from '../source/Journal';
test('Get prediction for beginning', function() {
const m = new History();
const d = new Daemon(1, 1);
const m = new Journal();
const d = new Daemon(2, 1, 1);
expect(d.predict(m)).toEqual(0);
});
test('Can get power', function() {
const d = new Daemon(5, 8);
const d = new Daemon(2, 5, 8);
expect(d.power).toEqual(13);
});
test('Daemon 1-1', function() {
const m = new History();
const d = new Daemon(1, 1);
const m = new Journal();
const d = new Daemon(2, 1, 1);
const steps = [
{
@ -40,11 +40,10 @@ test('Daemon 1-1', function() {
},
];
steps.forEach((step, index) => {
steps.forEach(step => {
const prediction = d.predict(m);
expect(prediction).toEqual(step.prediction);
d.adjust(m, step.human, index + 1);
d.adjust(m, step.human);
m.makeMove(step.human, step.prediction);
console.log('Step', index + 1, d);
});
});