def update_possible_coordinates(board, name, row, col, code): print("{0} can go to those coordinates from {1}, {2}: ".format( name, row, col)) for r, c in next_possible_coordinates(row, col, code): board[r][c] = 100 if __name__ == '__main__': from helper import create_empty_board cha_code = name2code('Cha-a') board = create_empty_board() board[1][1] = cha_code print("Cha can go to those coordinates from 1, 1: ") for r, c in next_possible_coordinates(1, 1, cha_code): board[r][c] = 100 print(board_state(board)) po_code = name2code('Po-a') board = create_empty_board() board[2][2] = po_code print("Po can go to those coordinates from 2, 2: ") for r, c in next_possible_coordinates(2, 2, po_code): board[r][c] = 100 print(board_state(board)) byung_code = name2code('Byung-a') jol_code = name2code('Jol-b') board = create_empty_board() board[2][2] = byung_code board[6][2] = jol_code update_possible_coordinates(board, 'Byung-a', 2, 2, byung_code)
def __repr__(self): return board_state(self.board)
return candidates def update_possible_coordinates(board, name, row, col, code): print("{0} can go to those coordinates from {1}, {2}: ".format(name, row, col)) for r, c in next_possible_coordinates(row, col, code): board[r][c] = 100 if __name__ == '__main__': from helper import create_empty_board cha_code = name2code('Cha-a') board = create_empty_board() board[1][1] = cha_code print("Cha can go to those coordinates from 1, 1: ") for r, c in next_possible_coordinates(1, 1, cha_code): board[r][c] = 100 print(board_state(board)) po_code = name2code('Po-a') board = create_empty_board() board[2][2] = po_code print("Po can go to those coordinates from 2, 2: ") for r, c in next_possible_coordinates(2, 2, po_code): board[r][c] = 100 print(board_state(board)) byung_code = name2code('Byung-a') jol_code = name2code('Jol-b') board = create_empty_board() board[2][2] = byung_code board[6][2] = jol_code update_possible_coordinates(board, 'Byung-a', 2, 2, byung_code)