https://github.com/aquilax/wordgame
Word Game search library
https://github.com/aquilax/wordgame
game tool word-game
Last synced: over 1 year ago
JSON representation
Word Game search library
- Host: GitHub
- URL: https://github.com/aquilax/wordgame
- Owner: aquilax
- License: mit
- Created: 2017-11-04T05:49:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-12T05:11:10.000Z (over 4 years ago)
- Last Synced: 2025-01-22T06:30:09.390Z (over 1 year ago)
- Topics: game, tool, word-game
- Language: Go
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wordgame [](https://godoc.org/github.com/aquilax/wordgame)
Package wordgame provides a dictionary search for word games.
Given a dictionary and list of required characteds, the search returns
list of matching words which include all the required characters.
## Usage
```go
package wordgame_test
import (
"fmt"
"github.com/aquilax/wordgame"
)
func ExampleWordList_Filter() {
wl := wordgame.NewFromStrings([]string{
"cow",
"chicken",
"horse",
"brocolly",
})
result := wl.Filter(wordgame.GivenWithExtra("co", 0))
fmt.Printf("%+v", result)
// Output: [cow brocolly]
}
func ExampleWordList_Filter_Len() {
wl := wordgame.NewFromStrings([]string{
"cow",
"chicken",
"horse",
"brocolly",
"coworker",
"comb",
})
result := wl.Filter(wordgame.GivenWithExtra("co", 4))
fmt.Printf("%+v", result)
// Output: [comb]
}
func ExampleWordList_FilterConcurrent() {
wl := wordgame.NewFromStrings([]string{
"cow",
"chicken",
"horse",
"brocolly",
})
result := wl.FilterConcurrent(wordgame.GivenWithExtra("co", 0), 2)
fmt.Printf("%+v", result)
// Output: [cow brocolly]
}
func ExampleWordList_FilterConcurrent_OnlyGiven() {
wl := wordgame.NewFromStrings([]string{
"cow",
"chicken",
"horse",
"brocolly",
})
result := wl.FilterConcurrent(wordgame.OnlyGiven("cowz", 0), 2)
fmt.Printf("%+v", result)
// Output: [cow]
}
```