From: Scott Worley Date: Tue, 29 Dec 2015 08:11:19 +0000 (-0800) Subject: Incomplete thoughts X-Git-Url: http://git.scottworley.com/slidingtile/commitdiff_plain/2bf3412d1ed0c9da3c83d9ca276a7c91e4356d6a?ds=inline Incomplete thoughts --- diff --git a/sliding_tile.go b/sliding_tile.go index 96e00dc..68cd4b1 100644 --- a/sliding_tile.go +++ b/sliding_tile.go @@ -1,15 +1,27 @@ package main +import "flag" import "fmt" import "os" +import "reflect" import "strconv" +import "github.com/petar/GoLLRB/llrb" +import "github.com/willf/bloom" + +var bloomsize = flag.Int("bloomsize", 2000000, "Size bloomfilter for this many states.") + const HOLE = 0 const BOARD_DIM = 4 const BOARD_SIZE = BOARD_DIM * BOARD_DIM type Space int8 type Board [BOARD_SIZE]Space +type Step struct { + board Board + prev *Step + length int +} const ( LEFT = -1 @@ -53,10 +65,26 @@ func adjacent_spaces(s Space) []Space { return adjacent } +func create_successors(start *Step) { + for _, adj := adjacent_spaces(start. +} + +func sliding_tile(start *Board) error { + seen := bloom.NewWithEstimates(uint(*bloomsize), 0.0001) + seen.Add(reflect.ValueOf(*start).Bytes()) + return nil +} + func main() { - start, err := read_board_from_strings(os.Args[1:]) + flag.Parse() + start, err := read_board_from_strings(flag.Args()) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + err = sliding_tile(start) if err != nil { - panic(err) + fmt.Println(err) + os.Exit(1) } - fmt.Println(start) }