示例#1
0
文件: agent.go 项目: pimms/suckbot
func (a *Agent) getAction() int {
	if a.currentTile.GetITile().GetState() == env.DIRTY {
		return SUCK
	}

	if a.noopsRemaining > 0 {
		a.noopsRemaining--
		return NOOP
	}

	if a.phase == EXPLORE {
		a.tileQueue.AddUnique(a.currentTile)

		var dir = int(a.getSearchDirection())
		if dir != int(env.NONE) {
			return dir
		}
	}

	if a.phase == MAINTENANCE {
		if arg.NoMoreDirt() {
			return NOOP
		}

		return int(a.getPatrolDirection())
	}

	return NOOP
}
示例#2
0
func (c *Controller) Tick() {
	if arg.NoMoreDirt() {
		return
	}

	for i := 0; i < len(c.tileSlice); i++ {
		c.tileSlice[i].tick()
	}
}