Make godoc happy, and add extra comments.

This commit is contained in:
2025-01-28 00:31:02 +01:00
parent 6b0e55e3f9
commit 6dd5d2f232
11 changed files with 55 additions and 17 deletions

View File

@ -8,6 +8,7 @@ import (
"runtime"
)
// Parse command-line parameters, test input, store them in the Controller.
func (flags *Flags) ParseFlags() {
// Define parameters
@ -73,6 +74,11 @@ func (flags *Flags) ParseFlags() {
}
// Validate if a row is properly set.
// This check for:
// - Correct length
// - Correct numbers
// - Numbers only present once
func (flags *Flags) validateRow(name string, row string) {
var found bool
@ -116,6 +122,7 @@ func (flags *Flags) validateRow(name string, row string) {
}
// Validate if the char provided is 0-9
func (flags *Flags) validChar(char rune) (valid bool) {
decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
@ -128,6 +135,7 @@ func (flags *Flags) validChar(char rune) (valid bool) {
return
}
// Print help information for the end-user
func (flags *Flags) printUsage() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
fmt.Fprintf(flag.CommandLine.Output(), "\nPut every row of a Sudoku puzzle as paramters.\nUse '0' for what is currently blank in the puzzle you wish to solve.\n\n")

View File

@ -2,6 +2,7 @@ package flags
import "gitea.ligthert.net/golang/sudoku-funpark/controller"
// Interface to parse command-line parameters
type Flags struct {
Controller *controller.Controller
}