rules_ai 0.2.0 → 0.8.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 +217 -41
- 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: 917312bdc11c8d360345f504f6a160d8c21d80b56b3c5ac06be35026e5d1f63c
|
4
|
+
data.tar.gz: 773c7dcc9056709b30d5e8a5cf4ab395c63846cbd88bb4ea310c420a6805c575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10a75fa6ac8e510d1a6d3f4f523db82fe7693080ae756314256dbae347eb09b3d121ba324826ef3b624c8c7f01649bb666e786843f8fb18fb7a6bf95272b7f05
|
7
|
+
data.tar.gz: 613f23e64aa1c446e5ad21676f56e62e1ba9c3ae3bab3edf27b16b30bb5c1a442ea909b475b588b7dc93b94fda85cf7cb19925065bf7e403bfd002fd84252137
|
data/lib/rules_ai.rb
CHANGED
@@ -6,24 +6,26 @@ module RulesAi
|
|
6
6
|
# Your code goes here...
|
7
7
|
class Rules_Set
|
8
8
|
def self.hours_passed
|
9
|
-
|
10
|
-
b = File.read("data/hours_passed/number/b_input.txt").strip.to_i
|
9
|
+
bot_name = File.read("data/bot_identity/name.txt").strip
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
print "What is your starting time? >> "
|
12
|
+
starting_time = gets.chomp.strip.to_i # % 12
|
14
13
|
|
15
|
-
|
14
|
+
print "What is your ending time? >> "
|
15
|
+
ending_time = gets.chomp.strip.to_i # %12
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
print "What is your working interval? >> "
|
18
|
+
time_interval = gets.chomp.to_i
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
hours_added_start = starting_time + time_interval
|
21
|
+
hours_added_end = ending_time + time_interval
|
22
|
+
|
23
|
+
puts "#{bot_name}: If starting time was #{starting_time}:00 and ending time was #{ending_time}:00,\nthe new time alottments are #{hours_added_start}:00 and #{hours_added_end}:00."
|
22
24
|
end
|
23
25
|
|
24
26
|
def self.tesla_multiplication
|
25
|
-
input = File.read("
|
26
|
-
rounds = File.read("
|
27
|
+
input = File.read("evo_data/tesla_multiplication/number/input.txt").strip.to_f
|
28
|
+
rounds = File.read("evo_data/tesla_multiplication/number/input.txt").strip.to_i
|
27
29
|
|
28
30
|
if input > 100
|
29
31
|
input = 0
|
@@ -47,30 +49,32 @@ module RulesAi
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def self.autonomous_prompting
|
50
|
-
|
52
|
+
system("tts 'Time To Get Up!'")
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
monday_meds = File.read("data/medication/monday_meds.txt").strip
|
55
|
+
tuesday_meds = File.read("data/medication/tuesday_meds.txt").strip
|
56
|
+
wednesday_meds = File.read("data/medication/wednesday_meds.txt").strip
|
57
|
+
thursday_meds = File.read("data/medication/thursday_meds.txt").strip
|
58
|
+
friday_meds = File.read("data/medication/friday_meds.txt").strip
|
59
|
+
saturday_meds = File.read("data/medication/saturday_meds.txt").strip
|
60
|
+
sunday_meds = File.read("data/medication/sunday_meds.txt").strip
|
55
61
|
|
56
|
-
|
57
|
-
"brush_teeth",
|
58
|
-
"make_bed",
|
59
|
-
"go_run_laps",
|
60
|
-
"take_shower",
|
61
|
-
]
|
62
|
+
system("date > data/time/date.txt")
|
62
63
|
|
63
|
-
|
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
|
64
|
+
data = File.read("data/time/date.txt").split(" ")
|
68
65
|
|
69
|
-
|
66
|
+
current_day = "#{data[0]}"
|
70
67
|
|
71
|
-
|
72
|
-
|
73
|
-
}
|
68
|
+
puts "You need to take #{current_day}'s medication."
|
69
|
+
|
70
|
+
if current_day == "Mon"; puts "Take: #{monday_meds}."
|
71
|
+
elsif current_day == "Tue"; puts "Take: #{tuesday_meds}."
|
72
|
+
elsif current_day == "Wed"; puts "Take: #{wednesday_meds}."
|
73
|
+
elsif current_day == "Thu"; puts "Take: #{thursday_meds}."
|
74
|
+
elsif current_day == "Fri"; puts "Take: #{friday_meds}."
|
75
|
+
elsif current_day == "Sat"; puts "Take: #{saturday_meds}."
|
76
|
+
elsif current_day == "Sun"; puts "Take: #{sunday_meds}."
|
77
|
+
end
|
74
78
|
end
|
75
79
|
|
76
80
|
def self.greet_user
|
@@ -81,20 +85,148 @@ module RulesAi
|
|
81
85
|
|
82
86
|
## Simple reciprocal cipher with randomized key.
|
83
87
|
def self.mixed_13
|
84
|
-
alph = File.read("keyset/alph.txt").strip
|
85
|
-
beta = File.read("keyset/beta.txt").strip
|
88
|
+
alph = File.read("evo_data/keyset/alph.txt").strip
|
89
|
+
beta = File.read("evo_data/keyset/beta.txt").strip
|
86
90
|
|
87
|
-
input = File.read("documents/plaintext.txt").to_s.
|
91
|
+
input = File.read("evo_data/documents/plaintext.txt").to_s.downcase
|
88
92
|
|
89
93
|
ciphertext = input.tr alph, beta
|
90
94
|
|
91
|
-
open("documents/ciphertext.txt", "w") { |f|
|
95
|
+
open("evo_data/documents/ciphertext.txt", "w") { |f|
|
92
96
|
f.puts ciphertext
|
93
97
|
}
|
94
98
|
end
|
95
99
|
|
96
|
-
|
97
|
-
|
100
|
+
def self.write_poetry
|
101
|
+
## Read In Each Poem
|
102
|
+
allistodust = File.read("syllables/allistodust.txt").strip
|
103
|
+
alongforestgreen = File.read("syllables/alongforestgreen.txt").strip
|
104
|
+
anarchojean = File.read("syllables/anarchojean.txt").strip
|
105
|
+
atmydoor = File.read("syllables/atmydoor.txt").strip
|
106
|
+
badinbed = File.read("syllables/badinbed.txt").strip
|
107
|
+
beingmyself = File.read("syllables/castleofthesea.txt").strip
|
108
|
+
coping = File.read("syllables/coping.txt").strip
|
109
|
+
devilgoodcompany = File.read("syllables/devilgoodcompany.txt").strip
|
110
|
+
dianacyberneticdreams = File.read("syllables/dianacyberneticdreams.txt").strip
|
111
|
+
dontfallback = File.read("syllables/dontfallback.txt").strip
|
112
|
+
droptheidealogies = File.read("syllables/droptheideologies.txt").strip
|
113
|
+
flalaikurose = File.read("syllables/flalaikurose.txt").strip
|
114
|
+
girlnothingbutadream = File.read("syllables/goodopticsinthetropics.txt").strip
|
115
|
+
haywiremeltingdown = File.read("syllables/haywiremeltingdown.txt").strip
|
116
|
+
inthislandoftennessee = File.read("syllables/inthislandoftennessee.txt").strip
|
117
|
+
invisibleminorities = File.read("syllables/invisibleminorities.txt").strip
|
118
|
+
juicyneonsteak = File.read("syllables/juicyneonsteak.txt").strip
|
119
|
+
lackofcommunication = File.read("syllables/lackofcommunication.txt").strip
|
120
|
+
laimencoformoonlight = File.read("syllables/laimencoformoonlight.txt").strip
|
121
|
+
leadwithfeelingnotthemind = File.read("syllables/leadwithfeelingnotthemind.txt").strip
|
122
|
+
littleants = File.read("syllables/littleants.txt").strip
|
123
|
+
lonelypetalswither = File.read("syllables/lonelypetalswither.txt").strip
|
124
|
+
marrowlust = File.read("syllables/marrowlust.txt").strip
|
125
|
+
mmesmiled = File.read("syllables/mmesmiled.txt").strip
|
126
|
+
momentarysilence = File.read("syllables/nightlystatues.txt").strip
|
127
|
+
neveradrollmoment = File.read("syllables/neveradrollmoment.txt").strip
|
128
|
+
newlaconia = File.read("syllables/newlaconia.txt").strip
|
129
|
+
nightlystatues = File.read("syllables/policestate.txt").strip
|
130
|
+
sentimentality = File.read("syllables/sentimentality.txt").strip
|
131
|
+
shadowonthewall = File.read("syllables/shadowonthewall.txt").strip
|
132
|
+
shotgungirl = File.read("syllables/shotgungirl.txt").strip
|
133
|
+
skeletonsfinallaugh = File.read("syllables/skeletonsfinallaugh.txt").strip
|
134
|
+
sliceoflife = File.read("syllables/sliceoflife.txt").strip
|
135
|
+
spidersandtheghost = File.read("syllables/spidersandtheghost.txt").strip
|
136
|
+
superyacht = File.read("syllables/superyacht.txt").strip
|
137
|
+
thegirlwiththerosecheeks = File.read("syllables/thegirlwiththerosecheeks.txt").strip
|
138
|
+
turntodust = File.read("syllables/turntodust.txt").strip
|
139
|
+
undertheweepingwillowtree = File.read("syllables/undertheweepingwillowtree.txt").strip
|
140
|
+
unravelingfriendship = File.read("syllables/unravelingfriendship.txt").strip
|
141
|
+
waitinginthewall = File.read("syllables/waitinginthewall.txt").strip
|
142
|
+
whattheysayofrome = File.read("syllables/whattheysayofrome.txt").strip
|
143
|
+
windmillsong = File.read("syllables/windmillsong.txt").strip
|
144
|
+
|
145
|
+
## Assign Each Poem To Large String
|
146
|
+
super_poem = [
|
147
|
+
allistodust,
|
148
|
+
alongforestgreen,
|
149
|
+
anarchojean,
|
150
|
+
atmydoor,
|
151
|
+
badinbed,
|
152
|
+
beingmyself,
|
153
|
+
coping,
|
154
|
+
devilgoodcompany,
|
155
|
+
dianacyberneticdreams,
|
156
|
+
dontfallback,
|
157
|
+
droptheidealogies,
|
158
|
+
flalaikurose,
|
159
|
+
girlnothingbutadream,
|
160
|
+
haywiremeltingdown,
|
161
|
+
inthislandoftennessee,
|
162
|
+
invisibleminorities,
|
163
|
+
juicyneonsteak,
|
164
|
+
lackofcommunication,
|
165
|
+
laimencoformoonlight,
|
166
|
+
leadwithfeelingnotthemind,
|
167
|
+
littleants,
|
168
|
+
lonelypetalswither,
|
169
|
+
marrowlust,
|
170
|
+
mmesmiled,
|
171
|
+
momentarysilence,
|
172
|
+
neveradrollmoment,
|
173
|
+
newlaconia,
|
174
|
+
nightlystatues,
|
175
|
+
sentimentality,
|
176
|
+
shadowonthewall,
|
177
|
+
shotgungirl,
|
178
|
+
skeletonsfinallaugh,
|
179
|
+
sliceoflife,
|
180
|
+
spidersandtheghost,
|
181
|
+
superyacht,
|
182
|
+
thegirlwiththerosecheeks,
|
183
|
+
turntodust,
|
184
|
+
undertheweepingwillowtree,
|
185
|
+
unravelingfriendship,
|
186
|
+
waitinginthewall,
|
187
|
+
whattheysayofrome,
|
188
|
+
windmillsong,
|
189
|
+
]
|
190
|
+
|
191
|
+
ran_1 = rand(8) % 12
|
192
|
+
ran_2 = rand(8) % 12
|
193
|
+
ran_3 = rand(8) % 12
|
194
|
+
ran_4 = rand(8) % 12
|
195
|
+
ran_5 = rand(8) % 12
|
196
|
+
ran_6 = rand(8) % 12
|
197
|
+
ran_7 = rand(8) % 12
|
198
|
+
ran_8 = rand(8) % 12
|
199
|
+
|
200
|
+
poem_1 = super_poem[ran_1].split(",")
|
201
|
+
poem_2 = super_poem[ran_2].split(",")
|
202
|
+
poem_3 = super_poem[ran_3].split(",")
|
203
|
+
poem_4 = super_poem[ran_4].split(",")
|
204
|
+
poem_5 = super_poem[ran_5].split(",")
|
205
|
+
poem_6 = super_poem[ran_6].split(",")
|
206
|
+
poem_7 = super_poem[ran_7].split(",")
|
207
|
+
poem_8 = super_poem[ran_8].split(",")
|
208
|
+
|
209
|
+
## Output New Poem From Shuffled String
|
210
|
+
line_1 = poem_1[0]
|
211
|
+
line_2 = poem_2[1]
|
212
|
+
line_3 = poem_3[2]
|
213
|
+
line_4 = poem_4[3]
|
214
|
+
line_5 = poem_5[4]
|
215
|
+
line_6 = poem_6[5]
|
216
|
+
line_7 = poem_7[6]
|
217
|
+
line_8 = poem_8[7]
|
218
|
+
|
219
|
+
open("output/poetry/poem.txt", "w") { |f|
|
220
|
+
f.puts line_1# .strip
|
221
|
+
f.puts line_2# .strip
|
222
|
+
f.puts line_3# .strip
|
223
|
+
f.puts line_4# .strip
|
224
|
+
f.puts line_5# .strip
|
225
|
+
f.puts line_6# .strip
|
226
|
+
f.puts line_7# .strip
|
227
|
+
f.puts line_8# .strip
|
228
|
+
}
|
229
|
+
end
|
98
230
|
|
99
231
|
def self.estimate_digest
|
100
232
|
ream_size = 4
|
@@ -212,6 +344,40 @@ module RulesAi
|
|
212
344
|
+----------------+
|
213
345
|
'
|
214
346
|
end
|
347
|
+
|
348
|
+
end
|
349
|
+
|
350
|
+
class RuleCalculation
|
351
|
+
def self.calculate_metarules
|
352
|
+
print "How many regular rules? >> "
|
353
|
+
|
354
|
+
r = gets.chomp.to_i
|
355
|
+
|
356
|
+
# For each amount of rules, meta rules is that many variations of rule combination.
|
357
|
+
meta_rule_count = r
|
358
|
+
meta_rule_size = r * r
|
359
|
+
meta_total = meta_rule_size * r
|
360
|
+
|
361
|
+
puts "For #{r} many regular rules, there are #{meta_rule_count} metarule variations of #{meta_rule_size} each. Totalling #{meta_total} lines of code."
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
# Rulesets generated by the algorithm itself.
|
366
|
+
class MetaRuleset
|
367
|
+
|
368
|
+
def self.meta_rule_one
|
369
|
+
RulesAi::Rule_Set.estimate_digest
|
370
|
+
RulesAi::Rule_Set.autonomous_prompting
|
371
|
+
RulesAi::Rule_Set.calculate_hyper
|
372
|
+
RulesAi::Rule_Set.mixed_13
|
373
|
+
RulesAi::Rule_Set.hours_passed
|
374
|
+
RulesAi::Rule_Set.tesla_multiplication
|
375
|
+
end
|
376
|
+
|
377
|
+
end
|
378
|
+
|
379
|
+
# Evolutionary Function that calls the rulesets.
|
380
|
+
class Evo_Function
|
215
381
|
end
|
216
382
|
|
217
383
|
class Chatbot
|
@@ -290,15 +456,25 @@ module RulesAi
|
|
290
456
|
class New_Routine # Generates Meta rules
|
291
457
|
|
292
458
|
def self.generate_ruleset
|
293
|
-
ruleset = File.readlines("
|
459
|
+
ruleset = File.readlines("evo_data/rules/input.txt")
|
294
460
|
|
295
|
-
|
461
|
+
numbers = "0 1 2 3 4 5".split(" ").shuffle
|
296
462
|
|
297
|
-
|
463
|
+
one = numbers[0].to_i
|
464
|
+
two = numbers[1].to_i
|
465
|
+
tre = numbers[2].to_i
|
466
|
+
fro = numbers[3].to_i
|
467
|
+
fiv = numbers[4].to_i
|
468
|
+
six = numbers[5].to_i
|
298
469
|
|
299
470
|
open("new_routine.rb", "w") { |f|
|
300
|
-
puts
|
301
|
-
puts "
|
471
|
+
f.puts "require 'rules_ai'\n\n"
|
472
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[one]}"
|
473
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[two]}"
|
474
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[tre]}"
|
475
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[fro]}"
|
476
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[fiv]}"
|
477
|
+
f.puts "RulesAi::Rule_Set.#{ruleset[six]}"
|
302
478
|
}
|
303
479
|
end
|
304
480
|
|
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.8.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-17 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
|