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
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v3.2.0
|
rev: v5.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: check-added-large-files
|
- 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.
|
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
|
## Usage
|
||||||
To use the sudoku solver, run the binary with all the parameters available:
|
To use the sudoku solver, run the binary with all the parameters available:
|
||||||
```
|
```
|
||||||
Usage of ./sudoku-funpark:
|
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
|
-row1 string
|
||||||
1st row of the sudoku puzzle. (default "000000000")
|
1st row of the sudoku puzzle. (default "000000000")
|
||||||
-row2 string
|
-row2 string
|
||||||
@ -31,6 +40,8 @@ Usage of ./sudoku-funpark:
|
|||||||
8th row of the sudoku puzzle. (default "000000000")
|
8th row of the sudoku puzzle. (default "000000000")
|
||||||
-row9 string
|
-row9 string
|
||||||
9th row of the sudoku puzzle. (default "000000000")
|
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.
|
Instead of using the 3x3 blocks with 3x3 digits, it uses horizontal rows from top to bottom.
|
||||||
|
@ -21,6 +21,7 @@ tasks:
|
|||||||
silent: true
|
silent: true
|
||||||
precommit:
|
precommit:
|
||||||
cmds:
|
cmds:
|
||||||
|
- pre-commit autoupdate
|
||||||
- pre-commit run --all
|
- pre-commit run --all
|
||||||
silent: true
|
silent: true
|
||||||
lint:
|
lint:
|
||||||
@ -33,3 +34,7 @@ tasks:
|
|||||||
- rm {{.BUILD_DIR}}/* || true
|
- 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
|
- 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
|
- 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 {
|
func (solver *Solver) valid_char(char rune) (valid bool) {
|
||||||
var valid bool
|
|
||||||
decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
|
decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
|
||||||
|
|
||||||
for _, value := range decvals {
|
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 {
|
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) {
|
||||||
var retval bool
|
|
||||||
retval = true
|
retval = true
|
||||||
|
|
||||||
row1s := strconv.Itoa(row1)
|
row1s := strconv.Itoa(row1)
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The main loop that orchastrates all the logic.
|
||||||
func Run() {
|
func Run() {
|
||||||
// Instantiate the Solver interface
|
// Instantiate the Solver interface
|
||||||
solver := Solver{}
|
solver := Solver{}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Struct/Interface containing all the important variabes it functions need access to.
|
||||||
type Solver struct {
|
type Solver struct {
|
||||||
blocks []int
|
blocks []int
|
||||||
row1 string
|
row1 string
|
||||||
|
Reference in New Issue
Block a user