finder

package
v0.0.0-...-a996d8c Latest Latest
Warning

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

Go to latest
Published: May 3, 2016 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

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) Resume

func (f *Analyzer) Resume()

Prints statistics and results

func (*Analyzer) SetDebug

func (f *Analyzer) SetDebug(b bool)

func (*Analyzer) SetLimits

func (f *Analyzer) SetLimits(maxDepth int, maxStates int)

func (*Analyzer) SilentMode

func (f *Analyzer) SilentMode(b bool)

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) Resume

func (f *SbpBfsFinder) Resume()

Prints statistics and results

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

Jump to

Keyboard shortcuts

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