Exemple #1
0
def next_possible_coordinates(current_row, current_col, code):
    assert (is_valid_coordinates(current_row, current_col))
    name = code2name(code)
    if name.startswith('Cha'):
        return cha_next_possible_coordinates(current_row, current_col)
    elif name.startswith('Po'):
        return po_next_possible_coordinates(current_row, current_col)
    else:
        return item_next_possible_coordinates(name, current_row, current_col)

    return []
Exemple #2
0
def next_possible_coordinates(current_row, current_col, code):
    assert(is_valid_coordinates(current_row, current_col))
    name = code2name(code)
    if name.startswith('Cha'):
        return cha_next_possible_coordinates(current_row, current_col)
    elif name.startswith('Po'):
        return po_next_possible_coordinates(current_row, current_col)
    else:
        return item_next_possible_coordinates(name, current_row, current_col)

    return []
Exemple #3
0
def item_next_possible_coordinates(name, row, col):
    candidates = []
    for r, c in MOVES[name.split('-')[0]]:
        if is_valid_coordinates(row + r, col + c):
            candidates.append((row + r, col + c))
    return candidates
Exemple #4
0
def item_next_possible_coordinates(name, row, col):
    candidates = []
    for r, c in MOVES[name.split('-')[0]]:
        if is_valid_coordinates(row + r, col + c):
            candidates.append((row + r, col + c))
    return candidates