猫史档案馆


【Python作品分享】全职猎人念能力系测试

用户:一条金鱼一条金鱼查看:0 回复:2 评论:0 创建时间:2019-10-29T11:41:29


【作品展示】

center_image

 

【作品介绍】

因为多年前的那个中文网站挂了,现在日文网站在墙外,所以根据题目与评分标准做了一个。需要配合一个xlsx文件使用,关于念能力的解释请看动漫或自行百度。

仅供《全职猎人》(HunterXHunter)同好娱乐用,文字翻译来自豆瓣帖。

 

【作品源代码】

from easygui import*
import os
import pandas as pd
from pandas import Series,DataFrame

#问题表与答案对照表
quest = pd.read_excel('Hunter.xlsx', sheet_name='Sheet1')
check = pd.read_excel('Hunter.xlsx', sheet_name='Sheet2')
dt = []
qu = check['问题']
v = []
qu2 = pd.notnull(qu)

for i in range(len(qu2)):
    if qu2[i]:
        v.append(i)

for i in range(19):
    dt.append(check[v[i]:v[i+1]].fillna(0))
dt.append(check[v[19]:].fillna(0))

res = Series([0.0,0.0,0.0,0.0,0.0,0.0],\
            index=['强化系','放出系','变化系','操作系','具现化系','特质系'])

title = 'HUTER X HUNTER 念能力系测试'
if msgbox('Hello', title, '进入测试'):
    pass
else:
    os.sys.exit()

#第 1 到第 10 题
for i in range(1, 11):
    q = quest.loc[i].dropna()
    msg = q['问题']
    choices = list(q['A':])
    choice = choicebox(msg, title+str(i)+'/20', choices)
    if choice is None:
        os.sys.exit()
    res += dt[i-1].iloc[choices.index(choice)].drop(['问题','选项'])

#第 11 到第 14 题
for i in range(11, 15):
    q = quest.loc[i].dropna()
    msg = q['问题']
    choices = list(q['A':])
    choice = multchoicebox(msg, title+str(i)+'/20', choices)
    while choice is None:
        if ynbox('你没有选择项目!', title, ('继续','退出测试')):
            choice = multchoicebox(msg, title+str(i)+'/20', choices)
            pass
        else:
            os.sys.exit()
    for j in choice:
        res += dt[i-1].iloc[choices.index(j)].drop(['问题', '选项'])
#第 15 到第 20 题
for i in range(15, 21):
    q = quest.loc[i].dropna()
    msg = q['问题']
    choices = list(q['A':])
    choice = ccbox(msg, title+str(i)+'/20', choices)
    if choice is None:
        os.sys.exit()
    if choice:
        res += dt[i-1].iloc[0].drop(['问题', '选项'])
    else:
        res += dt[i-1].iloc[1].drop(['问题', '选项'])
import numpy as np
import matplotlib.pyplot as plt

plt.rc('font', family='SimHei', size=14)
labels = ['强化系', '放出系', '变化系', '操作系', '具现化系', '特质系']
n = len(res)
# 设置雷达图的角度和显示数值
angles = np.linspace(0, 2*np.pi, n, endpoint=False)
res = np.concatenate((res, [res[0]]))
angles = np.concatenate((angles, [angles[0]]))

plt.polar(angles, res)  # 绘图
plt.thetagrids(angles * 180/np.pi, labels)  # 添加标签
plt.fill(angles, res, facecolor='b', alpha=0.25)  # 填充雷达图
plt.title('念能力系分析')  # 设置标题

plt.show()  # 显示图像

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
一条金鱼一条金鱼

哇我哭了,论坛贴不了xlsx………………老年人懵.jpg

点赞0


评论


一条金鱼一条金鱼

要xlsx文件的留邮箱我发你

点赞0


评论