Git Product home page Git Product logo

gocellular's People

Contributors

gabo-tor avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

gocellular's Issues

asdfghj

Basic suggestions

for i, c := range board {

for i, c := range board {
    if i > 0 && i < SIZE-1 {
//becomes
for i := 1; i<SIZE-1;i++ {
    c := board[i]
    // same suggestion for inner loops

if Neighbour == 1 {

if Neighbour == 1 {
// extract contents of `if` to a function countNeighborsMoore?

OOP-ish suggestions

Encapsulate board logic in a type

type game struct {
    board tensor3 // tensor3 type with contiguous allocation, stride mem access if you want to needlessly optimize, if not already existing [][][]uint8 is good enough
    rules int // Moore==1, neumann==0 
}

//suggestion for tensor3
type tensor3 struct {
   data []uint8
   r, c, d int //row, column, depth
   // dynamic stride completely useless if no resizing going on
   //stride1 int 
   //stride2 int
}

// set assigns v to element at position (i,j,k) of 3D tensor
func (t tensor3) set(i, j, k int, v uint8) {
    // row major, depth minor. not sure if this is correct though
    t.data[k + j*t.d + i*t.d*t.c] = v // 🤷
}

and add logic as methods to game

Use go modules

Use go modules so users can run the program and track go.mod file for reproducible builds.

Steps:

  1. Initialize the module running go mod init gocellular in the base directory. This generates an empty go.mod file with the name of the module "gocellular".
  2. run go mod tidy. The go tool will then fetch dependencies for the project and update the go.mod file. The tool will also generate the go.sum file, which provides the project with exact versions for all required modules ensuring reproducible builds with these two files. This file is not "required" but helps ensure consistent builds.

The result is that now anyone who clones the application with the go.mod file can run the application from scratch. Take that virtual environments.

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.