Example #1
0
func bodyPlanTreeToCellGrid(n *bodyPlanNode, depth int) micro.CellGrid {
	// TODO
	gridSize := 2*depth - 1
	centerPos := gridSize / 2
	g := micro.NewCellGrid(gridSize, gridSize)
	mapBodyPlanNodeToGrid(n, &g, centerPos, centerPos)
	return g
}
Example #2
0
func NewBug(x, y int) *Bug {
	w := 3
	h := 3

	g := micro.NewCellGrid(w, h)

	g[1][0] = &micro.Cell{Type: micro.CellTypeAttack, Value: 127}
	g[0][1] = &micro.Cell{Type: micro.CellTypeAttack, Value: 127}
	g[1][1] = &micro.Cell{Type: micro.CellTypeAbsorb, Value: 127}
	g[2][1] = &micro.Cell{Type: micro.CellTypeAttack, Value: 127}
	g[1][2] = &micro.Cell{Type: micro.CellTypeAttack, Value: 127}

	return &Bug{
		Body:   g,
		width:  w,
		height: h,
		xpos:   x,
		ypos:   y,
		Energy: 100, // TODO
	}
}