Wordle comparison: Difference between revisions
Content added Content deleted
(J: improve test cases) |
m (→{{header|J}}) |
||
Line 182: | Line 182: | ||
<tt><nowiki><I.x=y</nowiki></tt> is a box containing the list of exact match indices, and <tt><nowiki>(<@I.y=/~x#~y~:x)</nowiki></tt> is a list of boxes (for each character) of the indices of non-exact matches. Meanwhile <tt><nowiki>({.~1<.#)</nowiki></tt> means "at most one" and operates on lists (so it's empty for an empty list and the first element for a non-empty list). |
<tt><nowiki><I.x=y</nowiki></tt> is a box containing the list of exact match indices, and <tt><nowiki>(<@I.y=/~x#~y~:x)</nowiki></tt> is a list of boxes (for each character) of the indices of non-exact matches. Meanwhile <tt><nowiki>({.~1<.#)</nowiki></tt> means "at most one" and operates on lists (so it's empty for an empty list and the first element for a non-empty list). |
||
In other words, we build a list of candidate matches for each character and then, for each character, exclude any already picked index and if there's a remaining |
In other words, we build a list of candidate matches for each character and then, for each character, exclude any already picked index and if there's a remaining candidates, we pick the first of those. |
||
(exact match indices will override inexact match indices, which makes the inexact match index calculation simpler -- we don't have to use a separate type for exact match indices.) |
(exact match indices will override inexact match indices, which makes the inexact match index calculation simpler -- we don't have to use a separate type for exact match indices.) |