Documentation ¶
Index ¶
- type Analyzer
- type Finder
- type FinderLimits
- type SbpBfsFinder
- func (f *SbpBfsFinder) DebugPath(path [][]int)
- func (f *SbpBfsFinder) Detect(m *grids.Matrix2d) (err error)
- func (f *SbpBfsFinder) FindExtremals(g defs.Playable)
- func (f *SbpBfsFinder) GetResult() (found bool, cr int, dur time.Duration)
- func (f *SbpBfsFinder) Resume()
- func (f *SbpBfsFinder) SetDebug(b bool)
- func (f *SbpBfsFinder) SetHardOptimal(hardOptimal bool)
- func (f *SbpBfsFinder) SetLimits(maxDepth int, maxStates int)
- func (f *SbpBfsFinder) SilentMode(b bool)
- func (f *SbpBfsFinder) SolvePuzzle(g defs.Playable)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Sliding blocks puzzle finder
func (*Analyzer) Explore ¶
func (f *Analyzer) Explore(g defs.Explorable)
Explores all possible reachable states
func (*Analyzer) SilentMode ¶
type Finder ¶
type Finder interface { SetLimits(maxDepth int, maxStates int) SetDebug(bool) SilentMode(bool) // Searches for the shortest path to solve the puzzle SolvePuzzle(g defs.Playable) // Searches for the farthest states from current state FindExtremals(g defs.Playable) }
Basic finder/solver interface
type FinderLimits ¶
type FinderLimits struct {
// contains filtered or unexported fields
}
Finder limits: depth and number of different states
func (*FinderLimits) SetLimits ¶
func (f *FinderLimits) SetLimits(maxDepth int, maxStates int)
type SbpBfsFinder ¶
type SbpBfsFinder struct {
// contains filtered or unexported fields
}
Sliding blocks puzzle finder
func (*SbpBfsFinder) DebugPath ¶
func (f *SbpBfsFinder) DebugPath(path [][]int)
Useful to run the algorithm silently until we reach a concrete path. Then, debug mode is activated for some amount of steps.
func (*SbpBfsFinder) Detect ¶
func (f *SbpBfsFinder) Detect(m *grids.Matrix2d) (err error)
We want to know the minimum path to this state
func (*SbpBfsFinder) FindExtremals ¶
func (f *SbpBfsFinder) FindExtremals(g defs.Playable)
*
- @summary Makes a depth-search and returns the most 'distant' states. *
- @param {defs.Playable} g The sequential game
- @param {int} maxSteps Max depth of the search
- @param {int} maxExtremals Max number of extremal states returned
func (*SbpBfsFinder) GetResult ¶
func (f *SbpBfsFinder) GetResult() (found bool, cr int, dur time.Duration)
Returns if found, and collapsed length of solution
func (*SbpBfsFinder) SetDebug ¶
func (f *SbpBfsFinder) SetDebug(b bool)
func (*SbpBfsFinder) SetHardOptimal ¶
func (f *SbpBfsFinder) SetHardOptimal(hardOptimal bool)
func (*SbpBfsFinder) SetLimits ¶
func (f *SbpBfsFinder) SetLimits(maxDepth int, maxStates int)
func (*SbpBfsFinder) SilentMode ¶
func (f *SbpBfsFinder) SilentMode(b bool)
func (*SbpBfsFinder) SolvePuzzle ¶
func (f *SbpBfsFinder) SolvePuzzle(g defs.Playable)
*
- @summary Makes a depth-search and returns the most 'distant' states. *
- @param {defs.Playable} g The sequential game
- @param {int} maxSteps Max depth of the search
- @param {int} maxExtremals Max number of extremal states returned
Click to show internal directories.
Click to hide internal directories.