master
Raw Download raw file
 1package main
 2
 3type Bot struct {
 4	UserID   string // AKA Password
 5	Username string
 6	Updates  <-chan Update
 7	Games    <-chan Game
 8	Game
 9	GeneralsIO
10}
11
12func (ai *Bot) RecieveUpdates() {
13	ai.Game = <-ai.Games
14	for {
15		u := <-ai.Updates
16		ai.Map.Patch(u)
17		ai.Map.Print()
18		c := ai.Game.Map.Generals[ai.Game.UserIndex]
19		l.Info(c)
20		err := ai.GeneralsIO.Emit("attack", c, c+1)
21		if err != nil {
22			l.Fatal(err)
23		}
24	}
25
26}