Tries to find a board by board name.
509274
def find_device_by_name(name):
    """"""
    if not name:
        return DEFAULT_DEV
    with DEV_LOCK:
        for dev in DEVS:
            if dev.name == name:
                return dev
    return None
669823
def card_names_and_ids(self):
        """"""
        b = Board(self.client, self.board_id)
        cards = b.getCards()
        card_names_and_ids = [(unidecode(c.name), c.id) for c in cards]
        return card_names_and_ids
1372745
function mapBoard(board, func) {
    return board.map(function (col) {
        return col.map(function (p) {
            return func(p);
        });
    });
}
578810
function getBoardWithPieces(board, pieces) {
    return mapBoard(board, function (p) {
        var x = p.x,
            y = p.y;

        var piece = Position.getPositionFromPositions(pieces, p);
        return piece ? { x: x, y: y, isBlack: piece.isBlack } : { x: x, y: y };
    });
}
1115225
def TEST():
    
    grd = Grid(4,4, [2,4])
    grd.new_tile()
    grd.new_tile()
    print(grd)
    print("There are ", grd.count_blank_positions(), " blanks in grid 1\n")

    grd2 = Grid(5,5, ['A','B'])
    grd2.new_tile(26)
    print(grd2)
    build_board_checkers()

    print("There are ", grd2.count_blank_positions(), " blanks in grid 2")
675898
def ensure_board
      board_id = params[:board_id] || params[:id]
      result = has_board_access(board_id)
      @board = result[:board]
      @user_board = result[:user_board]
      head result[:status] if result[:status] != :ok
    end
142415
def board_name(default):
    """"""
    try:
        import board
        try:
            name = board.name
        except AttributeError:
            # There was a board.py file, but it didn't have an name attribute
            # We also ignore this as an error
            name = default
    except ImportError:
        # No board.py file on the pyboard - not an error
        name = default
    except BaseException as err:
        print('Error encountered executing board.py')
        import sys
        sys.print_exception(err)
        name = default
    return repr(name)
480663
def random_start_board(cls):
        """"""
        board = cls()
        board._random_fill()
        destructions = True  # prime the loop
        while destructions:
            board, destructions = board.execute_once()
            board._random_fill()
        return board
44114
def is_koish(board, c):
    ''
    if board[c] != EMPTY:
        return None
    neighbors = {board[n] for n in NEIGHBORS[c]}
    if len(neighbors) == 1 and EMPTY not in neighbors:
        return list(neighbors)[0]
    else:
        return None
1280974
def use_board!(boardname)
      return true if use_board(boardname)

      boardfamily = boardname.split(":")[0..1].join(":")
      puts "Board '#{boardname}' not found; attempting to install '#{boardfamily}'"
      return false unless install_boards(boardfamily) # guess board family from first 2 :-separated fields

      use_board(boardname)
    end
686454
def has_board_access(board_id)
      board = nil
      if !board_id.nil?
        board = Unsakini::Board.find_by_id(board_id)
      else
        return {status: :bad_request}
      end
      if (board)
        user_board = Unsakini::UserBoard.where(user_id: @user.id, board_id: board_id).first
        return {status: :forbidden } if user_board.nil?
        return {status: :ok, board: board, user_board: user_board}
      else
        return {status: :not_found}
      end
    end
709310
function Game(name) {
    this.name = name;
    this.board = [];  // list representation
    this.boardmat = [];  // matrix representation
    for (var i=0; i<181; i++) {
        this.boardmat[i] = new Array(181);
    }
    this.players = {};
    this.turn_pieces = [];  // pieces played this turn
    this.chat = [];  // chat log

    // board dimensions
    this.dimensions = {'top': 90, 'right': 90, 'bottom': 90, 'left': 90};

    /* Keep track of the pieces by having a list of piece objects each with a
     * count attribute that tracks how many of that piece are left. When this
     * reaches 0, we remove the piece object from the list.
     */
    this.pieces = [];
    var colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'];
    var shapes =  ['circle', 'star', 'diamond', 'square', 'triangle', 'clover'];
    for (var c in colors) {
        if (!colors.hasOwnProperty(c)) {
            continue;
        }
        for (var s in shapes) {
            if (!shapes.hasOwnProperty(s)) {
                continue;
            }
            this.pieces.push({'piece': new Piece(shapes[s], colors[c]), 'count': 3});
        }
    }
}
1185679
function hasPositionByBoardSize(boardSize, position) {
    return position && position.x >= 0 && position.y >= 0 && boardSize.y > position.y && boardSize.x > position.x;
}
792435
def board(self):
        """"""
        board = []
        if self.flop:
            board.extend(self.flop.cards)
            if self.turn:
                board.append(self.turn)
                if self.river:
                    board.append(self.river)
        return tuple(board) if board else None
634994
def find(pred, items):
	
	for i, item in enumerate(items):
		if pred(item):
			return i
283005
def board(self, *, _cache: bool = True) -> chess.Board:
        
        if self.board_cached is not None:
            board = self.board_cached()
            if board is not None:
                return board.copy()

        board = self.parent.board(_cache=False)
        board.push(self.move)

        if _cache:
            self.board_cached = weakref.ref(board)
            return board.copy()
        else:
            return board
980783
private void doFind(final Message<JsonObject> message) {
    String type = message.body().getString("type");
    if (type != null) {
      switch (type) {
        case "group":
          doFindGroup(message);
          break;
        case "node":
          doFindNode(message);
          break;
        case "network":
          doFindNetwork(message);
          break;
        default:
          message.reply(new JsonObject().putString("status", "error").putString("message", "Invalid type specified."));
          break;
      }
    } else {
      message.reply(new JsonObject().putString("status", "error").putString("message", "No type specified."));
    }
  }