From 7f5c9f30dc5d85bf4d197ca77215ce1e9677cb1e Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 3 Jul 2014 19:34:50 -0700 Subject: Add option to keep maxim fixed --- capset.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/capset.go b/capset.go index c0b9bbe..2b182cb 100644 --- a/capset.go +++ b/capset.go @@ -190,6 +190,9 @@ type Capset struct { maxim int // hasSet is true if the current tableau contains at least one set. hasSet bool + // fixedMaxim is false when maxim should be increased as larger capsets are + // found. + fixedMaxim bool } // NewCapset makes an initialized Capset for the provided deck. If maxim is -1, @@ -301,7 +304,9 @@ func (cs *Capset) FindNextCapset() bool { if len(cs.tableau) < cs.maxim { continue } - cs.maxim = len(cs.tableau) + if !cs.fixedMaxim { + cs.maxim = len(cs.tableau) + } return true } return false @@ -339,6 +344,8 @@ func main() { flag.PrintDefaults() } initialMaxim := flag.Int("maxim", -1, "initial maxim to use; -1 for auto") + fixedMaxim := flag.Bool("fixed-maxim", false, + "maxim does not change when larger capset is found") saveFile := flag.String("save-file", "", "file to save progress to") flag.Parse() @@ -371,6 +378,7 @@ func main() { if cs == nil { cs = NewCapset(d, *initialMaxim) } + cs.fixedMaxim = *fixedMaxim fmt.Println("Starting processing with", cs.tableau) for cs.FindNextCapset() { -- cgit v1.2.3-54-g00ecf