예제 #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
파일: rule.py 프로젝트: ParkOhyoung/janggi
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
파일: rule.py 프로젝트: ParkOhyoung/janggi
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