Documentation
¶
Index ¶
- Constants
- Variables
- func MakeG1CornerOrientationsTable() map[CornerOrientations]uint8
- func MakeG2CornerPermutationTable(g3 map[CornerPermutation]uint8) map[CornerPermutation]uint8
- func MakeG2EdgePermutationTable() map[EdgePermutation]uint8
- func MakeG3BetterHeuristicTable() map[G3Cube]uint8
- func MakeG3CornerPermutationTable() map[CornerPermutation]uint8
- func MakeG3EdgePermutationTable() map[EdgePermutation]uint8
- func MakeG3HeuristicTable() map[Cube]uint8
- type CornerOrientation
- type CornerOrientations
- func (co *CornerOrientations) Apply(move cmn.Move)
- func (co CornerOrientations) Distance() int
- func (co CornerOrientations) Get(index cmn.CornerIndex) CornerOrientation
- func (co CornerOrientations) IsSolved() bool
- func (co *CornerOrientations) Set(index cmn.CornerIndex, orientation CornerOrientation)
- type CornerPermutation
- func (cp CornerPermutation) AllInCorrectOrbit() bool
- func (cp CornerPermutation) AllInCorrectOrbitDistance() int
- func (cp *CornerPermutation) Apply(move cmn.Move)
- func (cp CornerPermutation) Distance() int
- func (cp CornerPermutation) Get(index cmn.CornerIndex) cmn.CornerIndex
- func (cp CornerPermutation) IsSolved() bool
- func (cp *CornerPermutation) Set(index, value cmn.CornerIndex)
- type CornerPermutationBits
- type Cube
- func (c *Cube) Apply(m cmn.Move)
- func (c *Cube) Blueprint() string
- func (c *Cube) Clone() cmn.Cube
- func (c Cube) Equal(o Cube) bool
- func (c *Cube) Get(coord cmn.CubeCoord) cmn.Side
- func (c *Cube) IsG1() bool
- func (c *Cube) IsG2() bool
- func (c *Cube) IsG2AssumingG1() bool
- func (c *Cube) IsG4() bool
- func (c *Cube) IsG4AssumingG3() bool
- func (c *Cube) IsSolved() bool
- func (c *Cube) NewSolver() cmn.Solver
- type EdgeOrientationBits
- type EdgeOrientations
- func (eo *EdgeOrientations) Apply(move cmn.Move)
- func (eo EdgeOrientations) Distance() int
- func (eo EdgeOrientations) Equal(other EdgeOrientations) bool
- func (eo EdgeOrientations) Get(index cmn.EdgeIndex) cmn.EdgeOrientation
- func (eo EdgeOrientations) IsSolved() bool
- func (eo *EdgeOrientations) Set(index cmn.EdgeIndex, orientation cmn.EdgeOrientation)
- type EdgePermutation
- func (ep EdgePermutation) AllInCorrectSlice() bool
- func (ep EdgePermutation) AllInCorrectSliceDistance() int
- func (ep *EdgePermutation) Apply(move cmn.Move)
- func (ep EdgePermutation) Distance() int
- func (ep EdgePermutation) Equal(other EdgePermutation) bool
- func (ep EdgePermutation) FRBLCorrectSliceDistance() int
- func (ep EdgePermutation) FRBLInCorrectSlice() bool
- func (ep EdgePermutation) FUBDCorrectSliceDistance() int
- func (ep EdgePermutation) FUBDInCorrectSlice() bool
- func (ep EdgePermutation) Get(index cmn.EdgeIndex) cmn.EdgeIndex
- func (ep EdgePermutation) IsSolved() bool
- func (ep *EdgePermutation) Set(index, value cmn.EdgeIndex)
- func (ep EdgePermutation) URBLCorrectSliceDistance() int
- func (ep EdgePermutation) URBLInCorrectSlice() bool
- type EdgePermutationBits
- type G3Cube
- type Solver
- func (s *Solver) IsG3(c *Cube) bool
- func (s *Solver) IsG3AssumingG2(c *Cube) bool
- func (s *Solver) PrintStats()
- func (s *Solver) Solve(cube cmn.Cube) []cmn.Move
- func (s *Solver) ToG1(c *Cube) []cmn.Move
- func (s *Solver) ToG2(c *Cube) []cmn.Move
- func (s *Solver) ToG2AssumingG1(c *Cube) []cmn.Move
- func (s *Solver) ToG3(c *Cube) []cmn.Move
- func (s *Solver) ToG3AssumingG2(c *Cube) []cmn.Move
- func (s *Solver) ToG4(c *Cube) []cmn.Move
- func (s *Solver) ToG4AssumingG3(c *Cube) []cmn.Move
Constants ¶
View Source
const ( LeftRight CornerOrientation = 0 UpDown CornerOrientation = 1 FrontBack CornerOrientation = 2 // Short forms LF = LeftRight UD = UpDown FB = FrontBack FirstCornerOrientation = LeftRight LastCornerOrientation = FrontBack CornerOrientationCount = 3 )
View Source
const DefaultCacheName = "rubik.cache"
Variables ¶
View Source
var EdgeOrientationMaskList = [6]EdgeOrientationBits{ EdgeOrientationMaskUp, EdgeOrientationMaskDown, EdgeOrientationMaskLeft, EdgeOrientationMaskRight, EdgeOrientationMaskFront, EdgeOrientationMaskBack, }
View Source
var G1Moves = makeG1Moves()
View Source
var G2Moves = makeG2Moves()
View Source
var G3Moves = makeG3Moves()
Functions ¶
func MakeG1CornerOrientationsTable ¶
func MakeG1CornerOrientationsTable() map[CornerOrientations]uint8
func MakeG2CornerPermutationTable ¶
func MakeG2CornerPermutationTable(g3 map[CornerPermutation]uint8) map[CornerPermutation]uint8
func MakeG2EdgePermutationTable ¶
func MakeG2EdgePermutationTable() map[EdgePermutation]uint8
func MakeG3CornerPermutationTable ¶
func MakeG3CornerPermutationTable() map[CornerPermutation]uint8
func MakeG3EdgePermutationTable ¶
func MakeG3EdgePermutationTable() map[EdgePermutation]uint8
func MakeG3HeuristicTable ¶
Types ¶
type CornerOrientation ¶
type CornerOrientation = uint8
type CornerOrientations ¶
type CornerOrientations struct {
Bits uint32
}
func NewCornerOrientationsSolved ¶
func NewCornerOrientationsSolved() CornerOrientations
func (*CornerOrientations) Apply ¶
func (co *CornerOrientations) Apply(move cmn.Move)
func (CornerOrientations) Distance ¶
func (co CornerOrientations) Distance() int
func (CornerOrientations) Get ¶
func (co CornerOrientations) Get(index cmn.CornerIndex) CornerOrientation
func (CornerOrientations) IsSolved ¶
func (co CornerOrientations) IsSolved() bool
func (*CornerOrientations) Set ¶
func (co *CornerOrientations) Set(index cmn.CornerIndex, orientation CornerOrientation)
type CornerPermutation ¶
type CornerPermutation struct {
Bits CornerPermutationBits
}
func NewCornerPermutationSolved ¶
func NewCornerPermutationSolved() CornerPermutation
func (CornerPermutation) AllInCorrectOrbit ¶
func (cp CornerPermutation) AllInCorrectOrbit() bool
func (CornerPermutation) AllInCorrectOrbitDistance ¶
func (cp CornerPermutation) AllInCorrectOrbitDistance() int
func (*CornerPermutation) Apply ¶
func (cp *CornerPermutation) Apply(move cmn.Move)
func (CornerPermutation) Distance ¶
func (cp CornerPermutation) Distance() int
func (CornerPermutation) Get ¶
func (cp CornerPermutation) Get(index cmn.CornerIndex) cmn.CornerIndex
func (CornerPermutation) IsSolved ¶
func (cp CornerPermutation) IsSolved() bool
func (*CornerPermutation) Set ¶
func (cp *CornerPermutation) Set(index, value cmn.CornerIndex)
type CornerPermutationBits ¶
type CornerPermutationBits = uint32
type Cube ¶
type Cube struct { EdgeOrientations EdgeOrientations EdgePermutation EdgePermutation CornerOrientations CornerOrientations CornerPermutation CornerPermutation }
func NewCubeSolved ¶
func NewCubeSolved() *Cube
func (*Cube) IsG2AssumingG1 ¶
func (*Cube) IsG4AssumingG3 ¶
type EdgeOrientationBits ¶
type EdgeOrientationBits = uint16
const ( EdgeOrientationMaskUp EdgeOrientationBits = 0b1001_0000_0101 EdgeOrientationMaskDown EdgeOrientationBits = 0b0110_0000_1010 EdgeOrientationMaskLeft EdgeOrientationBits = 0b0000_0011_0011 EdgeOrientationMaskRight EdgeOrientationBits = 0b0000_1100_1100 EdgeOrientationMaskFront EdgeOrientationBits = 0b0011_0110_0000 EdgeOrientationMaskBack EdgeOrientationBits = 0b1100_1001_0000 )
type EdgeOrientations ¶
type EdgeOrientations struct {
Bits EdgeOrientationBits
}
func NewEdgeOrientationsSolved ¶
func NewEdgeOrientationsSolved() EdgeOrientations
func (*EdgeOrientations) Apply ¶
func (eo *EdgeOrientations) Apply(move cmn.Move)
func (EdgeOrientations) Distance ¶
func (eo EdgeOrientations) Distance() int
func (EdgeOrientations) Equal ¶
func (eo EdgeOrientations) Equal(other EdgeOrientations) bool
func (EdgeOrientations) Get ¶
func (eo EdgeOrientations) Get(index cmn.EdgeIndex) cmn.EdgeOrientation
func (EdgeOrientations) IsSolved ¶
func (eo EdgeOrientations) IsSolved() bool
func (*EdgeOrientations) Set ¶
func (eo *EdgeOrientations) Set(index cmn.EdgeIndex, orientation cmn.EdgeOrientation)
type EdgePermutation ¶
type EdgePermutation struct {
Bits EdgePermutationBits
}
func NewEdgePermutationSolved ¶
func NewEdgePermutationSolved() EdgePermutation
func (EdgePermutation) AllInCorrectSlice ¶
func (ep EdgePermutation) AllInCorrectSlice() bool
func (EdgePermutation) AllInCorrectSliceDistance ¶
func (ep EdgePermutation) AllInCorrectSliceDistance() int
func (*EdgePermutation) Apply ¶
func (ep *EdgePermutation) Apply(move cmn.Move)
func (EdgePermutation) Distance ¶
func (ep EdgePermutation) Distance() int
func (EdgePermutation) Equal ¶
func (ep EdgePermutation) Equal(other EdgePermutation) bool
func (EdgePermutation) FRBLCorrectSliceDistance ¶
func (ep EdgePermutation) FRBLCorrectSliceDistance() int
func (EdgePermutation) FRBLInCorrectSlice ¶
func (ep EdgePermutation) FRBLInCorrectSlice() bool
func (EdgePermutation) FUBDCorrectSliceDistance ¶
func (ep EdgePermutation) FUBDCorrectSliceDistance() int
func (EdgePermutation) FUBDInCorrectSlice ¶
func (ep EdgePermutation) FUBDInCorrectSlice() bool
func (EdgePermutation) IsSolved ¶
func (ep EdgePermutation) IsSolved() bool
func (*EdgePermutation) Set ¶
func (ep *EdgePermutation) Set(index, value cmn.EdgeIndex)
func (EdgePermutation) URBLCorrectSliceDistance ¶
func (ep EdgePermutation) URBLCorrectSliceDistance() int
func (EdgePermutation) URBLInCorrectSlice ¶
func (ep EdgePermutation) URBLInCorrectSlice() bool
type EdgePermutationBits ¶
type EdgePermutationBits = uint64
const ( EdgePermutationMaskUp EdgePermutationBits = 0b111_000_000_111_000_000_000_000_000_111_000_111 EdgePermutationMaskDown EdgePermutationBits = 0b000_111_111_000_000_000_000_000_111_000_111_000 EdgePermutationMaskLeft EdgePermutationBits = 0b000_000_000_000_000_000_111_111_000_000_111_111 EdgePermutationMaskRight EdgePermutationBits = 0b000_000_000_000_111_111_000_000_111_111_000_000 EdgePermutationMaskFront EdgePermutationBits = 0b000_000_111_111_000_111_001_000_000_000_000_000 EdgePermutationMaskBack EdgePermutationBits = 0b111_111_000_000_111_000_000_111_000_000_000_000 )
type Solver ¶
type Solver struct { G1CornerHeuristicTable map[CornerOrientations]uint8 G2EdgeHeuristicTable map[EdgePermutation]uint8 G2CornerHeuristicTable map[CornerPermutation]uint8 G3HeuristicTable map[Cube]uint8 }
func GetGlobalSolver ¶
func GetGlobalSolver() *Solver
func (*Solver) IsG3AssumingG2 ¶
func (*Solver) PrintStats ¶
func (s *Solver) PrintStats()
Click to show internal directories.
Click to hide internal directories.