Skip to content

Commit 43289ff

Browse files
committed
Start arena with nondeterministic food locations
1 parent d720999 commit 43289ff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

snake/arena.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package snake
22

3-
import "math/rand"
3+
import (
4+
"math/rand"
5+
"time"
6+
)
47

58
type arena struct {
69
food *food
@@ -12,6 +15,8 @@ type arena struct {
1215
}
1316

1417
func newArena(s *snake, p chan (int), h, w int) *arena {
18+
rand.Seed(time.Now().UnixNano())
19+
1520
a := &arena{
1621
snake: s,
1722
height: h,

0 commit comments

Comments
 (0)