Giter Club home page Giter Club logo

gganalysislite's Introduction

GGanalysisLite计算包

这个版本的计算包追求计算速度,而GGanalysis包有着更多计算功能。

GGanalysisLite包通过卷积计算分布列,通过FFT和快速幂加速卷积计算。

测试玩家得到的排名值rankA rankB的数学意义是:与抽了同样数量五星的其他玩家相比,测试玩家花费的抽数大于等于rankA比例的玩家,小于等于rankB比例的玩家。rankA rankB的值在(0,1]上,rankA值越高说明玩家越倒霉,达到1则说明达到了保底系统的极限。rankB值越高说明玩家越幸运,达到1则说明没有更幸运的玩家。

安装方法

打开终端输入以下指令,安装完成后下载文件可以删除。

git clone https://github.com/OneBST/GGanalysisLite.git
cd GGanalysisLite
pip install .

卷积计算方法

采用的模型见我的B站专栏。通过卷积计算分布列。

卷积采用scipysignal.convolve()函数,由其自动根据规模选择使用FFT计算或是直接卷积。

当计算物品数量上升,获取分布列需要多次卷积时,朴素FFT计算复杂度接近,故采用快速幂进行加速,复杂度降为

用例

使用GenshinPlayer类添加玩家,初始化其抽卡情况,随后使用类函数输出rankA rankB两个排名值。(注意这里的排名值只统计到玩家最后一次抽到五星/UP五星位置,垫抽部分和垫出的“大保底”没有考虑,需要更详细的计算请用GGanalysis包)

返回的rankA是你比多大比例的玩家更倒霉或一样倒霉,称为“非酋度”。rankB是你比多大比例的玩家更幸运或者一样幸运,称为“欧皇度”。这两个值都大于0,最高为1。

import GGanalysisLite as ggl

permanent_5 = 5			# 常驻祈愿五星数量
permanent_pull = 301	# 常驻祈愿恰好出最后一个五星时花费的抽数
character_5 = 14		# 角色祈愿五星数量
character_pull = 876	# 角色祈愿恰好出最后一个五星时花费的抽数
character_up_5 = 8		# 角色祈愿UP五星数量
character_up_pull = 876	# 角色祈愿恰好出最后一个UP五星时花费的抽数
weapon_5 = 2			# 武器祈愿五星数量
weapon_pull = 126		# 武器祈愿恰好出最后一个五星时花费的抽数

# 初始化玩家
player = ggl.GenshinPlayer(	p5=permanent_5,
                            c5=character_5,
                            u5=character_up_5,
                            w5=weapon_5,
                            p_pull=permanent_pull,
                            c_pull=character_pull,
                            u_pull=character_up_pull,
                            w_pull=weapon_pull)

# 查看常驻祈愿rank(仅考虑五星数量)
print('常驻祈愿', player.get_p5_rank())

# 查看角色祈愿rank(仅考虑五星数量)
print('角色祈愿', player.get_c5_rank())

# 查看UP角色rank(仅考虑UP五星数量)
print('角色祈愿UP', player.get_u5_rank())

# 查看武器祈愿rank(仅考虑五星数量)
print('武器祈愿', player.get_w5_rank())

# 查看综合rank(角色祈愿仅考虑五星数量,常驻祈愿仅考虑五星数量,武器祈愿仅考虑五星数量)
print('综合', player.get_comprehensive_rank())

# 查看综合rank(角色祈愿考虑UP数量,常驻祈愿仅考虑五星数量,武器祈愿仅考虑五星数量)
print('综合UP', player.get_comprehensive_rank_Up5Character())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.