From 64882d2cf209b6ed1de957d3c0ad51ef2c8e4c05 Mon Sep 17 00:00:00 2001 From: Soup For My Family Date: Thu, 11 Jun 2026 21:08:15 -0600 Subject: [PATCH] Use mem.eql for dictionary test --- src/dict.zig | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/dict.zig b/src/dict.zig index 593da3c..9dbb087 100644 --- a/src/dict.zig +++ b/src/dict.zig @@ -62,18 +62,8 @@ fn loadDict() []const Wordle.Word { // TODO: binary search? need to assert that words are sorted pub fn isInDictionary(word: Wordle.Word) bool { // exhaustively search through dictionary - for (getDictionary()) |entry| { - // compare each letter at a time - var match = true; - for (entry, word) |entryLetter, wordLetter| { - if (entryLetter != wordLetter) { - match = false; - break; - } - } - - // if every letter matches, return a complete match - if (match) { + for (getDictionary()) |*entry| { + if (std.mem.eql(u8, entry, &word)) { return true; } }