main_testing2/wordle_test5.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 26 Apr 2024 17:36:41 +0100
changeset 487 efad9725dfd8
parent 475 59e005dcf163
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
435
fda7c39f3b6a updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
     2
def urbanmain() = {
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
     3
  import M2._
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
     4
  import io.Source
435
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
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
     7
  def urban_get_wordle_list(url: String) : List[String] = {
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
     8
    Source.fromFile(url)("ISO-8859-1").getLines().toList
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
     9
  }
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    10
  val urban_secrets = urban_get_wordle_list("wordle.txt")
435
fda7c39f3b6a updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    12
  //val urban_wordle_url = """https://nms.kcl.ac.uk/christian.urban/wordle.txt"""
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    13
  //val urban_secrets = get_wordle_list(urban_wordle_url)
435
fda7c39f3b6a updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
fda7c39f3b6a updated wordle testing
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
475
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    16
  assert(evil(urban_secrets, "stent").length == 1907)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    17
  assert(evil(urban_secrets, "hexes").length == 2966)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    18
  assert(evil(urban_secrets, "horse").length == 1203)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    19
  assert(evil(urban_secrets, "hoise").length == 971)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    20
  assert(evil(urban_secrets, "house").length == 1228)
59e005dcf163 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 437
diff changeset
    21
}