Compare commits
7 Commits
v20250126
...
0e3aa42b78
Author | SHA1 | Date | |
---|---|---|---|
0e3aa42b78 | |||
c72bc6b0e5 | |||
c73c88679a | |||
81b44e1702 | |||
c8f897cf8d | |||
c0525c2bc8 | |||
3f6ba6e9dc |
20
.gitea/workflows/demo.txt
Normal file
20
.gitea/workflows/demo.txt
Normal file
@ -0,0 +1,20 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
@ -2,9 +2,17 @@
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/dnephin/pre-commit-golang
|
||||
rev: v0.5.1
|
||||
hooks:
|
||||
- id: go-fmt
|
||||
- id: go-imports
|
||||
- id: no-go-testing
|
||||
- id: golangci-lint
|
||||
- id: go-unit-tests
|
||||
|
11
README.md
11
README.md
@ -9,10 +9,19 @@ _(This was a learning project to get a better grasp of Golang. But more importan
|
||||
|
||||
I wrote [a blog post](https://blog.ligthert.net/posts/exploration-fun-and-process-cycles-of-sudoku/) about this.
|
||||
|
||||
## Features
|
||||
* Worlds least efficient Sudoku solver
|
||||
* Ability to assign a number of CPU cores to this task
|
||||
* Split workloads among several computers
|
||||
|
||||
## Usage
|
||||
To use the sudoku solver, run the binary with all the parameters available:
|
||||
```
|
||||
Usage of ./sudoku-funpark:
|
||||
-numcpu int
|
||||
Number of CPU cores to assign to this task. (default 12)
|
||||
-part int
|
||||
Process part x in n parts. Cannot be lower than 1, or higher than specified in split. (default 1)
|
||||
-row1 string
|
||||
1st row of the sudoku puzzle. (default "000000000")
|
||||
-row2 string
|
||||
@ -31,6 +40,8 @@ Usage of ./sudoku-funpark:
|
||||
8th row of the sudoku puzzle. (default "000000000")
|
||||
-row9 string
|
||||
9th row of the sudoku puzzle. (default "000000000")
|
||||
-split int
|
||||
Split the tasks in n parts. This depends on the availability of the first row. (default 1)
|
||||
```
|
||||
|
||||
Instead of using the 3x3 blocks with 3x3 digits, it uses horizontal rows from top to bottom.
|
||||
|
@ -21,6 +21,7 @@ tasks:
|
||||
silent: true
|
||||
precommit:
|
||||
cmds:
|
||||
- pre-commit autoupdate
|
||||
- pre-commit run --all
|
||||
silent: true
|
||||
lint:
|
||||
@ -33,3 +34,7 @@ tasks:
|
||||
- rm {{.BUILD_DIR}}/* || true
|
||||
- go tool dist list | grep -v android | grep -v ios | grep -v wasip1 | awk -F '/' '{printf "echo Compiling %s/%s; env CGO_ENABLED=1 GOOS=%s GOARCH=%s go build -o {{.BUILD_DIR}}/{{.APP}}.%s-%s\n",$1,$2,$1,$2,$1,$2 }' | sh
|
||||
- for i in `ls {{.BUILD_DIR}}/*windows*`; do mv -v $i $i.exe; done
|
||||
gource:
|
||||
cmds:
|
||||
- gource --auto-skip-seconds 1 --key -r 60
|
||||
silent: true
|
||||
|
@ -143,8 +143,7 @@ func (solver *Solver) validate_row(name string, row string) {
|
||||
|
||||
}
|
||||
|
||||
func (solver *Solver) valid_char(char rune) bool {
|
||||
var valid bool
|
||||
func (solver *Solver) valid_char(char rune) (valid bool) {
|
||||
decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
|
||||
|
||||
for _, value := range decvals {
|
||||
|
@ -178,8 +178,7 @@ func (solver *Solver) tracker() {
|
||||
|
||||
}
|
||||
|
||||
func (solver *Solver) validate_combination(row1 int, row2 int, row3 int, row4 int, row5 int, row6 int, row7 int, row8 int, row9 int) bool {
|
||||
var retval bool
|
||||
func (solver *Solver) validate_combination(row1 int, row2 int, row3 int, row4 int, row5 int, row6 int, row7 int, row8 int, row9 int) (retval bool) {
|
||||
retval = true
|
||||
|
||||
row1s := strconv.Itoa(row1)
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// The main loop that orchastrates all the logic.
|
||||
func Run() {
|
||||
// Instantiate the Solver interface
|
||||
solver := Solver{}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// Struct/Interface containing all the important variabes it functions need access to.
|
||||
type Solver struct {
|
||||
blocks []int
|
||||
row1 string
|
||||
|
Reference in New Issue
Block a user