forked from geetarista/vindinium-starter-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.go
31 lines (21 loc) · 504 Bytes
/
bot.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package vindinium
import "math/rand"
type Direction string
var DIRS = []Direction{"Stay", "North", "South", "East", "West"}
func randDir() Direction {
dir := DIRS[rand.Intn(len(DIRS))]
return dir
}
type Bot interface {
Move(state *State) Direction
}
type RandomBot struct{}
func (b *RandomBot) Move(state *State) Direction {
return randDir()
}
type FighterBot struct{}
func (b *FighterBot) Move(state *State) Direction {
// g := NewGame(state)
// Do something awesome
return randDir()
}