]> git.scottworley.com Git - slidingtile/commitdiff
Incomplete thoughts
authorScott Worley <scottworley@scottworley.com>
Tue, 29 Dec 2015 08:11:19 +0000 (00:11 -0800)
committerScott Worley <scottworley@scottworley.com>
Tue, 29 Dec 2015 08:11:19 +0000 (00:11 -0800)
sliding_tile.go

index 96e00dcc85645a6d997a878028adf06bf42e4af6..68cd4b1292f49b8a8c8f5a1c6bd7439bf5951f28 100644 (file)
@@ -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)
 }