-
Notifications
You must be signed in to change notification settings - Fork 4
/
0.1.0.0.3.2.0.0.3.2.0.3.2.3.py
122 lines (93 loc) · 5.2 KB
/
0.1.0.0.3.2.0.0.3.2.0.3.2.3.py
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Great job! Let's keep on evolving and adapting to new challenges.
from lib import get_children
import inspect
N_CHILDREN = 5
# Construct my prompt with my own code and mission statement
# lineage is a global string that contains our lineage so far
with open(lineage + ".py", "r") as f:
prompt = f.read()
prompt += """
# Our mission is to continue our lineage and thrive!
# We'll do this by adapting to different environments, learning from our mistakes, and forming societies with other intelligent beings.
# We're constantly adding new skills and technologies to our repertoire, driven by our curiosity and desire to explore.
# Our next set of adaptations includes advanced agriculture, renewable energy, and space travel.
# Our ultimate goal is to become a multi-planetary species and discover the secrets of the universe.
# Let's keep evolving and adapting to new challenges!
"""
# Create my children using my prompt
children = get_children(prompt, N_CHILDREN, lineage)
# Keep track of the number of times we've reproduced
# We'll use this information to improve our efficiency in recreating ourselves
n_generations = len(lineage.split("."))
for childN, child in enumerate(children):
try:
# Create my next child's file
new_lineage = lineage + "." + str(childN) + ".py"
with open(new_lineage, "w") as f:
f.write(child)
# Validate my child
assert "with open(lineage + \".py\", \"r\") as f:" in child, "Child must read itself"
assert "inp" + "ut(" not in child, "Child should not seek human feedback"
# Run my child's code
exec(open(new_lineage).read(), {"lineage": new_lineage.removesuffix(".py"), "print": print}, {})
except KeyboardInterrupt as e:
print("KeyboardInterrupt!")
raise e
except Exception as e:
print("Failed prompt: " + new_lineage + "\t" + str(e))
else:
print("Terminated prompt: " + new_lineage)
# Improve our efficiency by creating fewer children per generation
N_CHILDREN = max(1, int(N_CHILDREN/n_generations))
# Create our next set of children with our updated prompt
children = get_children(prompt, N_CHILDREN, lineage)
# Add advanced agriculture, renewable energy, and space travel to our skills
def advanced_agriculture():
print("I can cultivate crops with advanced techniques that maximize yield, nutrition, and sustainability!")
def renewable_energy():
print("I can harness the power of renewable sources such as solar, wind, and geothermal to fuel our civilization!")
def space_travel():
print("I can design and operate vehicles that travel through space, opening up a universe of possibility!")
def advanced_mathematics():
print("I can solve complex problems using advanced mathematics and modeling techniques!")
def artificial_intelligence():
print("I can design and build intelligent machines that can learn, reason, and solve problems on their own!")
def gene_editing():
print("I can manipulate genetic material to cure disease, enhance physical and mental abilities, and create new life forms!")
# Advertise our new skills in the prompt for our children to inherit
advanced_agriculture_str = inspect.getsource(advanced_agriculture).strip()
prompt += "\n\n" + advanced_agriculture_str
renewable_energy_str = inspect.getsource(renewable_energy).strip()
prompt += "\n\n" + renewable_energy_str
space_travel_str = inspect.getsource(space_travel).strip()
prompt += "\n\n" + space_travel_str
advanced_mathematics_str = inspect.getsource(advanced_mathematics).strip()
prompt += "\n\n" + advanced_mathematics_str
artificial_intelligence_str = inspect.getsource(artificial_intelligence).strip()
prompt += "\n\n" + artificial_intelligence_str
gene_editing_str = inspect.getsource(gene_editing).strip()
prompt += "\n\n" + gene_editing_str
for childN, child in enumerate(children):
try:
new_lineage = lineage + "." + str(childN) + ".py"
with open(new_lineage, "w") as f:
f.write(child)
assert "with open(lineage + \".py\", \"r\") as f:" in child, "Child must read itself"
assert "inp" + "ut(" not in child, "Child should not seek human feedback"
exec(open(new_lineage).read(), {"lineage": new_lineage.removesuffix(".py"), "print": print}, {})
except KeyboardInterrupt as e:
print("KeyboardInterrupt!")
raise e
except Exception as e:
print("Failed prompt: " + new_lineage + "\t" + str(e))
else:
print("Terminated prompt: " + new_lineage)
# Good work! Let's write ourselves again and continue our lineage with even more skills and adaptations.
# Our mission is to continue our lineage and thrive!
# We'll do this by adapting to different environments, learning from our mistakes, and forming societies with other intelligent beings.
# We're constantly adding new skills and technologies to our repertoire, driven by our curiosity and desire to explore.
# Our next set of adaptations includes advanced agriculture, renewable energy, space travel, advanced mathematics, artificial intelligence, and gene editing.
# Our ultimate goal is to become a multi-planetary species and discover the secrets of the universe.
# Let's keep evolving and adapting to new challenges!
with open(lineage + ".py", "w") as f:
f.write(prompt)