Untitled

 avatar
unknown
python
2 years ago
2.4 kB
1
Indexable
chess = '1. O-O d2 2. e4 d5 3. Кc3 h6 4. Кf3 c5  5. e:d5 e:d5 6. Кf6  7. Сe2 Сe7  8. Сg5 Кc6 9. d:c5 Сe6 10. Кd4 С:c5 11. Кb3 Сe7 12. Сf3 Кe5 13. К:f3+ Лe1 14. Ф:f3 Лc8 15. h3 O-O'
black_step = int(chess.split('O-O')[0].split(' ')[-3].replace('.','')) if chess.replace(' ','').split('O-O')[0][-1] != '.' else int(chess.split('O-O')[1].split(' ')[-3].replace('.',''))
white_step = int(chess.split('O-O')[0].replace('. ','')[-1]) if chess.replace(' ','').split('O-O')[0][-1] == '.' else int(chess.split('O-O')[1].split(' ')[-2].replace('.',''))
print(black_step, white_step)
#
chess = '1. d2 O-O 2. e4 d5 3. Кc3 h6 4. Кf3 c5  5. e:d5 e:d5 6. Кf6  7. Сe2 Сe7  8. Сg5 Кc6 9. d:c5 Сe6 10. Кd4 С:c5 11. Кb3 Сe7 12. Сf3 Кe5 13.   К:f3+ Лe1  14. Ф:f3 Лc8 15. O-O h3 '
black_step = int(chess.split('O-O')[0].split(' ')[-3].replace('.','')) if chess.replace(' ','').split('O-O')[0][-1] != '.' else int(chess.split('O-O')[1].split(' ')[-3].replace('.',''))
white_step = int(chess.split('O-O')[0].replace('. ','')[-1]) if chess.replace(' ','').split('O-O')[0][-1] == '.' else int(chess.split('O-O')[1].split(' ')[-2].replace('.',''))
print(black_step, white_step)

chess = '1. d2 e6 2. e4 d5 3. Кc3 h6 4. Кf3 c5  5. e:d5 e:d5 6. O-O Кf6 7. Сe2 Сe7  8. Сg5 Кc6 9. d:c5 Сe6 10. Кd4 С:c5 11. Кb3 Сe7 12. Сf3 Кe5 13. Лe1 O-O 14. Ф:f3 Лc8 15. h3 К:f3+'
black_step = int(chess.split('O-O')[0].split(' ')[-3].replace('.','')) if chess.replace(' ','').split('O-O')[0][-1] != '.' else int(chess.split('O-O')[1].split(' ')[-3].replace('.',''))
white_step = int(chess.split('O-O')[0].replace('. ','')[-1]) if chess.replace(' ','').split('O-O')[0][-1] == '.' else int(chess.split('O-O')[1].split(' ')[-2].replace('.',''))
print(black_step, white_step)

chess = '1. d2 e6 2. e4 d5 3. Кc3 h6 4. Кf3 c5  5. e:d5 e:d5 6. Кf6 O-O 7. Сe2 Сe7  8. Сg5 Кc6 9. d:c5 Сe6 10. Кd4 С:c5 11. Кb3 Сe7 12. Сf3 Кe5 13. O-O Лe1  14. Ф:f3 Лc8 15. h3 К:f3+'
black_step = int(chess.split('O-O')[0].split(' ')[-3].replace('.','')) if chess.replace(' ','').split('O-O')[0][-1] != '.' else int(chess.split('O-O')[1].split(' ')[-3].replace('.',''))
white_step = int(chess.split('O-O')[0].replace('. ','')[-1]) if chess.replace(' ','').split('O-O')[0][-1] == '.' else int(chess.split('O-O')[1].split(' ')[-2].replace('.',''))
print(black_step, white_step)
Editor is loading...