add function of calculating score