rules_ai 0.1.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rules_ai.rb +372 -216
- data/lib/rules_ai/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7878a0a5df36a236fe35cb77739cbaf25185e5a2f90a7a8af8ebebb7704973a7
|
4
|
+
data.tar.gz: cf736128214579c84d5c1634daa51d66a936fff11c6ab8b30c8c840155223b56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f3154a21c7b00d49d5c7edb602432a25a2bf299e2463a168db94090bbd5d3df3d4162f16be5f93e37642b9dbbfce5a07c18c53908a0ae84824d428770ef7d9
|
7
|
+
data.tar.gz: 8d34985463cf666370043019e7d7de20d01155627cf8f4debf3e28203834a997192f3db02c5015a944d74826155b173119921a99611a8673e80f517e3925b670
|
data/lib/rules_ai.rb
CHANGED
@@ -6,24 +6,21 @@ module RulesAi
|
|
6
6
|
# Your code goes here...
|
7
7
|
class Rules_Set
|
8
8
|
def self.hours_passed
|
9
|
-
|
10
|
-
|
9
|
+
starting_time = 2%12
|
10
|
+
ending_time = 3%12
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
print "What is your working interval? >> "
|
13
|
+
time_interval = gets.chomp.to_i
|
14
14
|
|
15
|
-
|
15
|
+
hours_added_start = starting_time + time_interval
|
16
|
+
hours_added_end = ending_time + time_interval
|
16
17
|
|
17
|
-
|
18
|
-
second_ending_time = second_starting_time + hours_passed
|
19
|
-
|
20
|
-
puts "For starting time #{a} and ending time: #{b}: #{hours_passed} has passed."
|
21
|
-
puts "For starting time #{second_starting_time} and same hours passed: the second ending time is #{second_ending_time}"
|
18
|
+
puts "If starting time was #{starting_time}:00 and ending time was #{ending_time}:00, new time alottments is #{hours_added_start}:00 and #{hours_added_end}:00."
|
22
19
|
end
|
23
20
|
|
24
21
|
def self.tesla_multiplication
|
25
|
-
input = File.read("
|
26
|
-
rounds = File.read("
|
22
|
+
input = File.read("evo_data/tesla_multiplication/number/input.txt").strip.to_f
|
23
|
+
rounds = File.read("evo_data/tesla_multiplication/number/input.txt").strip.to_i
|
27
24
|
|
28
25
|
if input > 100
|
29
26
|
input = 0
|
@@ -47,30 +44,32 @@ module RulesAi
|
|
47
44
|
end
|
48
45
|
|
49
46
|
def self.autonomous_prompting
|
50
|
-
|
47
|
+
system("tts 'Time To Get Up!'")
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
monday_meds = File.read("data/medication/monday_meds.txt").strip
|
50
|
+
tuesday_meds = File.read("data/medication/tuesday_meds.txt").strip
|
51
|
+
wednesday_meds = File.read("data/medication/wednesday_meds.txt").strip
|
52
|
+
thursday_meds = File.read("data/medication/thursday_meds.txt").strip
|
53
|
+
friday_meds = File.read("data/medication/friday_meds.txt").strip
|
54
|
+
saturday_meds = File.read("data/medication/saturday_meds.txt").strip
|
55
|
+
sunday_meds = File.read("data/medication/sunday_meds.txt").strip
|
55
56
|
|
56
|
-
|
57
|
-
"brush_teeth",
|
58
|
-
"make_bed",
|
59
|
-
"go_run_laps",
|
60
|
-
"take_shower",
|
61
|
-
]
|
62
|
-
|
63
|
-
if version[number] == "brush_teeth"; system("tts 'Time to brush your teeth.', 'en'")
|
64
|
-
elsif version[number] == "make_bed"; system("tts 'Time to make your bed.', 'en'")
|
65
|
-
elsif version[number] == "go_run_laps"; system("tts 'Time to go run some laps.', 'en'")
|
66
|
-
elsif version[number] == "take_shower"; system("tts 'Time to take a shower.', 'en'")
|
67
|
-
end
|
57
|
+
system("date > data/time/date.txt")
|
68
58
|
|
69
|
-
|
59
|
+
data = File.read("data/time/date.txt").split(" ")
|
70
60
|
|
71
|
-
|
72
|
-
|
73
|
-
}
|
61
|
+
current_day = "#{data[0]}"
|
62
|
+
|
63
|
+
puts "You need to take #{current_day}'s medication."
|
64
|
+
|
65
|
+
if current_day == "Mon"; puts "Take: #{monday_meds}."
|
66
|
+
elsif current_day == "Tue"; puts "Take: #{tuesday_meds}."
|
67
|
+
elsif current_day == "Wed"; puts "Take: #{wednesday_meds}."
|
68
|
+
elsif current_day == "Thu"; puts "Take: #{thursday_meds}."
|
69
|
+
elsif current_day == "Fri"; puts "Take: #{friday_meds}."
|
70
|
+
elsif current_day == "Sat"; puts "Take: #{saturday_meds}."
|
71
|
+
elsif current_day == "Sun"; puts "Take: #{sunday_meds}."
|
72
|
+
end
|
74
73
|
end
|
75
74
|
|
76
75
|
def self.greet_user
|
@@ -81,20 +80,132 @@ module RulesAi
|
|
81
80
|
|
82
81
|
## Simple reciprocal cipher with randomized key.
|
83
82
|
def self.mixed_13
|
84
|
-
alph = File.read("keyset/alph.txt").strip
|
85
|
-
beta = File.read("keyset/beta.txt").strip
|
83
|
+
alph = File.read("evo_data/keyset/alph.txt").strip
|
84
|
+
beta = File.read("evo_data/keyset/beta.txt").strip
|
86
85
|
|
87
|
-
input = File.read("documents/plaintext.txt").to_s.
|
86
|
+
input = File.read("evo_data/documents/plaintext.txt").to_s.downcase
|
88
87
|
|
89
88
|
ciphertext = input.tr alph, beta
|
90
89
|
|
91
|
-
open("documents/ciphertext.txt", "w") { |f|
|
90
|
+
open("evo_data/documents/ciphertext.txt", "w") { |f|
|
92
91
|
f.puts ciphertext
|
93
92
|
}
|
94
93
|
end
|
95
94
|
|
96
|
-
|
97
|
-
|
95
|
+
def self.write_poetry
|
96
|
+
## Read In Each Poem
|
97
|
+
allistodust = File.read("syllables/allistodust.txt").strip
|
98
|
+
alongforestgreen = File.read("syllables/alongforestgreen.txt").strip
|
99
|
+
anarchojean = File.read("syllables/anarchojean.txt").strip
|
100
|
+
atmydoor = File.read("syllables/atmydoor.txt").strip
|
101
|
+
badinbed = File.read("syllables/badinbed.txt").strip
|
102
|
+
beingmyself = File.read("syllables/castleofthesea.txt").strip
|
103
|
+
coping = File.read("syllables/coping.txt").strip
|
104
|
+
devilgoodcompany = File.read("syllables/devilgoodcompany.txt").strip
|
105
|
+
dianacyberneticdreams = File.read("syllables/dianacyberneticdreams.txt").strip
|
106
|
+
dontfallback = File.read("syllables/droptheidealogies.txt").strip
|
107
|
+
flalaikurose = File.read("syllables/flalaikurose.txt").strip
|
108
|
+
girlnothingbutadream = File.read("syllables/goodopticsinthetropics.txt").strip
|
109
|
+
haywiremeltingdown = File.read("syllables/haywiremeltingdown.txt").strip
|
110
|
+
inthislandoftennessee = File.read("syllables/inthislandoftennessee.txt").strip
|
111
|
+
invisibleminorities = File.read("syllables/invisibleminorities.txt").strip
|
112
|
+
juicyneonsteak = File.read("syllables/juicyneonsteak.txt").strip
|
113
|
+
lackofcommunication = File.read("syllables/lackofcommunication.txt").strip
|
114
|
+
laimencoformoonlight = File.read("syllables/laimencoformoonlight.txt").strip
|
115
|
+
leadwithfeelingnotthemind = File.read("syllables/leadwithfeelingnotthemind.txt").strip
|
116
|
+
littleants = File.read("syllables/littleants.txt").strip
|
117
|
+
lonelypetalswither = File.read("syllables/lonelypetalswither.txt").strip
|
118
|
+
marrowlust = File.read("syllables/marrowlust.txt").strip
|
119
|
+
mmesmiled = File.read("syllables/mmesmiled.txt").strip
|
120
|
+
momentarysilence = File.read("syllables/nightlystatues.txt").strip
|
121
|
+
neveradrollmoment = File.read("syllables/neveradrollmoment.txt").strip
|
122
|
+
newlaconia = File.read("syllables/newlaconia.txt").strip
|
123
|
+
nightlystatues = File.read("syllables/policestate.txt").strip
|
124
|
+
sentimentality = File.read("syllables/sentimentality.txt").strip
|
125
|
+
shadowonthewall = File.read("syllables/shadowonthewall.txt").strip
|
126
|
+
shotgungirl = File.read("syllables/shotgungirl.txt").strip
|
127
|
+
skeletonsfinallaugh = File.read("syllables/skeletonsfinallaugh.txt").strip
|
128
|
+
sliceoflife = File.read("syllables/sliceoflife.txt").strip
|
129
|
+
spidersandtheghost = File.read("syllables/spidersandtheghost.txt").strip
|
130
|
+
superyacht = File.read("syllables/superyacht.txt").strip
|
131
|
+
thegirlwiththerosecheeks = File.read("syllables/thegirlwiththerosecheeks.txt").strip
|
132
|
+
turntodust = File.read("syllables/turntodust.txt").strip
|
133
|
+
undertheweepingwillowtree = File.read("syllables/undertheweepingwillowtree.txt").strip
|
134
|
+
unravelingfriendship = File.read("syllables/unravelingfriendship.txt").strip
|
135
|
+
waitinginthewall = File.read("syllables/waitinginthewall.txt").strip
|
136
|
+
whattheysayofrome = File.read("syllables/whattheysayofrome.txt").strip
|
137
|
+
windmillsong = File.read("syllables/windmillsong.txt").strip
|
138
|
+
|
139
|
+
## Assign Each Poem To Large String
|
140
|
+
super_poem = "
|
141
|
+
#{allistodust}
|
142
|
+
#{alongforestgreen}
|
143
|
+
#{anarchojean}
|
144
|
+
#{atmydoor}
|
145
|
+
#{badinbed}
|
146
|
+
#{beingmyself}
|
147
|
+
#{coping}
|
148
|
+
#{devilgoodcompany}
|
149
|
+
#{dianacyberneticdreams}
|
150
|
+
#{dontfallback}
|
151
|
+
#{flalaikurose}
|
152
|
+
#{girlnothingbutadream}
|
153
|
+
#{haywiremeltingdown}
|
154
|
+
#{inthislandoftennessee}
|
155
|
+
#{invisibleminorities}
|
156
|
+
#{juicyneonsteak}
|
157
|
+
#{lackofcommunication}
|
158
|
+
#{laimencoformoonlight}
|
159
|
+
#{leadwithfeelingnotthemind}
|
160
|
+
#{littleants}
|
161
|
+
#{lonelypetalswither}
|
162
|
+
#{marrowlust}
|
163
|
+
#{mmesmiled}
|
164
|
+
#{momentarysilence}
|
165
|
+
#{neveradrollmoment}
|
166
|
+
#{newlaconia}
|
167
|
+
#{nightlystatues}
|
168
|
+
#{sentimentality}
|
169
|
+
#{shadowonthewall}
|
170
|
+
#{shotgungirl}
|
171
|
+
#{skeletonsfinallaugh}
|
172
|
+
#{sliceoflife}
|
173
|
+
#{spidersandtheghost}
|
174
|
+
#{superyacht}
|
175
|
+
#{thegirlwiththerosecheeks}
|
176
|
+
#{turntodust}
|
177
|
+
#{undertheweepingwillowtree}
|
178
|
+
#{unravelingfriendship}
|
179
|
+
#{waitinginthewall}
|
180
|
+
#{whattheysayofrome}
|
181
|
+
#{windmillsong}
|
182
|
+
".split(" ").shuffle
|
183
|
+
|
184
|
+
possible_lines = [1, 2, 3, 4, 5, 6, 7, 8].shuffle
|
185
|
+
|
186
|
+
## Output New Poem From Shuffled String
|
187
|
+
line_1 = super_poem[possible_lines[0]]
|
188
|
+
line_2 = super_poem[possible_lines[1]]
|
189
|
+
line_3 = super_poem[possible_lines[2]]
|
190
|
+
line_4 = super_poem[possible_lines[3]]
|
191
|
+
line_5 = super_poem[possible_lines[4]]
|
192
|
+
line_6 = super_poem[possible_lines[5]]
|
193
|
+
line_7 = super_poem[possible_lines[6]]
|
194
|
+
line_8 = super_poem[possible_lines[7]]
|
195
|
+
|
196
|
+
open("output/poetry/poem.txt", "w") { |f|
|
197
|
+
f.puts "
|
198
|
+
#{line_1}
|
199
|
+
#{line_2}
|
200
|
+
#{line_3}
|
201
|
+
#{line_4}
|
202
|
+
#{line_5}
|
203
|
+
#{line_6}
|
204
|
+
#{line_7}
|
205
|
+
#{line_8}
|
206
|
+
"
|
207
|
+
}
|
208
|
+
end
|
98
209
|
|
99
210
|
def self.estimate_digest
|
100
211
|
ream_size = 4
|
@@ -125,184 +236,229 @@ module RulesAi
|
|
125
236
|
puts "The total ream count is: #{actual_multiplier} reams of #{ream_size} pages."
|
126
237
|
puts "With front and back cover, the final bound book is #{total_count} pages."
|
127
238
|
end
|
239
|
+
|
240
|
+
def self.calculate_hyper
|
241
|
+
print "What is the size of x? >> "; x = gets.chomp.to_i
|
242
|
+
print "What is the size of y? >> "; y = gets.chomp.to_i
|
243
|
+
print "What is the size of z? >> "; z = gets.chomp.to_i
|
244
|
+
|
245
|
+
square_x = x * 48
|
246
|
+
square_y = y * 48
|
247
|
+
square_z = z * 48
|
248
|
+
|
249
|
+
inches = x + y + z
|
250
|
+
hyper_inches = square_x + square_y + square_z
|
251
|
+
|
252
|
+
puts "\nThe size of the w axis of x is hyper distance #{square_x}"
|
253
|
+
puts "The size of the w axis of y is hyper distance #{square_y}"
|
254
|
+
puts "The size of the w axis of z is hyper distance #{square_z}"
|
255
|
+
|
256
|
+
puts "The hyper inches of the tessaract is #{hyper_inches} hyper distance."
|
257
|
+
end
|
258
|
+
|
259
|
+
def self.line
|
260
|
+
puts '
|
261
|
+
+----------------+
|
262
|
+
'
|
263
|
+
end
|
264
|
+
|
265
|
+
def self.square
|
266
|
+
puts '
|
267
|
+
+----------------+
|
268
|
+
| |
|
269
|
+
| |
|
270
|
+
| |
|
271
|
+
| |
|
272
|
+
| |
|
273
|
+
| |
|
274
|
+
| |
|
275
|
+
+----------------+
|
276
|
+
'
|
277
|
+
end
|
278
|
+
|
279
|
+
def self.cube
|
280
|
+
puts '
|
281
|
+
+----------------+
|
282
|
+
|\ |\
|
283
|
+
| \ | \
|
284
|
+
| \ | \
|
285
|
+
| +------------+---+
|
286
|
+
| | | |
|
287
|
+
| | | |
|
288
|
+
| | | |
|
289
|
+
+---+------------+ |
|
290
|
+
\ | \ |
|
291
|
+
\ | \ |
|
292
|
+
\| \|
|
293
|
+
+----------------+
|
294
|
+
'
|
295
|
+
end
|
296
|
+
|
297
|
+
def self.hyper
|
298
|
+
puts '
|
299
|
+
+----------------+
|
300
|
+
/|\ /|\
|
301
|
+
/ | \ / | \
|
302
|
+
/ | \ / | \
|
303
|
+
/ | +--------+---+---+
|
304
|
+
/ | /| / | /|
|
305
|
+
/ | / | / | / |
|
306
|
+
/ |/ | / |/ |
|
307
|
+
/ +---+----+-------+ |
|
308
|
+
/ / \ | / / \ |
|
309
|
+
/ / \ | / / \ |
|
310
|
+
/ / \| / / \|
|
311
|
+
+--------+-------+--------+-------+
|
312
|
+
|\ / /|\ / /
|
313
|
+
| \ / / | \ / /
|
314
|
+
| \ / / | \ / /
|
315
|
+
| ++-------+---+---+/ /
|
316
|
+
| + / | + /
|
317
|
+
| /| / | /| /
|
318
|
+
| / | / | / | /
|
319
|
+
+---+----+-------+/ | /
|
320
|
+
\ | / \ | /
|
321
|
+
\ | / \ | /
|
322
|
+
\| / \| /
|
323
|
+
+----------------+
|
324
|
+
'
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
328
|
+
|
329
|
+
class RuleCalculation
|
330
|
+
def self.calculate_metarules
|
331
|
+
print "How many regular rules? >> "
|
332
|
+
|
333
|
+
r = gets.chomp.to_i
|
334
|
+
|
335
|
+
# For each amount of rules, meta rules is that many variations of rule combination.
|
336
|
+
meta_rule_count = r
|
337
|
+
meta_rule_size = r * r
|
338
|
+
meta_total = meta_rule_size * r
|
339
|
+
|
340
|
+
puts "For #{r} many regular rules, there are #{meta_rule_count} metarule variations of #{meta_rule_size} each. Totalling #{meta_total} lines of code."
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
# Rulesets generated by the algorithm itself.
|
345
|
+
class MetaRuleset
|
346
|
+
|
347
|
+
def self.meta_rule_one
|
348
|
+
RulesAi::Rule_Set.estimate_digest
|
349
|
+
RulesAi::Rule_Set.autonomous_prompting
|
350
|
+
RulesAi::Rule_Set.calculate_hyper
|
351
|
+
RulesAi::Rule_Set.mixed_13
|
352
|
+
RulesAi::Rule_Set.hours_passed
|
353
|
+
RulesAi::Rule_Set.tesla_multiplication
|
354
|
+
end
|
355
|
+
|
356
|
+
end
|
357
|
+
|
358
|
+
# Evolutionary Function that calls the rulesets.
|
359
|
+
class Evo_Function
|
360
|
+
end
|
361
|
+
|
362
|
+
class Chatbot
|
363
|
+
|
364
|
+
def self.bianca_name
|
365
|
+
bot_name = File.read("bot_identity/name.txt").strip
|
366
|
+
your_name = File.read("usr_identity/name.txt").strip
|
367
|
+
|
368
|
+
puts "#{bot_name}: What is your name?"
|
369
|
+
print "#{your_name}: My name is "; my_name = gets.chomp
|
370
|
+
|
371
|
+
open("usr_identity/name.txt", "w") { |f|
|
372
|
+
f.puts my_name
|
373
|
+
}
|
374
|
+
|
375
|
+
puts "#{bot_name}: Nice to meet you, #{my_name}."
|
376
|
+
end
|
377
|
+
|
378
|
+
def self.bianca_pets
|
379
|
+
bot_name = File.read("bot_identity/name.txt").strip
|
380
|
+
your_name = File.read("usr_identity/name.txt").strip
|
381
|
+
|
382
|
+
puts "#{bot_name}: Do you have a pet?"
|
383
|
+
print "#{your_name}: My pet is "; my_pet = gets.chomp
|
384
|
+
|
385
|
+
open("usr_identity/pet.txt", "w") { |f|
|
386
|
+
f.puts my_pet
|
387
|
+
}
|
388
|
+
|
389
|
+
puts "#{bot_name}: You have a nice #{my_pet}."
|
390
|
+
end
|
391
|
+
|
392
|
+
def self.bianca_hobby
|
393
|
+
bot_name = File.read("bot_identity/name.txt").strip
|
394
|
+
your_name = File.read("usr_identity/name.txt").strip
|
395
|
+
|
396
|
+
puts "#{bot_name}: What is your hobby?"
|
397
|
+
print "#{your_name}: My hobby is "; my_hobby = gets.chomp
|
398
|
+
|
399
|
+
open("usr_identity/hobby.txt", "w") { |f|
|
400
|
+
f.puts my_hobby
|
401
|
+
}
|
402
|
+
|
403
|
+
puts "#{bot_name}: You have a nice #{my_hobby}."
|
404
|
+
end
|
405
|
+
|
406
|
+
def self.bianca_jobs
|
407
|
+
bot_name = File.read("bot_identity/name.txt").strip
|
408
|
+
your_name = File.read("usr_identity/name.txt").strip
|
409
|
+
|
410
|
+
puts "#{bot_name}: What is your job?"
|
411
|
+
print "#{your_name}: My job is "; my_job = gets.chomp
|
412
|
+
|
413
|
+
open("usr_identity/job.txt", "w") { |f|
|
414
|
+
f.puts my_job
|
415
|
+
}
|
416
|
+
|
417
|
+
puts "#{bot_name}: Sounds like #{my_job} is hard work."
|
418
|
+
end
|
419
|
+
|
420
|
+
def self.bianca_skills
|
421
|
+
bot_name = File.read("bot_identity/name.txt").strip
|
422
|
+
your_name = File.read("usr_identity/name.txt").strip
|
423
|
+
|
424
|
+
puts "#{bot_name}: What is your skill?"
|
425
|
+
print "#{your_name}: My skill is "; my_skill = gets.chomp
|
426
|
+
|
427
|
+
open("usr_identity/skill.txt", "w") { |f|
|
428
|
+
f.puts my_skill
|
429
|
+
}
|
430
|
+
|
431
|
+
puts "#{bot_name}: #{my_skill} sounds like an interesting skill."
|
432
|
+
end
|
128
433
|
end
|
129
434
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
# # Space between the objects.
|
160
|
-
# def negative_perimeters
|
161
|
-
# # Base distance between objects.
|
162
|
-
# base_distance = 1_000_000_000
|
163
|
-
#
|
164
|
-
# # Estimated divider between specific objects to base distance.
|
165
|
-
# space_between_planets = 43.8
|
166
|
-
# space_between_moons = 14.6
|
167
|
-
# space_between_stars = 876
|
168
|
-
# space_between_blackholes = 2628
|
169
|
-
#
|
170
|
-
# # Minimum distance between objects.
|
171
|
-
# planet_distance = base_distance / space_between_planets
|
172
|
-
# moon_distance = base_distance / space_between_moons
|
173
|
-
# star_distance = base_distance / space_between_stars
|
174
|
-
# blackhole_distance = base_distance / space_between_blackholes
|
175
|
-
#
|
176
|
-
# # Actual distance between objects
|
177
|
-
# actual_planets = planet_distance * 10
|
178
|
-
# actual_moons = moon_distance * 10
|
179
|
-
# actual_stars = star_distance * 10
|
180
|
-
# actual_blackholes = blackhole_distance * 10
|
181
|
-
#
|
182
|
-
# # The output results of distance between objects.
|
183
|
-
# puts "The distance between planets is #{actual_planets} miles."; sleep(3)
|
184
|
-
# puts "The distance between moons is #{actual_moons} miles."; sleep(3)
|
185
|
-
# puts "The distance between stars is #{actual_stars} miles."; sleep(3)
|
186
|
-
# puts "The distance between blackholes is #{actual_blackholes} miles."; sleep(3)
|
187
|
-
# end
|
188
|
-
#
|
189
|
-
# end
|
190
|
-
#
|
191
|
-
# # Changing perimeters
|
192
|
-
# class Dynamic_Perimeters
|
193
|
-
#
|
194
|
-
# # The objects within the space.
|
195
|
-
# def positive_perimeters
|
196
|
-
# spaceship = File.read("data/dynamic/positive_perimenters/spaceship_size.txt").strip.to_i
|
197
|
-
# space_station = spaceship * 200
|
198
|
-
# satalite = space_station / 10
|
199
|
-
#
|
200
|
-
# puts "The total size of the space shuttle is #{spaceship} feet."; sleep(3)
|
201
|
-
# puts "The total size of the space station is #{space_station} feet."; sleep(3)
|
202
|
-
# puts "The total size of the satalite is #{satalite} feet."; sleep(3)
|
203
|
-
# end
|
204
|
-
#
|
205
|
-
# # Space between the objects.
|
206
|
-
# def negative_perimeters
|
207
|
-
# base_multiplier = 10
|
208
|
-
#
|
209
|
-
# # Minimum space between objects.
|
210
|
-
# space_between_spaceships = File.read("data/dynamic/negative_perimeters/space_between_spaceships.txt").strip.to_i
|
211
|
-
# space_between_station = File.read("data/dynamic/negative_perimeters/space_between_station.txt").strip.to_i
|
212
|
-
# space_between_satalite = File.read("data/dynamic/negative_perimeters/space_between_satalite.txt").strip.to_i
|
213
|
-
#
|
214
|
-
# # Actual space between objects
|
215
|
-
# actual_spaceship_distance = space_between_spaceships * base_multiplier
|
216
|
-
# actual_station_distance = space_between_station * base_multiplier
|
217
|
-
# actual_satalite_distance = space_between_satalite * base_multiplier
|
218
|
-
#
|
219
|
-
# puts "The minimum space between shuttles is #{actual_spaceship_distance} feet."; sleep(3)
|
220
|
-
# puts "The minimum space between stations is #{actual_station_distance} feet."; sleep(3)
|
221
|
-
# puts "The minimum space between satalites is #{actual_satalite_distance} feet."; sleep(3)
|
222
|
-
# end
|
223
|
-
#
|
224
|
-
# end
|
225
|
-
#
|
226
|
-
# class Chatbot
|
227
|
-
# Bianca asks your name.
|
228
|
-
#def bianca_name
|
229
|
-
# bot_name = File.read("bot_identity/name.txt").strip
|
230
|
-
# your_name = File.read("usr_identity/name.txt").strip
|
231
|
-
#
|
232
|
-
# puts "#{bot_name}: What is your name?"
|
233
|
-
# print "#{your_name}: My name is "; my_name = gets.chomp
|
234
|
-
#
|
235
|
-
# open("usr_identity/name.txt", "w") { |f|
|
236
|
-
# f.puts my_name
|
237
|
-
# }
|
238
|
-
#
|
239
|
-
# puts "#{bot_name}: Nice to meet you, #{my_name}."
|
240
|
-
#end
|
241
|
-
#
|
242
|
-
# Bianca asks if you have a pet.
|
243
|
-
#def bianca_pets
|
244
|
-
# bot_name = File.read("bot_identity/name.txt").strip
|
245
|
-
# your_name = File.read("usr_identity/name.txt").strip
|
246
|
-
#
|
247
|
-
# puts "#{bot_name}: Do you have a pet?"
|
248
|
-
# print "#{your_name}: My pet is "; my_pet = gets.chomp
|
249
|
-
#
|
250
|
-
# open("usr_identity/pet.txt", "w") { |f|
|
251
|
-
# f.puts my_pet
|
252
|
-
# }
|
253
|
-
#
|
254
|
-
# puts "#{bot_name}: You have a nice #{my_pet}."
|
255
|
-
#end
|
256
|
-
#
|
257
|
-
# Bianca asks what your hobby is.
|
258
|
-
#def bianca_hobby
|
259
|
-
# bot_name = File.read("bot_identity/name.txt").strip
|
260
|
-
# your_name = File.read("usr_identity/name.txt").strip
|
261
|
-
#
|
262
|
-
# puts "#{bot_name}: What is your hobby?"
|
263
|
-
# print "#{your_name}: My hobby is "; my_hobby = gets.chomp
|
264
|
-
#
|
265
|
-
# open("usr_identity/hobby.txt", "w") { |f|
|
266
|
-
# f.puts my_hobby
|
267
|
-
# }
|
268
|
-
#
|
269
|
-
# puts "#{bot_name}: You have a nice #{my_hobby}."
|
270
|
-
#end
|
271
|
-
#
|
272
|
-
#def bianca_jobs
|
273
|
-
# bot_name = File.read("bot_identity/name.txt").strip
|
274
|
-
# your_name = File.read("usr_identity/name.txt").strip
|
275
|
-
#
|
276
|
-
# puts "#{bot_name}: What is your job?"
|
277
|
-
# print "#{your_name}: My job is "; my_job = gets.chomp
|
278
|
-
#
|
279
|
-
# open("usr_identity/job.txt", "w") { |f|
|
280
|
-
# f.puts my_job
|
281
|
-
# }
|
282
|
-
#
|
283
|
-
# puts "#{bot_name}: Sounds like #{my_job} is hard work."
|
284
|
-
#end
|
285
|
-
#
|
286
|
-
#def bianca_skills
|
287
|
-
# bot_name = File.read("bot_identity/name.txt").strip
|
288
|
-
# your_name = File.read("usr_identity/name.txt").strip
|
289
|
-
#
|
290
|
-
# puts "#{bot_name}: What is your skill?"
|
291
|
-
# print "#{your_name}: My skill is "; my_skill = gets.chomp
|
292
|
-
#
|
293
|
-
# open("usr_identity/skill.txt", "w") { |f|
|
294
|
-
# f.puts my_skill
|
295
|
-
# }
|
296
|
-
#
|
297
|
-
# puts "#{bot_name}: #{my_skill} sounds like an interesting skill."
|
298
|
-
#end
|
299
|
-
#
|
300
|
-
#system("clear")
|
301
|
-
#
|
302
|
-
#bianca_name; sleep(3)
|
303
|
-
#bianca_pets; sleep(3)
|
304
|
-
#bianca_hobby; sleep(3)
|
305
|
-
#bianca_jobs; sleep(3)
|
306
|
-
#bianca_skills; sleep(3)
|
307
|
-
# end
|
435
|
+
class New_Routine # Generates Meta rules
|
436
|
+
|
437
|
+
def self.generate_ruleset
|
438
|
+
ruleset = File.readlines("evo_data/rules/input.txt")
|
439
|
+
|
440
|
+
numbers = "0 1 2 3 4 5".split(" ").shuffle
|
441
|
+
|
442
|
+
one = numbers[0].to_i
|
443
|
+
two = numbers[1].to_i
|
444
|
+
tre = numbers[2].to_i
|
445
|
+
fro = numbers[3].to_i
|
446
|
+
fiv = numbers[4].to_i
|
447
|
+
six = numbers[5].to_i
|
448
|
+
|
449
|
+
open("new_routine.rb", "w") { |f|
|
450
|
+
f.puts "require 'rules_ai'\n\n"
|
451
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[one]}"
|
452
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[two]}"
|
453
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[tre]}"
|
454
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[fro]}"
|
455
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[fiv]}"
|
456
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[six]}"
|
457
|
+
}
|
458
|
+
end
|
459
|
+
|
460
|
+
def self.test_rule
|
461
|
+
system("ruby new_routine.rb")
|
462
|
+
end
|
463
|
+
end
|
308
464
|
end
|
data/lib/rules_ai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rules_ai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gitea
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a collection of different rules based functions, from calculating
|
14
14
|
how many hours have passed, tesla multiplication, autonomous prompting ( such as
|