forked from Leozhang404/Echo_Model
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathagent.py
More file actions
54 lines (39 loc) · 1.24 KB
/
agent.py
File metadata and controls
54 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
"""
Created on Tue May 29 20:16:44 2018
@author: Leo
"""
# 确定主体的位置坐标
class Position():
def __init__(self, position):
self. x = position[0]
self. y = position[1]
# 染色体:tag control 片段(先只写标识tag片段)
class Chromosome():
def __init__(self, offense_tag, defense_tag):
self. offense_tag = offense_tag
self. defense_tag = defense_tag
# 资源
class Resource():
def __init__(self, founders, capitals, fans):
self. founders = founders
self. capitals = capitals
self. fans = fans
# 主体
class Agent(Position, Chromosome):
def __init__(self, position,
offense_tag=None,
defense_tag=None,
founders=None,
capitals=None,
fans=None):
# 坐标
Position. __init__(self, position)
# 染色体
Chromosome. __init__(self, offense_tag, defense_tag)
# 资源
Resource. __init__(self, founders, capitals, fans)
def get_position(self):
return [self.x, self.y]
def get_resource(self):
return sum([self. founders, self. capitals, self. fans])