Win/lose algorithm added