author | Christian Urban <christian.urban@kcl.ac.uk> |
Sat, 11 Mar 2023 22:01:53 +0000 | |
changeset 463 | 0315d9983cd0 |
parent 437 | d4d4669ad054 |
child 475 | 59e005dcf163 |
permissions | -rw-r--r-- |
435
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
|
437 | 2 |
import M2._ |
435
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
import io.Source |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
def urban_get_wordle_list(url: String) : List[String] = { |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
Source.fromFile(url)("ISO-8859-1").getLines().toList |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
} |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
val urban_secrets = urban_get_wordle_list("wordle.txt") |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
11 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
//val urban_wordle_url = """https://nms.kcl.ac.uk/christian.urban/wordle.txt""" |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
//val urban_secrets = get_wordle_list(urban_wordle_url) |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
assert(ranked_evil(urban_secrets, "abbey") == List("whizz")) |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
assert(ranked_evil(urban_secrets, "afear") == List("buzzy")) |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
assert(ranked_evil(urban_secrets, "zincy") == List("jugum")) |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
assert(ranked_evil(urban_secrets, "zippy") == List("chuff")) |
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
|
fda7c39f3b6a
updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
|
463 | 22 |
assert(ranked_evil(urban_secrets, "beats") == List("fuzzy")) |
23 |
assert(ranked_evil(urban_secrets, "vitae") == List("fuzzy")) |
|
24 |
assert(ranked_evil(urban_secrets, "bento") == List("fuzzy")) |
|
25 |
assert(ranked_evil(urban_secrets, "belts") == List("fuzzy")) |