25 lines
471 B
Go
25 lines
471 B
Go
// File: n_queens_test.go
|
|
// Created Time: 2023-05-14
|
|
// Author: Reanon (793584285@qq.com)
|
|
|
|
package chapter_backtracking
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestNQueens(t *testing.T) {
|
|
n := 4
|
|
res := nQueens(n)
|
|
|
|
fmt.Println("Input the dimensions of the chessboard as", n)
|
|
fmt.Println("Total number of queen placement options ", len(res), "")
|
|
for _, state := range res {
|
|
fmt.Println("--------------------")
|
|
for _, row := range state {
|
|
fmt.Println(row)
|
|
}
|
|
}
|
|
}
|