Wordle solver
manuel

manuel @mnlwldr

About: I’m known as mnlwldr on various platforms. I’m a software developer and live in the southwest of Germany near the France border.

Location:
Germany
Joined:
Jan 13, 2017

Wordle solver

Publish Date: Jan 21 '22
6 0

Just for fun tool to search in the Wordle wordlist.

Usage

Usage of ./wordle-solver:
  -except string
        Characters to except (e.g.: "aeou")
  -match string
        The string to match (placeholder: .) (default ".....")
  -wordlist string
        Wordlist to use (default "Wordlist")

Enter fullscreen mode Exit fullscreen mode

Example Todays Worlde is “BRAND” for example and we started with “IRATE”.

wordle-solver -match ".ra.." -except "ite"

You got a list of 27 possible words.

Wordle solver on GitHub

package main

import (
    "bufio"
    "flag"
    "fmt"
    "log"
    "os"
    "regexp"
)

func main() {
    wordlistFlag := flag.String("wordlist", "Wordlist", "Wordlist to use")
    matchFlag := flag.String("match", ".....", "The string to match (placeholder: .)")
    exceptFlag := flag.String("except", "", "Characters to except (e.g.: \"aeou\")")
    flag.Parse()

    file, err := os.Open(*wordlistFlag)
    if err != nil {
        log.Fatal(err)
    }
    defer file.Close()

    scanner := bufio.NewScanner(file)
    for scanner.Scan() {
        match, _ := regexp.MatchString(*matchFlag, scanner.Text())
        except, _ := regexp.MatchString(fmt.Sprintf(`[%s]`, *exceptFlag), scanner.Text())
        if match && !except {
            fmt.Println(scanner.Text())
        }
    }
}

Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment