mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-17 12:40:56 +01:00
changed grid data type to bool, save mem and better perf
This commit is contained in:
10
src/rule.go
10
src/rule.go
@@ -9,17 +9,17 @@ import (
|
||||
// a GOL rule
|
||||
type Rule struct {
|
||||
Definition string
|
||||
Birth []int64
|
||||
Death []int64
|
||||
Birth []int
|
||||
Death []int
|
||||
}
|
||||
|
||||
// parse one part of a GOL rule into rule slice
|
||||
func NumbersToList(numbers string) []int64 {
|
||||
list := []int64{}
|
||||
func NumbersToList(numbers string) []int {
|
||||
list := []int{}
|
||||
|
||||
items := strings.Split(numbers, "")
|
||||
for _, item := range items {
|
||||
num, err := strconv.ParseInt(item, 10, 64)
|
||||
num, err := strconv.Atoi(item)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to parse game rule part <%s>: %s", numbers, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user