Skip to content

Instantly share code, notes, and snippets.

@manveru
Created April 14, 2010 11:59
Show Gist options
  • Save manveru/365724 to your computer and use it in GitHub Desktop.
Save manveru/365724 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type Point struct {
a, b, c, d, e int
}
func main(){
points := newPoints(
0,0,0,0,0,
1,0,0,0,0,
1,1,0,0,0,
1,1,1,0,0,
1,1,1,0,0,
)
fmt.Println(points)
}
func newPoints(ints ... int) []Point {
amount := len(ints) / 5
points := make([]Point, amount)
fmt.Println(amount)
for i := 0; i < amount; i++ {
offset := i * 5
point := Point{
ints[offset],
ints[offset + 1],
ints[offset + 2],
ints[offset + 3],
ints[offset + 4],
}
fmt.Println(point)
points[i] = point
}
return points
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment