def read_board_from_text_file(file_name):
    """
    Reads a board from a text file of given name.

    If the file does not contain a rectangular board, missing
    fields will be filled with 0.
    """
    with open(file_name) as board_file:
        lines = board_file.readlines()
    board = [[int(x) for x in line.split()] for line in lines]
    max_len = max(len(row) for row in board)
    for row in board:
        while len(row) < max_len:
            row.append(0)
    board = [list(x) for x in zip(*board)]
    return board