Skip to content

Commit 23a3425

Browse files
committed
Adding tests for "Horse-hyperracing
hyperduals".
1 parent 3152779 commit 23a3425

16 files changed

+2811
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Tests for "Box of cigars".
2424
- Tests for "Simplified Monopoly™ turns prediction".
2525
- Tests for "Regular polygons".
26+
- Tests for "Horse-hyperracing hyperduals".
2627

2728
## [1.13.0] - 2022-09-30
2829
### Added
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* The "Horse-hyperracing hyperduals" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/horse-hyperracing-hyperduals}
4+
*/
5+
function execute(readline) {
6+
var inputs = readline().split(' ');
7+
const N = parseInt(inputs[0]);
8+
const M = parseInt(inputs[1]);
9+
const X = parseInt(inputs[2]);
10+
for (let i = 0; i < N; i++) {
11+
var inputs = readline().split(' ');
12+
const V = parseInt(inputs[0]);
13+
const E = parseInt(inputs[1]);
14+
}
15+
16+
// Write an answer using console.log()
17+
// To debug: console.error('Debug messages...');
18+
19+
console.log('42');
20+
}
21+
22+
export { execute };
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import { assert } from 'chai';
2+
import sinon from 'sinon';
3+
import File from '../../../../File.js';
4+
import { execute } from '../../../../../lib/community/training/medium/horseHyperracingHyperduals/horseHyperracingHyperduals.js';
5+
6+
const __dirname = new URL('.', import.meta.url).pathname;
7+
8+
suite("Horse-hyperracing hyperduals", function() {
9+
const sandbox = sinon.createSandbox();
10+
11+
setup(function () {
12+
sandbox.stub(console, "log");
13+
});
14+
15+
teardown(function () {
16+
sandbox.restore();
17+
});
18+
19+
20+
test("Check your LCG", function() {
21+
let inputFile = new File(__dirname + 'input/01 - check your LCG.txt');
22+
23+
execute(inputFile.readline.bind(inputFile));
24+
25+
assert.strictEqual(
26+
console.log.getCall(0).args[0],
27+
1372193593
28+
);
29+
});
30+
31+
test("2D horses", function() {
32+
let inputFile = new File(__dirname + 'input/02 - 2D horses.txt');
33+
34+
execute(inputFile.readline.bind(inputFile));
35+
36+
assert.strictEqual(
37+
console.log.getCall(0).args[0],
38+
345805
39+
);
40+
});
41+
42+
test("A fistful of horses", function() {
43+
let inputFile = new File(__dirname + 'input/03 - a fistful of horses.txt');
44+
45+
execute(inputFile.readline.bind(inputFile));
46+
47+
assert.strictEqual(
48+
console.log.getCall(0).args[0],
49+
97225
50+
);
51+
});
52+
53+
test("For a few horse more", function() {
54+
let inputFile = new File(__dirname + 'input/04 - for a few horse more.txt');
55+
56+
execute(inputFile.readline.bind(inputFile));
57+
58+
assert.strictEqual(
59+
console.log.getCall(0).args[0],
60+
35608
61+
);
62+
});
63+
64+
test("All your horse are belong to us", function() {
65+
let inputFile = new File(__dirname + 'input/05 - all your horse are belong to us.txt');
66+
67+
execute(inputFile.readline.bind(inputFile));
68+
69+
assert.strictEqual(
70+
console.log.getCall(0).args[0],
71+
33322
72+
);
73+
});
74+
75+
test("Many horses", function() {
76+
let inputFile = new File(__dirname + 'input/06 - many horses.txt');
77+
78+
execute(inputFile.readline.bind(inputFile));
79+
80+
assert.strictEqual(
81+
console.log.getCall(0).args[0],
82+
1293
83+
);
84+
});
85+
86+
test("More horse", function() {
87+
let inputFile = new File(__dirname + 'input/07 - more horse.txt');
88+
89+
execute(inputFile.readline.bind(inputFile));
90+
91+
assert.strictEqual(
92+
console.log.getCall(0).args[0],
93+
4748656
94+
);
95+
});
96+
97+
test("Horse OVER 9000!", function() {
98+
let inputFile = new File(__dirname + 'input/08 - horse OVER 9000!.txt');
99+
100+
execute(inputFile.readline.bind(inputFile));
101+
102+
assert.strictEqual(
103+
console.log.getCall(0).args[0],
104+
225840
105+
);
106+
});
107+
108+
test("Horse overflow", function() {
109+
let inputFile = new File(__dirname + 'input/09 - horse overflow.txt');
110+
111+
execute(inputFile.readline.bind(inputFile));
112+
113+
assert.strictEqual(
114+
console.log.getCall(0).args[0],
115+
75280
116+
);
117+
});
118+
119+
test("Can't leave racers sitting horizontally", function() {
120+
let inputFile = new File(__dirname + 'input/10 - can\'t leave racers sitting horizontally.txt');
121+
122+
execute(inputFile.readline.bind(inputFile));
123+
124+
assert.strictEqual(
125+
console.log.getCall(0).args[0],
126+
1713883
127+
);
128+
});
129+
130+
test("Can't leave racers sitting vertically either", function() {
131+
let inputFile = new File(__dirname + 'input/11 - can\'t leave racers sitting vertically either.txt');
132+
133+
execute(inputFile.readline.bind(inputFile));
134+
135+
assert.strictEqual(
136+
console.log.getCall(0).args[0],
137+
1713883
138+
);
139+
});
140+
141+
test("Peak zexion", function() {
142+
let inputFile = new File(__dirname + 'input/12 - peak zexion.txt');
143+
144+
execute(inputFile.readline.bind(inputFile));
145+
146+
assert.strictEqual(
147+
console.log.getCall(0).args[0],
148+
75242
149+
);
150+
});
151+
152+
test("Roll JBM", function() {
153+
let inputFile = new File(__dirname + 'input/13 - roll JBM.txt');
154+
155+
execute(inputFile.readline.bind(inputFile));
156+
157+
assert.strictEqual(
158+
console.log.getCall(0).args[0],
159+
75279
160+
);
161+
});
162+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 2 42424242
2+
0 0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
20 0 0
2+
4618437 6674593
3+
3514840 7691515
4+
2672663 1665342
5+
5631166 6201289
6+
9945095 3677291
7+
1512462 4361
8+
2505387 5874765
9+
1291399 7215528
10+
1660077 787560
11+
9931494 5381878
12+
7915213 4933424
13+
4831249 1702132
14+
8635501 764174
15+
4280909 6682870
16+
5130005 1332040
17+
2404884 8112820
18+
6220969 1077590
19+
1304552 5025490
20+
8009975 8931210
21+
3783886 8177379
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
100 0 0
2+
476232 6099056
3+
1252195 8195024
4+
5179797 3726665
5+
2529858 9172796
6+
7961959 2561085
7+
9263926 3845617
8+
2456202 6000415
9+
9192480 3336489
10+
8385706 3436795
11+
7633011 3341236
12+
9600683 7771955
13+
4180801 4369825
14+
7882543 5920460
15+
7642730 151115
16+
1369927 8322244
17+
2964558 6707262
18+
7788173 1490791
19+
8991412 7392994
20+
5321429 413931
21+
8568890 6052054
22+
3473046 1616509
23+
7091766 49737
24+
3913880 9460643
25+
3515415 2384655
26+
6699786 7028201
27+
9970257 1358714
28+
710257 3086432
29+
5400992 2792219
30+
2362365 222315
31+
2561008 2817585
32+
3011758 8441447
33+
729903 4583383
34+
670590 8216624
35+
2721940 4369326
36+
4237122 7149588
37+
179753 7677875
38+
110994 2742519
39+
6396540 3760912
40+
9410680 8086228
41+
8608224 4098416
42+
4845345 8038040
43+
9002862 1814263
44+
6233776 6318808
45+
4797363 1542758
46+
2600525 2196497
47+
6352079 3404672
48+
2388101 2490411
49+
9183978 7476586
50+
5558651 6629134
51+
1182081 2311080
52+
6955727 686161
53+
2639207 9963413
54+
7273848 9616226
55+
737340 1784216
56+
139513 4394573
57+
5737251 1535489
58+
3222188 4149579
59+
6734466 1672743
60+
828881 9560738
61+
5892729 2810128
62+
1233882 7310373
63+
1523550 7254201
64+
5979735 925498
65+
9248067 3268740
66+
761882 8279829
67+
3288654 4536675
68+
9263699 2854534
69+
5256788 7641273
70+
6708636 4746187
71+
8726430 1728770
72+
8990622 8683541
73+
4535498 7676634
74+
4362813 2949997
75+
3800137 6819590
76+
6919651 3240441
77+
4746861 730059
78+
6890407 4900751
79+
1886958 6767077
80+
247994 1652869
81+
5027767 8561296
82+
5779668 7401376
83+
3919775 4662213
84+
8802825 3808880
85+
6791371 2012836
86+
7656948 1433158
87+
6970220 7418201
88+
8260610 7911150
89+
7608637 9825366
90+
7970563 7182155
91+
6128062 8027917
92+
8079463 8449669
93+
5314462 2747934
94+
3182400 9529169
95+
9502662 3239530
96+
9753972 3615219
97+
1485409 7313285
98+
8312047 1178908
99+
7705447 9619362
100+
6988250 4685659
101+
7000551 7174156

0 commit comments

Comments
 (0)