it now compiles but does not function

This commit is contained in:
Kistaro Windrider 2024-02-05 18:21:52 -08:00
parent de0b82e7d7
commit 61d2574fcb
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

32
uckf.go
View File

@ -6,10 +6,10 @@ import (
"flag"
"fmt"
"log"
"math.rand"
"math/rand"
)
var edgeSize = flag.Int("n", 8, "Cells per side")
var edgeSize = flag.Int("n", 4, "Cells per side")
type scanState int
const (
@ -29,32 +29,34 @@ func main() {
for i := 0; i < *edgeSize; i++ {
fuckingRow := make([]byte, *edgeSize)
for j := 0; j < *edgeSize; j++ {
fuckingRow[j] = (i+j)%4
fuckingRow[j] = byte((i+j)%4)
}
board=append(board, fuckingRow)
}
dump(board, "Starting position")
evals := [][]fuckness
var evals [][]fuckness
for i := 0; i < *edgeSize; i++ {
evals = append(evals, make([]fuckness, *edgeSize))
}
iterations := uint64(0)
scream := uint64(1)
for(isStillFucked(board, evals)) {
fuckUp(board, evals)
iterations++
if isPow2(iterations) {
if iterations >= scream {
dump(board, fmt.Sprint("Iteration", iterations))
scream = iterations << 1
}
}
dump(board, "Not a single fuck")
}
func onBoard(i, j) {
return i > 0 && j > 0 && i < *edgeSize && j < &edgeSize
func onBoard(i, j int) bool {
return i > 0 && j > 0 && i < *edgeSize && j < *edgeSize
}
func charAt(board [][]byte, i, j int) byte {
if !onBoard(i, j) {
@ -63,7 +65,7 @@ func charAt(board [][]byte, i, j int) byte {
return board[i][j]
}
func isStillFucked(board [][]byte, evals[][]fuckness) {
func isStillFucked(board [][]byte, evals[][]fuckness) bool {
isFucked := false
for i, row := range board {
for j, c := range row {
@ -72,15 +74,19 @@ func isStillFucked(board [][]byte, evals[][]fuckness) {
if dr == 0 && dc == 0 {
continue
}
if evals[i][j][dr+1][dc+1] == Fucked {
isFucked = true
continue
}
if evals[i][j][dr+1][dc+1] != FuckIfIKnow {
continue
}
// find theoretical start of fuck
fRow, fCol := i + int(c)*dr, j + int(c)*dr
fRow, fCol := i + int(c)*-dr, j + int(c)*-dc
// evaluate fuckness
locallyFucked := true
for w := 0; w < 4; w++ {
if charAt(board, i+w*dr, j+w*dc) != byte(w) {
if charAt(board, fRow+w*dr, fCol+w*dc) != byte(w) {
locallyFucked = false
break
}
@ -154,8 +160,8 @@ func fuckUp(board [][]byte, evals [][]fuckness) {
continue
}
i2, j2 := -1, -1
for(head++; head < len(todo); head++) {
item2 := todo(head)
for head++; head < len(todo); head++ {
item2 := todo[head]
itmp, jtmp := item2[0], item2[1]
if(isFucked(evals[itmp][jtmp])) {
i2, j2 = itmp, jtmp
@ -175,7 +181,7 @@ func fuckUp(board [][]byte, evals [][]fuckness) {
}
}
func unevaluate(evals [][]fuckness, i, j) {
func unevaluate(evals [][]fuckness, i, j int) {
for dr := -1; dr <= 1; dr++ {
for dc := -1; dc <= 1; dc++ {
for x := -3; x < 4; x++ {