改进
This commit is contained in:
30
reactor.py
30
reactor.py
@@ -2,30 +2,35 @@ import typing
|
||||
import particles as pt
|
||||
import pathlib
|
||||
import auxiliary as aux
|
||||
import compositions
|
||||
import compositions as comps
|
||||
import random
|
||||
|
||||
class Apparatus():
|
||||
"""反应器对象, 处理一个原子的记忆工作, 并反馈到布局"""
|
||||
def __init__(self, atom):
|
||||
"""反应器对象, 决策一个原子的不同记忆方式, 并反馈到布局"""
|
||||
def __init__(self, screen, atom):
|
||||
self.electron: pt.Electron = atom[0]
|
||||
self.nucleon: pt.Nucleon = atom[1]
|
||||
self.positron: dict = atom[2]
|
||||
self.testdata = self.positron["testdata"]
|
||||
|
||||
def iterator(self):
|
||||
pass
|
||||
|
||||
def composer(self):
|
||||
self.procession: typing.List[comps.Composition] = list()
|
||||
if self.positron["is_new_activation"] == 1:
|
||||
self.positron["is_new_activation"] = 0
|
||||
self.procession.append(comps.registry["recognition"](screen, atom))
|
||||
return
|
||||
for i in self.positron["testdata"].keys():
|
||||
if i == "additional_inf":
|
||||
continue
|
||||
self.procession.append(comps.registry[i](screen, atom))
|
||||
# self.procession.reverse()
|
||||
random.shuffle(self.procession)
|
||||
|
||||
def updater(self):
|
||||
pass
|
||||
def iterator(self):
|
||||
yield from self.procession
|
||||
|
||||
|
||||
class Reactor():
|
||||
"""反应堆对象, 处理和分配一次文件记忆流程的资源与策略"""
|
||||
def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, tasked_num):
|
||||
def __init__(self, nucleon_file: pt.NucleonUnion, electron_file: pt.ElectronUnion, screen, tasked_num):
|
||||
# 导入原子对象
|
||||
self.reported = set()
|
||||
self.nucleon_file = nucleon_file
|
||||
@@ -34,7 +39,7 @@ class Reactor():
|
||||
self.atoms_new = list()
|
||||
self.atoms_review = list()
|
||||
counter = self.tasked_num
|
||||
|
||||
self.screen = screen
|
||||
self.electron_dict = electron_file.electrons_dict
|
||||
|
||||
def electron_dict_get_fallback(key) -> pt.Electron:
|
||||
@@ -113,6 +118,7 @@ class Reactor():
|
||||
return -1 # 此轮已完成
|
||||
self.index += step
|
||||
self.current_atom = self.procession[self.index]
|
||||
self.current_appar = Apparatus(self.screen, self.current_atom).iterator()
|
||||
return 0
|
||||
|
||||
def save(self):
|
||||
|
Reference in New Issue
Block a user