致游戏策划的一份信(十分真诚)
我十分喜欢这个游戏,希望策划能把这个视频转给架构😁
参考代码如下:
随机生成朋友方法
def makefriend():
import random
global age
friendage = 35
person_level = random.randint(1,5)
person_classfiy = random.randint(1,8)
Favorite = random.randint(0,100)
import numpy as np
# 社会关系就可以算到朋友影响力去
# 值 = 随机变量*社会阶层*好感度+年龄量*随机变量
return person_level,person_classfiy,Favorite*person_level*random.randint(100,300)+random.randint(100,300)*1/np.abs(age-friendage)
玩家person类
class person():
def __init__(self, name,loc = '东海岸明珠市', **kwargs):
self.money = 3000
self.name = name
self.mood = 70
self.health = 70
self.iq = 70
self.eq = 70
self.face = 70
self.morality = 70
self.famliylist = []
self.loc = loc
#下面是隐藏变量
self.personlevel = 3
self.person_classfiy = 1
#家族的classfiy可以用树结构去保存,这里只打个比方用最简单的列表,用树结构可以计算不同层间的距离
self.famliy_classfiy_influence = [1,3,5]
self.Family_influence = [100,2000,300]
#1.公益捐赠2.上交税收3.带动就业4.消费贡献等等等
self.person_influence = [2000,500,400,1000]
self.friend_influence = []
self.friend_level = []
self.friend_classfiy = []
def caculate_person(self):
#个人总影响力包括颜值什么的乱七八糟都可以算进去
return np.sum(self.person_influence)+self.personlevel*1000+np.sum([self.money,self.iq,self.eq,self.face])
def interact(self):
#展示如何与朋友交互获得
p_level,p_classfiy,friend_infulence = makefriend()
self.friend_level.append(p_level)
self.friend_influence.append(friend_infulence)
self.friend_classfiy.append(p_classfiy)
pass
def inherit(self):
#继承家族的影响力,继承朋友的关系,必须在下一代要继承到
#这里可以计算公式什么的
pass
def other_func(self):
pass