Skip to content

Commit 9e1cc60

Browse files
committed
Adding tests for "Simplified Monopoly™ turns
prediction".
1 parent 0596a3d commit 9e1cc60

19 files changed

+594
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- Tests for "Gravity".
2222
- Tests for "Hacking at RobberCity".
2323
- Tests for "Box of cigars".
24+
- Tests for "Simplified Monopoly™ turns prediction".
2425

2526
## [1.13.0] - 2022-09-30
2627
### Added
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* The "Simplified Monopoly™ turns prediction" puzzle.
3+
* @see {@link https://www.codingame.com/ide/puzzle/simplified-monopoly-turns-prediction}
4+
*/
5+
function execute(readline) {
6+
const P = parseInt(readline());
7+
for (let i = 0; i < P; i++) {
8+
const player = readline();
9+
}
10+
const D = parseInt(readline());
11+
for (let i = 0; i < D; i++) {
12+
const dice = readline();
13+
}
14+
for (let i = 0; i < 40; i++) {
15+
const boardline = readline();
16+
}
17+
18+
// Write an answer using console.log()
19+
// To debug: console.error('Debug messages...');
20+
21+
console.log('answer');
22+
}
23+
24+
export { execute };
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { assert } from 'chai';
2+
import sinon from 'sinon';
3+
import File from '../../../../File.js';
4+
import { assertOutputAnswer } from '../../../../assertOutputAnswer.js';
5+
import { execute } from '../../../../../lib/community/training/medium/simplifiedMonopolyTurnsPrediction/simplifiedMonopolyTurnsPrediction.js';
6+
7+
const __dirname = new URL('.', import.meta.url).pathname;
8+
9+
suite("Simplified Monopoly™ turns prediction", function() {
10+
const sandbox = sinon.createSandbox();
11+
12+
setup(function () {
13+
sandbox.stub(console, "log");
14+
});
15+
16+
teardown(function () {
17+
sandbox.restore();
18+
});
19+
20+
21+
test("Start from Go", function() {
22+
let inputFile = new File(__dirname + 'input/01 - start from Go.txt');
23+
24+
execute(inputFile.readline.bind(inputFile));
25+
26+
assertOutputAnswer(__dirname + 'output/01 - start from Go.txt');
27+
});
28+
29+
test("Not start from Go", function() {
30+
let inputFile = new File(__dirname + 'input/02 - not start from Go.txt');
31+
32+
execute(inputFile.readline.bind(inputFile));
33+
34+
assertOutputAnswer(__dirname + 'output/02 - not start from Go.txt');
35+
});
36+
37+
test("Around the board", function() {
38+
let inputFile = new File(__dirname + 'input/03 - around the board.txt');
39+
40+
execute(inputFile.readline.bind(inputFile));
41+
42+
assertOutputAnswer(__dirname + 'output/03 - around the board.txt');
43+
});
44+
45+
test("Lucky doubles", function() {
46+
let inputFile = new File(__dirname + 'input/04 - lucky doubles.txt');
47+
48+
execute(inputFile.readline.bind(inputFile));
49+
50+
assertOutputAnswer(__dirname + 'output/04 - lucky doubles.txt');
51+
});
52+
53+
test("Go to jail", function() {
54+
let inputFile = new File(__dirname + 'input/05 - go to jail.txt');
55+
56+
execute(inputFile.readline.bind(inputFile));
57+
58+
assertOutputAnswer(__dirname + 'output/05 - go to jail.txt');
59+
});
60+
61+
test("Early release", function() {
62+
let inputFile = new File(__dirname + 'input/06 - early release.txt');
63+
64+
execute(inputFile.readline.bind(inputFile));
65+
66+
assertOutputAnswer(__dirname + 'output/06 - early release.txt');
67+
});
68+
69+
test("Friends forever", function() {
70+
let inputFile = new File(__dirname + 'input/07 - friends forever.txt');
71+
72+
execute(inputFile.readline.bind(inputFile));
73+
74+
assertOutputAnswer(__dirname + 'output/07 - friends forever.txt');
75+
});
76+
77+
test("Big run", function() {
78+
let inputFile = new File(__dirname + 'input/08 - big run.txt');
79+
80+
execute(inputFile.readline.bind(inputFile));
81+
82+
assertOutputAnswer(__dirname + 'output/08 - big run.txt');
83+
});
84+
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2
2+
Horse 0
3+
TopHat 0
4+
6
5+
1 6
6+
2 1
7+
6 4
8+
2 1
9+
4 5
10+
6 5
11+
Go
12+
Mediterranean Avenue
13+
Community Chest
14+
Baltic Avenue
15+
Income Tax
16+
Reading Railroad
17+
Oriental Avenue
18+
Chance
19+
Vermont Avenue
20+
Connecticut Avenue
21+
Visit Only / In Jail
22+
St. Charles Place
23+
Electric Company
24+
States Avenue
25+
Virginia Avenue
26+
Pennsylvania Railroad
27+
St. James Place
28+
Community Chest
29+
Tennessee Avenue
30+
New York Avenue
31+
Free Parking
32+
Kentucky Avenue
33+
Chance
34+
Indiana Avenue
35+
Illinois Avenue
36+
B. & O. Railroad
37+
Atlantic Avenue
38+
Ventnor Avenue
39+
Water Works
40+
Marvin Gardens
41+
Go To Jail
42+
Pacific Avenue
43+
North Carolina Avenue
44+
Community Chest
45+
Pennsylvania Avenue
46+
Short Line
47+
Chance
48+
Park Place
49+
Luxury Tax
50+
Boardwalk
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2
2+
Boot 13
3+
Car 8
4+
4
5+
1 2
6+
5 3
7+
3 2
8+
6 4
9+
Go
10+
Mediterranean Avenue
11+
Community Chest
12+
Baltic Avenue
13+
Income Tax
14+
Reading Railroad
15+
Oriental Avenue
16+
Chance
17+
Vermont Avenue
18+
Connecticut Avenue
19+
Visit Only / In Jail
20+
St. Charles Place
21+
Electric Company
22+
States Avenue
23+
Virginia Avenue
24+
Pennsylvania Railroad
25+
St. James Place
26+
Community Chest
27+
Tennessee Avenue
28+
New York Avenue
29+
Free Parking
30+
Kentucky Avenue
31+
Chance
32+
Indiana Avenue
33+
Illinois Avenue
34+
B. & O. Railroad
35+
Atlantic Avenue
36+
Ventnor Avenue
37+
Water Works
38+
Marvin Gardens
39+
Go To Jail
40+
Pacific Avenue
41+
North Carolina Avenue
42+
Community Chest
43+
Pennsylvania Avenue
44+
Short Line
45+
Chance
46+
Park Place
47+
Luxury Tax
48+
Boardwalk
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2
2+
Thimble 25
3+
Wheelbarrow 21
4+
6
5+
5 4
6+
6 5
7+
2 4
8+
5 2
9+
6 3
10+
1 6
11+
Go
12+
Mediterranean Avenue
13+
Community Chest
14+
Baltic Avenue
15+
Income Tax
16+
Reading Railroad
17+
Oriental Avenue
18+
Chance
19+
Vermont Avenue
20+
Connecticut Avenue
21+
Visit Only / In Jail
22+
St. Charles Place
23+
Electric Company
24+
States Avenue
25+
Virginia Avenue
26+
Pennsylvania Railroad
27+
St. James Place
28+
Community Chest
29+
Tennessee Avenue
30+
New York Avenue
31+
Free Parking
32+
Kentucky Avenue
33+
Chance
34+
Indiana Avenue
35+
Illinois Avenue
36+
B. & O. Railroad
37+
Atlantic Avenue
38+
Ventnor Avenue
39+
Water Works
40+
Marvin Gardens
41+
Go To Jail
42+
Pacific Avenue
43+
North Carolina Avenue
44+
Community Chest
45+
Pennsylvania Avenue
46+
Short Line
47+
Chance
48+
Park Place
49+
Luxury Tax
50+
Boardwalk
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2
2+
Cat 5
3+
CoinPurse 7
4+
8
5+
2 2
6+
6 6
7+
5 3
8+
5 5
9+
2 3
10+
3 3
11+
1 1
12+
6 5
13+
Go
14+
Mediterranean Avenue
15+
Community Chest
16+
Baltic Avenue
17+
Income Tax
18+
Reading Railroad
19+
Oriental Avenue
20+
Chance
21+
Vermont Avenue
22+
Connecticut Avenue
23+
Visit Only / In Jail
24+
St. Charles Place
25+
Electric Company
26+
States Avenue
27+
Virginia Avenue
28+
Pennsylvania Railroad
29+
St. James Place
30+
Community Chest
31+
Tennessee Avenue
32+
New York Avenue
33+
Free Parking
34+
Kentucky Avenue
35+
Chance
36+
Indiana Avenue
37+
Illinois Avenue
38+
B. & O. Railroad
39+
Atlantic Avenue
40+
Ventnor Avenue
41+
Water Works
42+
Marvin Gardens
43+
Go To Jail
44+
Pacific Avenue
45+
North Carolina Avenue
46+
Community Chest
47+
Pennsylvania Avenue
48+
Short Line
49+
Chance
50+
Park Place
51+
Luxury Tax
52+
Boardwalk
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2
2+
Lantern 25
3+
ClothesIron 18
4+
9
5+
3 2
6+
5 3
7+
3 5
8+
6 6
9+
5 4
10+
4 2
11+
4 3
12+
5 4
13+
2 2
14+
Go
15+
Mediterranean Avenue
16+
Community Chest
17+
Baltic Avenue
18+
Income Tax
19+
Reading Railroad
20+
Oriental Avenue
21+
Chance
22+
Vermont Avenue
23+
Connecticut Avenue
24+
Visit Only / In Jail
25+
St. Charles Place
26+
Electric Company
27+
States Avenue
28+
Virginia Avenue
29+
Pennsylvania Railroad
30+
St. James Place
31+
Community Chest
32+
Tennessee Avenue
33+
New York Avenue
34+
Free Parking
35+
Kentucky Avenue
36+
Chance
37+
Indiana Avenue
38+
Illinois Avenue
39+
B. & O. Railroad
40+
Atlantic Avenue
41+
Ventnor Avenue
42+
Water Works
43+
Marvin Gardens
44+
Go To Jail
45+
Pacific Avenue
46+
North Carolina Avenue
47+
Community Chest
48+
Pennsylvania Avenue
49+
Short Line
50+
Chance
51+
Park Place
52+
Luxury Tax
53+
Boardwalk

0 commit comments

Comments
 (0)