gammatools/app/tables/mentattack.py

31 lines
785 B
Python
Raw Normal View History

2024-06-23 11:13:42 +00:00
import pandas as pd
import numpy as np
class MentalAttackMatrix:
def __init__(self):
ams = np.linspace(3, 18, 16).astype(int)
dms = np.linspace(3, 18, 16).astype(int)
self.df = pd.DataFrame(index=dms, columns=ams)
initval = 10
for col in ams:
for row in dms:
if col == row:
self.df.loc[col, row] = initval
elif col < row:
self.df.loc[col, row] = initval - (row - col)
elif col > row:
self.df.loc[col, row] = initval + (col - row)
def get_attack_score(self, ams, dms):
return int(self.df.loc[dms, ams])
def get_matrix(self):
return self.df
def dump_matrix(self):
print(self.df)