[PYTHON] Find a mathematical model of experience points required to level up DQ Walk (1)

Overview (TL; DR)

It is a record when I practiced the numerical calculation library of python based on the experience value necessary for leveling up Dragon Quest Walk. In (1), check the data, and in (2), we will calculate the mathematical model. (I'm currently studying, so I'd be happy if you could point out any mistakes.)

  1. Read and visualize data
  2. Model the data mathematically (regression analysis)

First look at the data

Load the required library. I may not use it this time, but I will use it next time, so read it.

import pandas as pd
import numpy as np
import scipy as sp

import matplotlib.pyplot as plt
import seaborn as sns

sns.set()
%matplotlib inline
%precision 3

Transfer the required experience points for each level from the reference URL to a text file.

zsh


% head data.csv
0
9
23
50
105
192
346
599
962
1397

Alright, read_csv ().

df = pd.read_csv('data.csv')
df.head()
Screen Shot 2020-01-31 at 0.09.06.png

*** King "Oh, what's the point of reading data without a header column?" ***

Set header = None in the read_csv () option, or set the column name with names = [].

df = pd.read_csv('data.csv',names=['EXP'])
df.head()
Screen Shot 2020-01-31 at 0.09.42.png

Since the index starts from 0, the experience value required to go from level 0 to level 1 will be 9 if it is left as it is. So add 1 to index.

df.index = df.index+1
df.head()
Screen Shot 2020-01-31 at 13.49.06.png

With this alone, you can know the experience points required to level up, but since you do not know the experience points required to reach that level, calculate the cumulative sum (Cumulative Sum) as well.

df['CUMSUM_EXP'] = df['EXP'].cumsum()
df.head()
Screen Shot 2020-01-31 at 20.23.49.png

Graph the experience points required for the next level up

plt.plot(df.index,df['EXP'])
plt.xlabel('LEVEL')
plt.ylabel('EXP')
plt.grid(True)

image.png

At around level 50, I feel that the model is obviously different.

A line graph showing the total amount of experience required

plt.plot(df['CUMSUM_EXP'],'x')
plt.xlabel('LEVEL')
plt.ylabel('EXP')
plt.grid(True)
Screen Shot 2020-01-31 at 0.51.15.png

I feel that this is a beautiful exponential graph.

Check summary statistics

Let's check the descriptive statistics value using pandas describe ().

pd.options.display.float_format = '{:.2f}'.format
df.describe()
Screen Shot 2020-01-31 at 13.50.40.png

Immediately, I will put a horizontal line of the quantile in the graph above. Apply the quantiles of cumulative experience points to the graph of experience points required for the next level. (There is something wrong here, but I think it is correct as a result.)

plt.plot(df['EXP'],label = 'EXP')
plt.axhline(df['CUMSUM_EXP'].quantile(0.25), ls = "-.", color = "magenta",label="25%")
plt.axhline(df['CUMSUM_EXP'].quantile(0.50), ls = "-.", color = "green",label="50%")
plt.axhline(df['CUMSUM_EXP'].quantile(0.75), ls = "-.", color = "Orange",label="75%")

plt.xlabel('LEVEL')
plt.ylabel('EXP')
plt.legend()
plt.grid(True)

image.png

Hmm? Since the 75% line is in such a place, I will extract levels 50 to 55 and graph them.

plt.plot(df['EXP'][49:55],label = 'EXP')
plt.axhline(df['CUMSUM_EXP'].quantile(0.75), ls = "-.", color = "Orange",label="75%")


plt.xlabel('LEVEL')
plt.ylabel('EXP')
plt.legend()
plt.grid(True)

image.png

25% of the experience points required to reach level 55 is almost equal to the experience points required to reach level 54 to 55 ... This is sad news because the senior positions released the other day will not have permanent skills unless they reach level 55.

to be continued

Reference URL

Dragon Quest Walkthrough wiki https://gamerch.com/dq-walk/entry/102321

Recommended Posts

Find a mathematical model of experience points required to level up DQ Walk (2)
Find a mathematical model of experience points required to level up DQ Walk (1)
Sum of variables in a mathematical model
I made a function to check the model of DCGAN
How to find the scaling factor of a biorthogonal wavelet
I tried to predict the number of domestically infected people of the new corona with a mathematical model