-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSimpleWordGame.java
79 lines (68 loc) · 1.53 KB
/
SimpleWordGame.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class SimpleWordGame {
public int points(String[] player, String[] dictionary) {
// TODO: replace this stubbed return value with your code
return 0;
}
public static void main(String[] args) {
SimpleWordGame game = new SimpleWordGame();
int result, expectation;
int passed = 0, failed = 0;
// Example 1
result = game.points(
new String[]{},
new String[]{}
);
expectation = 0;
if(result != expectation) {
failed++;
System.out.println("Example 1: expected result " + result + " to be " + expectation);
}
else {
passed++;
}
// Example 2
result = game.points(
new String[]{},
new String[]{}
);
expectation = 1;
if(result == expectation) {
passed++;
}
else {
failed++;
System.out.println("Example 2: expected result " + result + " to be " + expectation);
}
// Example 3
result = game.points(
new String[]{},
new String[]{}
);
expectation = 4;
if(result == expectation) {
passed++;
}
else {
failed++;
System.out.println("Example 3: expected result " + result + " to be " + expectation);
}
// Example 4
result = game.points(
new String[]{},
new String[]{}
);
expectation = -1;
if(result == expectation) {
passed++;
}
else {
failed++;
System.out.println("Example 4: expected result " + result + " to be " + expectation);
}
System.out.println("SimpleWordGame: " + passed + " passed, " + failed + " failed.");
}
}