Skip to content

Instantly share code, notes, and snippets.

@tomjohnneill
tomjohnneill / calculate.js
Created January 5, 2022 01:38
Calculate the best possible guess for Wordle
import { list } from "./wordlist.json";
const matchesFilters = (wordList, filters) => {
return wordList.filter((word) => {
let match = true;
for (let i = 0; i < filters.length; i += 1) {
const { colour, position, letter } = filters[i];
if (colour === "black") {
if (word.includes(letter)) {
match = false;