class_docstr: Controller.`
  Keep Track of each ship and shipyard
class_docstr_tok: ["Controller.","`","Keep","Track","of","each","ship","and","shipyard"]
docstr: Take action for shipyard
  Args:
      board : environment
code: def take_shipyard_action(self, board):
      """Take action for shipyard
      Args:
          board : environment
      """
      me = board.current_player
  
      tmp_halite = me.halite
  
      # spwaning ships until the number reaches the threshold
      if len(me.ships) < config["num_ships"]:
          tmp = config["num_ships"] - len(me.ships)
  
          for shipyard in me.shipyards:
              # if there is an opponent ship nearby, the shipyard can spawn a ship to protect itself
              if check_nearby_ship(board, shipyard, enemy=True):
                  shipyard_policies[1](board, shipyard)
  
              else:
                  # if the player has extra halite, the shipyard can spawn more ships
                  if (
                      tmp_halite > 50
                      and shipyard.cell.ship_id is None
                      and not check_nearby_ship(
                          board, shipyard, enemy=False
                      )
                  ):
                      shipyard_policies[1](board, shipyard)
  
                      tmp -= 1
  
                      tmp_halite -= 50
  
              if tmp == 0:
                  break
  
      return me.next_actions
  
imports: import base64
  import pickle
  import random
  import numpy
  from zerosum_env.envs.halite.helpers import *
  from zerosum_env import make, evaluate
  from collections import deque
  import parl
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.distribution import Categorical
label_desc: Use image node_id 7 for calling the Controller obj's underlying member method code with example usage: obj.take_shipyard_action(board) and returns: me