Exemplo n.º 1
0
func main() {
	sc, err := gocube.InputStickerCube()
	if err != nil {
		fmt.Println("Failed to read stickers:", err)
		os.Exit(1)
	}
	cc, err := sc.CubieCube()
	if err != nil {
		fmt.Println("Invalid stickers:", err)
		os.Exit(1)
	}
	heuristic := NewEdgesHeuristic(5)

	if cc.Corners[1].Piece == 1 && cc.Corners[1].Orientation == 1 {
		thirdF2LCorner = 1
	} else if cc.Corners[5].Piece == 5 && cc.Corners[5].Orientation == 1 {
		thirdF2LCorner = 5
	}

	for depth := 0; depth <= 20; depth++ {
		fmt.Println("Searching depth", depth)
		if solution := Search(*cc, heuristic, depth); solution != nil {
			fmt.Println("Got a solution:", solution)
			break
		}
	}
}
Exemplo n.º 2
0
func main() {
	sc, err := gocube.InputStickerCube()
	if err != nil {
		fmt.Println("Failed to read stickers:", err)
		os.Exit(1)
	}
	cc, err := sc.CubieCube()
	if err != nil {
		fmt.Println("Invalid stickers:", err)
		os.Exit(1)
	}
	solutions := fmc.ThreeStepF2LMinus1(*cc)
	for solution := range solutions {
		fmt.Println("Solution (", len(solution), "): ", solution)
	}
}
Exemplo n.º 3
0
func main() {
	// Get input.
	sc, err := gocube.InputStickerCube()
	if err != nil {
		fmt.Println("Failed to read stickers:", err)
		os.Exit(1)
	}
	cc, err := sc.CubieCube()
	if err != nil {
		fmt.Println("Invalid stickers:", err)
		os.Exit(1)
	}

	fmt.Println("Solving...")
	solver := gocube.NewSolver(*cc, 30)
	for solution := range solver.Solutions() {
		fmt.Println("Solution:", solution, "-", len(solution), "moves")
	}
}
Exemplo n.º 4
0
func main() {
	// Get input.
	sc, err := gocube.InputStickerCube()
	if err != nil {
		fmt.Println("Failed to read stickers:", err)
		os.Exit(1)
	}
	cc, err := sc.CubieCube()
	if err != nil {
		fmt.Println("Invalid stickers:", err)
		os.Exit(1)
	}

	fmt.Println("Generating data...")
	moves := gocube.NewPhase1Moves()
	heuristic := gocube.NewPhase1Heuristic(moves)

	fmt.Println("Searching...")
	solver := gocube.NewPhase1Solver(cc.Phase1Cube(), heuristic, moves)
	for solution := range solver.Solutions() {
		fmt.Println(solution.Moves, "-", len(solution.Moves), "moves")
	}
}