Git Product home page Git Product logo

life's People

Contributors

andydotxyz avatar jacalz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

life's Issues

Error when building with fyne get

I'm getting this error when trying to build the app with fyne get on MacOS (Intel, Monterey):

$ fyne get github.com/fyne-io/life

go: downloading fyne.io/fyne/v2 v2.0.0
go: downloading github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200625191551-73d3c3675aa3
go: downloading github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
go: downloading golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
go: downloading golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666
go: downloading golang.org/x/text v0.3.2
# golang.org/x/sys/unix
../../../../pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:29:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.1_13.go:40:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:28:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:43:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:59:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:75:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:90:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:105:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:121:3: //go:linkname must refer to declared function or variable
../../../../pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_amd64.go:121:3: too many errors

Error building application: exit status 2

Seems like an outdated dependency.

question

I m sorry i m not lawyer, if I want copy this repository, I have to "only" copy your licence or add somethings?

improvements

I sugest these changes:

  1. add to board nextGenCells:
type board struct {
	cells         [][]bool
	nextGenCells  [][]bool
	generation    int
	width, height int
}
  1. change nextGen() to not copy version :
func (b *board) nextGen() {
	b.computeNextGen()
	b.generation++
	b.nextGenCells, b.cells = b.cells, b.nextGenCells
}
  1. change computeNextGen() to not create version:
func (b *board) computeNextGen() {
	for y := 0; y < b.height; y++ {
		for x := 0; x < b.width; x++ {
			n := b.countNeighbours(x, y)
			if b.cells[y][x] {
				b.nextGenCells[y][x] = n == 2 || n == 3
			} else {
				b.nextGenCells[y][x] = n == 3
			}
		}
	}
}
  1. maybe change computeNextGen() to concurrent version:
func (b *board) computeNextGen() {
	for y := 0; y < b.height; y++ {
		for x := 0; x < b.width; x++ {
			go func(x,y int) {
				n := b.countNeighbours(x, y)
				if b.cells[y][x] {
					b.nextGenCells[y][x] = n == 2 || n == 3
				} else {
					b.nextGenCells[y][x] = n == 3
				}
				b.ch<-true
			}(x,y)
		}
	}
	for y := 0; y < b.height; y++ {
		for x := 0; x < b.width; x++ {
			<-b.ch
		}
	}
}
  1. update buildUI() to container.new :
func (g *game) buildUI() fyne.CanvasObject {
	var pause *widget.Button
	pause = widget.NewButton("Pause", func() {
		g.paused = !g.paused

		if g.paused {
			pause.SetText("Resume")
		} else {
			pause.SetText("Pause")
		}
	})

	title := container.New(layout.NewGridLayout(2), g.genText, pause)
	return container.New(layout.NewBorderLayout(title, nil, nil, nil), title, g)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.