Nonogram solver on Golang
You can use your favourite dependency manager and add import like:
import (
"github.com/ODAEL/nonogo/holder"
)
package main
import (
"github.com/ODAEL/nonogo/holder"
"github.com/ODAEL/nonogo/solver"
)
func main() {
topBox := holder.Box{Numbers: [][]int{
{3}, {4}, {1, 4}, {9, 1}, {13}, {4, 8}, {2, 7}, {3, 8}, {2, 7}, {7}, {6}, {4}, {3},
}}
leftBox := holder.Box{Numbers: [][]int{
{2, 2}, {6}, {5}, {5}, {2, 2}, {8}, {10}, {9}, {11}, {10}, {9}, {8}, {3, 4},
}}
nonogram := holder.BuildEmptyNonogram(13, 13)
nonogram.TopBox = topBox
nonogram.LeftBox = leftBox
solver.Solve(&nonogram)
printer := holder.CmdNonogramPrinter{Nonogram: nonogram}
printer.PrintField()
// Output:
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓
// ┃><><><><████><████><><><><┃
// ┃><><><████████████><><><><┃
// ┃><><><██████████><><><><><┃
// ┃><██████████><><><><><><><┃
// ┃████><████><><><><><><><><┃
// ┃████████████████><><><><><┃
// ┃████████████████████><><><┃
// ┃><><██████████████████><><┃
// ┃><><██████████████████████┃
// ┃><><><████████████████████┃
// ┃><><><><██████████████████┃
// ┃><><><><████████████████><┃
// ┃><><><██████><████████><><┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛
}
Each package contains a tests which can be run with go test ./...
- stretchr/testify/assert - Library for asserts in tests
- Aleksander Penko - Initial work - ODAEL
This project is licensed under the MIT License - see the LICENSE file for details