示例#1
0
文件: rule.py 项目: vipmath/janggi-1
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 []
示例#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 []
示例#3
0
文件: rule.py 项目: vipmath/janggi-1
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
示例#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