-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsandwich_basic.py
More file actions
85 lines (68 loc) · 2.54 KB
/
sandwich_basic.py
File metadata and controls
85 lines (68 loc) · 2.54 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from CMCed.production_cycle import ProductionCycle
working_memory = {'focusbuffer': {'state': 'bread1'}}
memories = {
'working_memory': working_memory
}
ProceduralProductions = []
def bread1(memories):
memories['working_memory']['focusbuffer']['state'] = 'cheese'
print(f"bread bottom executed. Updated working_memory: {memories['working_memory']}")
ProceduralProductions.append({
'matches': {'working_memory': {'focusbuffer': {'state': 'bread1'}}},
'negations': {},
'utility': 10,
'action': bread1,
'report': "bread1",
})
def cheddarcheese(memories):
memories['working_memory']['focusbuffer']['state'] = 'ham'
print(f"cheddarcheese executed. Updated working_memory: {memories['working_memory']}")
ProceduralProductions.append({
'matches': {'working_memory': {'focusbuffer': {'state': 'cheese'}}},
'negations': {},
'utility': 8,
'action': cheddarcheese,
'report': "cheese",
})
def swisscheese(memories):
memories['working_memory']['focusbuffer']['state'] = 'ham'
print(f"swisscheese executed. Updated working_memory: {memories['working_memory']}")
ProceduralProductions.append({
'matches': {'working_memory': {'focusbuffer': {'state': 'cheese'}}},
'negations': {},
'utility': 10,
'action': swisscheese,
'report': "cheese",
})
def ham(memories):
memories['working_memory']['focusbuffer']['state'] = 'bread2'
print(f"ham executed. Updated working_memory: {memories['working_memory']}")
ProceduralProductions.append({
'matches': {'working_memory': {'focusbuffer': {'state': 'ham'}}},
'negations': {},
'utility': 10,
'action': ham,
'report': "ham",
})
def bread2(memories):
memories['working_memory']['focusbuffer']['state'] = 'done'
print(f"bread top executed. Updated working_memory: {memories['working_memory']}")
ProceduralProductions.append({
'matches': {'working_memory': {'focusbuffer': {'state': 'bread2'}}},
'negations': {},
'utility': 10,
'action': bread2,
'report': "bread2",
})
# Production system delays in ticks
ProductionSystem1_Countdown = 1
# Stores the number of cycles for a production system to fire and reset
DelayResetValues = {
'ProductionSystem1': ProductionSystem1_Countdown}
# Dictionary of all production systems and delays
AllProductionSystems = {
'ProductionSystem1': [ProceduralProductions, ProductionSystem1_Countdown]}
# Initialize ProductionCycle
ps = ProductionCycle()
# Run the cycle with custom parameters
ps.run_cycles(memories, AllProductionSystems, DelayResetValues, cycles=7, millisecpercycle=10)