rules_ai 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rules_ai.rb +191 -36
  3. data/lib/rules_ai/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 597b27165fc79d8ae33b488847f0aae332127ee208bc52533ef3d92db54eac62
4
- data.tar.gz: d44c6cd48d7db8b44f1c56e070bf5d6573ce8c16c58817db66888b4fa9a40f56
3
+ metadata.gz: 7878a0a5df36a236fe35cb77739cbaf25185e5a2f90a7a8af8ebebb7704973a7
4
+ data.tar.gz: cf736128214579c84d5c1634daa51d66a936fff11c6ab8b30c8c840155223b56
5
5
  SHA512:
6
- metadata.gz: 2129c12b65c0bac454b73d3dfa2c2007de46909146a9e92c4c3f9fa4e2040e62ad68c485c79c1111b85d446144416828175deee73bd4f46e3fd32b8e5d8d4c5a
7
- data.tar.gz: cf308e16c6e0293ce401a96d32949d0f02cc6d4c7d33c0918a008a4e594bce19ea6f1fc5c7fe5e35f672eca33d53abc5ac5ae296cc72a7a378fb1ff26f020101
6
+ metadata.gz: c6f3154a21c7b00d49d5c7edb602432a25a2bf299e2463a168db94090bbd5d3df3d4162f16be5f93e37642b9dbbfce5a07c18c53908a0ae84824d428770ef7d9
7
+ data.tar.gz: 8d34985463cf666370043019e7d7de20d01155627cf8f4debf3e28203834a997192f3db02c5015a944d74826155b173119921a99611a8673e80f517e3925b670
@@ -6,19 +6,16 @@ module RulesAi
6
6
  # Your code goes here...
7
7
  class Rules_Set
8
8
  def self.hours_passed
9
- a = File.read("evo_data/hours_passed/number/a_input.txt").strip.to_i
10
- b = File.read("evo_data/hours_passed/number/b_input.txt").strip.to_i
9
+ starting_time = 2%12
10
+ ending_time = 3%12
11
11
 
12
- starting_time = a
13
- ending_time = b
12
+ print "What is your working interval? >> "
13
+ time_interval = gets.chomp.to_i
14
14
 
15
- hours_passed = ending_time - starting_time
15
+ hours_added_start = starting_time + time_interval
16
+ hours_added_end = ending_time + time_interval
16
17
 
17
- second_starting_time = a + interval_a
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
@@ -47,30 +44,32 @@ module RulesAi
47
44
  end
48
45
 
49
46
  def self.autonomous_prompting
50
- number = File.read("evo_data/autonomous_prompting/input/number.txt").strip.to_i
47
+ system("tts 'Time To Get Up!'")
51
48
 
52
- if number > 3
53
- number = 0
54
- end
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
- version = [
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
- number = number + 1
59
+ data = File.read("data/time/date.txt").split(" ")
70
60
 
71
- open("data/input/number.txt", "w") { |f|
72
- f.puts number
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
@@ -93,8 +92,120 @@ module RulesAi
93
92
  }
94
93
  end
95
94
 
96
- #def self.write_poetry
97
- #end
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
@@ -212,6 +323,40 @@ module RulesAi
212
323
  +----------------+
213
324
  '
214
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
215
360
  end
216
361
 
217
362
  class Chatbot
@@ -292,13 +437,23 @@ module RulesAi
292
437
  def self.generate_ruleset
293
438
  ruleset = File.readlines("evo_data/rules/input.txt")
294
439
 
295
- scatter_rules = ruleset.shuffle
440
+ numbers = "0 1 2 3 4 5".split(" ").shuffle
296
441
 
297
- puts "Generated Rules:\n#{scatter_rules}"
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
298
448
 
299
449
  open("new_routine.rb", "w") { |f|
300
- puts 'require "rules_ai"'
301
- puts "\n#{scatter_rules}"
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]}"
302
457
  }
303
458
  end
304
459
 
@@ -1,3 +1,3 @@
1
1
  module RulesAi
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
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.5.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-07 00:00:00.000000000 Z
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