def attack(inp, row, col, enemy, damage=3):
    '\n    Attack weakest adjacent enemy, if one is there\n    If multiple weakest enemies, attack in reading order\n    Return the modified board, and a boolean indicating whether anyone died\n    '
    if (not adjacent_enemy(inp, row, col, enemy)):
        return (inp, False)
    enemies = {}
    for coords in [((row - 1), col), ((row + 1), col), (row, (col - 1)), (row, (col + 1))]:
        if (inp[coords[0]][coords[1]][0] == enemy):
            enemies[coords] = inp[coords[0]][coords[1]][1]
    min_hp = min(enemies.values())
    enemies = [x for x in enemies if (enemies[x] == min_hp)]
    enemies.sort()
    coords = enemies[0]
    enemy = inp[coords[0]][coords[1]]
    enemy_pts = (enemy[1] - damage)
    enemy_tup = (enemy[0], enemy_pts, enemy[2])
    if (enemy_pts <= 0):
        inp[coords[0]][coords[1]] = '.'
        return (inp, True)
    else:
        inp[coords[0]][coords[1]] = enemy_tup
        return (inp, False)
Attack weakest adjacent enemy, if one is there
If multiple weakest enemies, attack in reading order
Return the modified board, and a boolean indicating whether anyone died
def attack(inp, row, col, enemy, damage=3):
    '\n    Attack weakest adjacent enemy, if one is there\n    If multiple weakest enemies, attack in reading order\n    Return the modified board, and a boolean indicating whether anyone died\n    '
    if (not adjacent_enemy(inp, row, col, enemy)):
        return (inp, False)
    enemies = {}
    for coords in [((row - 1), col), ((row + 1), col), (row, (col - 1)), (row, (col + 1))]:
        if (inp[coords[0]][coords[1]][0] == enemy):
            enemies[coords] = inp[coords[0]][coords[1]][1]
    min_hp = min(enemies.values())
    enemies = [x for x in enemies if (enemies[x] == min_hp)]
    enemies.sort()
    coords = enemies[0]
    enemy = inp[coords[0]][coords[1]]
    enemy_pts = (enemy[1] - damage)
    enemy_tup = (enemy[0], enemy_pts, enemy[2])
    if (enemy_pts <= 0):
        inp[coords[0]][coords[1]] = '.'
        return (inp, True)
    else:
        inp[coords[0]][coords[1]] = enemy_tup
        return (inp, False)