// ToWireWithInitial converts the board to the wire representation with respect // to the given faction (since the wire factions are us vs. them), including // information about which cells are which type. func (b *Board) ToWireWithInitial(out botapi.InitialBoard, faction int) error { wireBoard, err := out.NewBoard() b.ToWire(wireBoard, faction) cells, err := botapi.NewCellType_List(out.Segment(), int32(b.Size.X*b.Size.Y)) if err != nil { return err } if err = out.SetCells(cells); err != nil { return err } for x, col := range b.Cells { for y, cell := range col { cells.Set(x+y*b.Size.X, cellToWire[cell]) } } return nil }