I am just learning and am writing a word game.
I have a list of letters ordered by frequency of use and am doing a MapSet.difference() with letters [a-z] sorted by frequency of use & used letters to determine the next guess for an automated client
that works fine but the function re orders the new difference list alphabetically
I wanted to keep the [f] list order then just pick the next most frequent letter for a guess
f =
[“e”, “a”, “r”, “i”, “o”, “t”, “n”, “s”, “l”, “c”, “u”, “d”, “p”, “b”, “f”, “g”,
“h”, “j”, “k”, “m”, “q”, “v”, “w”, “x”, “y”, “z”]
s =
[“a”, “b”, “c”]
r = MapSet.difference(MapSet.new(f),MapSet.new(s))
the list does not start with “r” anymore [it’s new and that is fine, but I wanted to do an Enum.at(…0) to pick the next letter off the list… ]
r is {
MapSet.new([“d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p”,
“q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, “y”, “z”])
}
is there a way to do this?
Thanks!!