Skip to content

vidhanio/wordle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wordle

A simple wordle package in Go.

Written on a bored Tuesday which would have been spent better doing homework.

Want to see it in action? Check out discordle.

Example

package main

import (
    "fmt"

    "github.com/vidhanio/wordle"
)

func main() {
	// all words which are valid
	dictionary := []string{"hello", "world", "among", "us", "sus", "tasks"}

	// words which can be used as the word in the wordle
	// this is because some valid words are near-impossible to guess, although they are valid words
	common := []string{"hello", "among"}

	// Create a new wordle with:
	// - A word length of 5
	// - A guess count of 6
	// with the validWords and commonWords
	w, err := wordle.New(5, 6, dictionary, common)
	if err != nil {
		panic(err)
	}

	guessResult, err := w.Guess("among")
	if err != nil {
		// errors returned from (*wordle).Guess are non-fatal, so we can continue while telling the user the error
		fmt.Println(err)
	}

	fmt.Println(guessResult)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages