Exemplo n.º 1
0
func handleConnection(c net.Conn) {
	buffer := make([]byte, 2048)

	_, err := c.Read(buffer)
	if err != nil {
		fmt.Printf("ERROR on read\n")
	}

	solvable, solution := minisat.SolveDIMACS(string(buffer))
	if solvable {
		c.Write(writeSolution(solution))
	} else {
		c.Write([]byte("0\n"))
	}
	c.Close()
}
Exemplo n.º 2
0
func test1() {
	fmt.Printf("TEST 1\n***\n")
	problem := "1 0\n-1 2 0\n2 0"
	solvable, _ := minisat.SolveDIMACS(problem)
	fmt.Printf("Solvable: %t\n", solvable)
}