boggle

package module
v0.0.0-...-0514bb0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 8 Imported by: 0

README

Boggle Solver

A boggle solver written in Go.

You may be able to see the site at: https://davidnix-boggle-solver.herokuapp.com/ (Heroku free dyno. YMMV)

To Run Locally

$ go build cmd/bogglehttpd/bogglehttpd.go

$ PORT=<port number of your choice> ./bogglehttpd

Known Limitations and TODOs

  • Only English is supported but letter lookup supports non-ASCII characters. It would be straightforward to extend the model layer to additional languages.
  • The server portion was quick and dirty given time limitations. Typically, I include unit tests for http handlers.
  • The models can accept a board of any size (like 5x5) even though currently it's locked to 4x4 on the web app.
  • I am not a front end engineer.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board [][]string

func (Board) Traverse

func (b Board) Traverse(v Visitor)

func (Board) TraverseConcurrent

func (b Board) TraverseConcurrent(v ConcurrentVisitor)

type BoardNode

type BoardNode struct {
	Parent   *BoardNode
	Row, Col int
	// contains filtered or unexported fields
}

func (*BoardNode) Path

func (node *BoardNode) Path() []Coordinate

type ConcurrentFinder

type ConcurrentFinder struct {
	Entries chan Entry
	// contains filtered or unexported fields
}

func NewConcurrentVisitor

func NewConcurrentVisitor(dict Dictionary) *ConcurrentFinder

func (*ConcurrentFinder) Done

func (cf *ConcurrentFinder) Done()

func (*ConcurrentFinder) Visit

func (cf *ConcurrentFinder) Visit(node *BoardNode, letters string) bool

type ConcurrentVisitor

type ConcurrentVisitor interface {
	Visitor
	Done()
}

type Coordinate

type Coordinate []int

func (Coordinate) Col

func (c Coordinate) Col() int

func (Coordinate) Row

func (c Coordinate) Row() int

func (Coordinate) String

func (c Coordinate) String() string

type Dictionary

type Dictionary struct {
	*trie.Node
	Language Lang
}

func NewDictionary

func NewDictionary() (Dictionary, error)

func (Dictionary) Exists

func (d Dictionary) Exists(word []rune) (prefixExists, wordExists bool)

type Entry

type Entry struct {
	Word string
	Path []Coordinate
}

type Lang

type Lang int
const (
	EnLang Lang = iota
)

type Visitor

type Visitor interface {
	Visit(node *BoardNode, letters string) bool
}

type WordFinder

type WordFinder struct {
	Found []Entry
	// contains filtered or unexported fields
}

func NewVisitor

func NewVisitor(dict Dictionary) *WordFinder

func (*WordFinder) Visit

func (wf *WordFinder) Visit(node *BoardNode, letters string) bool

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL