Documentation
¶
Index ¶
- Variables
- func BoardCanBeSolvedToSpace(b tango.Board, p tango.BoardPos) bool
- func UnsolveBoard(b *tango.Board, n int) error
- type AlmostFullRule
- type BigGapRule
- type EqualGapRule
- type EqualInferenceRule
- type GapRule
- type HalfModifierRule
- type InARowRule
- type InverseBigGapRule
- type OppositeInferenceRule
- type PairGapRule
- type SolveRule
- type TouchingPairRule
Constants ¶
This section is empty.
Variables ¶
var (
ErrSolverStuck error = errors.New("solver stuck")
)
var (
ErrUnsolverStuck = errors.New("unsolver stuck")
)
var SolveRules = []SolveRule{ HalfModifierRule{}, AlmostFullRule{}, InARowRule{}, GapRule{}, BigGapRule{}, TouchingPairRule{}, OppositeInferenceRule{}, EqualInferenceRule{}, EqualGapRule{}, PairGapRule{}, InverseBigGapRule{}, }
Functions ¶
func BoardCanBeSolvedToSpace ¶
Returns true if the given board can be solved to infer the symbol at the given position.
Types ¶
type AlmostFullRule ¶
type AlmostFullRule struct{}
Rule 2: If a row contains 3 of a value, the other 3 spaces must be the other value
func (AlmostFullRule) TryApplyTo ¶
func (r AlmostFullRule) TryApplyTo(s *tango.BoardSegment) bool
type BigGapRule ¶
type BigGapRule struct{}
Rule 5: If the first and last symbol of the line are the same, the inner next 2 must be the opposite symbol
func (BigGapRule) TryApplyTo ¶
func (r BigGapRule) TryApplyTo(s *tango.BoardSegment) bool
type EqualGapRule ¶
type EqualGapRule struct{}
Rule 9: A blank = at one end of the board must be the opposite of the symbol at the other end
func (EqualGapRule) TryApplyTo ¶
func (r EqualGapRule) TryApplyTo(s *tango.BoardSegment) bool
type EqualInferenceRule ¶
type EqualInferenceRule struct{}
Rule 8: A blank = with 2 of a symbol present mean the = must be filled with the opposite symbol
func (EqualInferenceRule) TryApplyTo ¶
func (r EqualInferenceRule) TryApplyTo(s *tango.BoardSegment) bool
type GapRule ¶
type GapRule struct{}
Rule 4: If there is a blank tile surrounded by 2 of the same tile, the blank tile must be the opposite of the surrounding tile
func (GapRule) TryApplyTo ¶
func (r GapRule) TryApplyTo(s *tango.BoardSegment) bool
type HalfModifierRule ¶
type HalfModifierRule struct{}
Rule 1: if half a modifier is filled, fill its other half
func (HalfModifierRule) TryApplyTo ¶
func (r HalfModifierRule) TryApplyTo(s *tango.BoardSegment) bool
type InARowRule ¶
type InARowRule struct{}
Rule 3: if there are 2 of a symbol in a row, they must be surrounded on either side by the opposite symbol
func (InARowRule) TryApplyTo ¶
func (r InARowRule) TryApplyTo(s *tango.BoardSegment) bool
type InverseBigGapRule ¶
type InverseBigGapRule struct{}
Rule 11: If one end is the same as the one second from the other end, the other end must be the opposite symbol (implied by the Big Gap Rule)
func (InverseBigGapRule) TryApplyTo ¶
func (r InverseBigGapRule) TryApplyTo(s *tango.BoardSegment) bool
type OppositeInferenceRule ¶
type OppositeInferenceRule struct{}
Rule 7: A blank x implies there will be one more of each symbol on this row. This can be used to deduce the remaining symbols.
func (OppositeInferenceRule) TryApplyTo ¶
func (r OppositeInferenceRule) TryApplyTo(s *tango.BoardSegment) bool
type PairGapRule ¶
type PairGapRule struct{}
Rule 10: Rule 9 reversed for if its an existing pair instead of a blank =
func (PairGapRule) TryApplyTo ¶
func (r PairGapRule) TryApplyTo(s *tango.BoardSegment) bool
type SolveRule ¶
type SolveRule interface { // Apply this rule to the given board segment. Returns true if the segment is edited by the rule. TryApplyTo(s *tango.BoardSegment) bool }
type TouchingPairRule ¶
type TouchingPairRule struct{}
Rule 6: If there is a symbol next to a blank =, the = must be of the opposite value to the symbol it is next to
func (TouchingPairRule) TryApplyTo ¶
func (r TouchingPairRule) TryApplyTo(s *tango.BoardSegment) bool