beatmap.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:slider 作者: llllllllll 项目源码 文件源码
def _round_hitcounts(self, accuracy, count_miss=None):
        """Round the accuracy to the nearest hit counts.

        Parameters
        ----------
        accuracy : np.ndarray[float]
            The accuracy to round in the range [0, 1]
        count_miss : np.ndarray[int]int, optional
            The number of misses to fix.

        Returns
        -------
        count_300 : np.ndarray[int]
            The number of 300s.
        count_100 : np.ndarray[int]
            The number of 100s.
        count_50 : np.ndarray[int]
            The number of 50s.
        count_miss : np.ndarray[int]
            The number of misses.
        """
        if count_miss is None:
            count_miss = np.full_like(accuracy, 0)

        max_300 = len(self.hit_objects) - count_miss

        accuracy = np.maximum(
            0.0,
            np.minimum(
                calculate_accuracy(max_300, 0, 0, count_miss) * 100.0,
                accuracy * 100,
            ),
        )

        count_50 = np.full_like(accuracy, 0)
        count_100 = np.round(
            -3.0 *
            ((accuracy * 0.01 - 1.0) * len(self.hit_objects) + count_miss) *
            0.5,
        )

        mask = count_100 > len(self.hit_objects) - count_miss
        count_100[mask] = 0
        count_50[mask] = np.round(
                -6.0 *
                ((accuracy[mask] * 0.01 - 1.0) * len(self.hit_objects) +
                 count_miss[mask]) *
                0.2,
            )
        count_50[mask] = np.minimum(max_300[mask], count_50[mask])

        count_100[~mask] = np.minimum(max_300[~mask], count_100[~mask])

        count_300 = (
            len(self.hit_objects) -
            count_100 -
            count_50 -
            count_miss
        )

        return count_300, count_100, count_50, count_miss
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号