lundi 17 décembre 2018

Output the nearest Value of an List which match to an String?

I am scraping a Chess Game. I want to get a Suggested move.

best_move_dataset = Collection of played Moves in the History
move_done = is the move i have played if the app started

Solution-Output (best_move_dataset == move_done): nearest equality
f6
f5

This is my code and I really dont know how to make this solution.

best_move_dataset = ['d4 Nc6 e4 e5 f4 f6','d4 Nc6 e4 e5 f4 f5','d4 Nc6 e3 e5 f4']

moves_done = 'd4 Nc6 e4 e5 f4'
moves_done_list = moves_done.split(' ')
len_moves_done = len(moves_done_list)

len_best_move = len(best_move_dataset)

for move_zaehler in range(len_moves_done):
        print(best_move_dataset[0])

I hope you guys understand If you have any Suggestion how I can change the Question that it is clearer then please remind me.

Hopefully I get some Help.

Best Regards

Tobias

Aucun commentaire:

Enregistrer un commentaire