There are multiple algorithms for playing moves based on the current setup of the chess board. There is an optimal move at all times in terms of taking the enemy's highest value pieces, but also another optimal move if you were taking a long-term approach which is what actual chess players do. But as
>>11142261 said, there's no really practical, straight-forward way to do this. Your best bet would be practicing.