diff options
Diffstat (limited to 'capset.go')
-rw-r--r-- | capset.go | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -11,6 +11,8 @@ import ( "log" "math" "os" + "flag" + "strconv" ) var maximForDim = []int{1, 2, 4, 9, 20, 45, 112, 236} @@ -157,7 +159,7 @@ func (cs *Capset) incrementTableau() bool { index = cs.d.card2int(cs.popTableau()) + 1 if len(cs.tableau) == 1 { fmt.Println("incrementing second card to index", index) - if index+18 > len(cs.d.cards) { + if index+cs.maxim-2 > len(cs.d.cards) { return false } } @@ -274,7 +276,17 @@ func loadFromSave(d *Deck) *Capset { } func main() { - d := NewDeck(4) + flag.Parse() + args := flag.Args() + if len(args) != 1 { + fmt.Println("Usage: capset dim\n\tdim int := number of dimensions/attributes") + log.Fatal("Improper Usage") + } + dim, err := strconv.Atoi(args[0]) + if err != nil { + log.Fatal(err) + } + d := NewDeck(dim) cs := loadFromSave(d) if cs == nil { cs = NewCapset(d, -1) |