rules_ai 0.3.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rules_ai.rb +264 -41
  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: 82b6efea2a8e4ddbe8bf904580c8bfc8c6fa7719fdcd0b195f3616ab5e5211a4
4
- data.tar.gz: 057076d3cc3ee83a91c5ab4921128397148267580d294b0bc6cf85c063f575bc
3
+ metadata.gz: 5ccb715e8bc3f898d3fd86f18b13a09a8ccbf13400b3942d813d706fefb07553
4
+ data.tar.gz: dd41894768f44f30f532214b3e47d7f0eb29e784ef8011e669902cf447235897
5
5
  SHA512:
6
- metadata.gz: d33696a4d1585a8cf3d6a658110152129b216ce6a79dc55897643d84adc6a9abaabe9856f93f70418dc22bb49d6dfec20b160de6b9fa1ef04479a054852fba4e
7
- data.tar.gz: 72f603f10991754d0b474e92a8ef0a49f4a246cf5c6e937bcb9fdeb1be6a04e791cb69c285c1a424f1731e90929860b93adedf1012a211472893020fa808b4c1
6
+ metadata.gz: 707ff61984d894d3fd6f71b23195f066dd0a169debe16ec0b336c5ef63e6de2199ac3f0675ddbce657df264896ce0eae9539073f9e287cd0b4c447d2500fdee1
7
+ data.tar.gz: 107556d60cae849484ebe49ef3338b315a5a30e4b1be0d704af38c84857a42bd5d79a3c8cdf85476333978ff11b9312d330159b8245927b019e6baade386c357
@@ -6,24 +6,26 @@ module RulesAi
6
6
  # Your code goes here...
7
7
  class Rules_Set
8
8
  def self.hours_passed
9
- a = File.read("data/hours_passed/number/a_input.txt").strip.to_i
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
- starting_time = a
13
- ending_time = b
11
+ print "What is your starting time? >> "
12
+ starting_time = gets.chomp.strip.to_i # % 12
14
13
 
15
- hours_passed = ending_time - starting_time
14
+ print "What is your ending time? >> "
15
+ ending_time = gets.chomp.strip.to_i # %12
16
16
 
17
- second_starting_time = a + interval_a
18
- second_ending_time = second_starting_time + hours_passed
17
+ print "What is your working interval? >> "
18
+ time_interval = gets.chomp.to_i
19
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}"
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("data/tesla_multiplication/number/input.txt").strip.to_f
26
- rounds = File.read("data/tesla_multiplication/number/input.txt").strip.to_i
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
- number = File.read("data/autonomous_prompting/input/number.txt").strip.to_i
52
+ system("tts 'Time To Get Up!'")
51
53
 
52
- if number > 3
53
- number = 0
54
- end
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
- version = [
57
- "brush_teeth",
58
- "make_bed",
59
- "go_run_laps",
60
- "take_shower",
61
- ]
62
+ system("date > data/time/date.txt")
62
63
 
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
64
+ data = File.read("data/time/date.txt").split(" ")
68
65
 
69
- number = number + 1
66
+ current_day = "#{data[0]}"
70
67
 
71
- open("data/input/number.txt", "w") { |f|
72
- f.puts number
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.downcase
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
- #def self.write_poetry
97
- #end
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
@@ -145,6 +277,53 @@ module RulesAi
145
277
  puts "The hyper inches of the tessaract is #{hyper_inches} hyper distance."
146
278
  end
147
279
 
280
+ def self.write_renpy_script
281
+ require "rules_ai"
282
+
283
+ RulesAi::Rules_Set.write_poetry
284
+
285
+ poem = File.readlines("output/poetry/poem.txt")
286
+
287
+ first_line = poem[0].strip
288
+ second_line = poem[1].strip
289
+ third_line = poem[2].strip
290
+ fourth_line = poem[3].strip
291
+ fifth_line = poem[4].strip
292
+ sixth_line = poem[5].strip
293
+ seventh_line = poem[6].strip
294
+ eighth_line = poem[7].strip
295
+
296
+ bot_name = "Bianca"
297
+
298
+ ai_visual_novel = "define ai = Character('#{bot_name}')
299
+
300
+ label start:
301
+ scene bg black
302
+
303
+ ai '#{first_line}'
304
+
305
+ ai '#{second_line}'
306
+
307
+ ai '#{third_line}'
308
+
309
+ ai '#{fourth_line}'
310
+
311
+ ai '#{fifth_line}'
312
+
313
+ ai '#{sixth_line}'
314
+
315
+ ai '#{seventh_line}'
316
+
317
+ ai '#{eighth_line}'
318
+
319
+ return
320
+ "
321
+
322
+ open("output/renpy/script.rpy", "w") { |f|
323
+ f.puts ai_visual_novel
324
+ }
325
+ end
326
+
148
327
  def self.line
149
328
  puts '
150
329
  +----------------+
@@ -212,6 +391,40 @@ module RulesAi
212
391
  +----------------+
213
392
  '
214
393
  end
394
+
395
+ end
396
+
397
+ class RuleCalculation
398
+ def self.calculate_metarules
399
+ print "How many regular rules? >> "
400
+
401
+ r = gets.chomp.to_i
402
+
403
+ # For each amount of rules, meta rules is that many variations of rule combination.
404
+ meta_rule_count = r
405
+ meta_rule_size = r * r
406
+ meta_total = meta_rule_size * r
407
+
408
+ puts "For #{r} many regular rules, there are #{meta_rule_count} metarule variations of #{meta_rule_size} each. Totalling #{meta_total} lines of code."
409
+ end
410
+ end
411
+
412
+ # Rulesets generated by the algorithm itself.
413
+ class MetaRuleset
414
+
415
+ def self.meta_rule_one
416
+ RulesAi::Rule_Set.estimate_digest
417
+ RulesAi::Rule_Set.autonomous_prompting
418
+ RulesAi::Rule_Set.calculate_hyper
419
+ RulesAi::Rule_Set.mixed_13
420
+ RulesAi::Rule_Set.hours_passed
421
+ RulesAi::Rule_Set.tesla_multiplication
422
+ end
423
+
424
+ end
425
+
426
+ # Evolutionary Function that calls the rulesets.
427
+ class Evo_Function
215
428
  end
216
429
 
217
430
  class Chatbot
@@ -290,15 +503,25 @@ module RulesAi
290
503
  class New_Routine # Generates Meta rules
291
504
 
292
505
  def self.generate_ruleset
293
- ruleset = File.readlines("data/rules/input.txt")
506
+ ruleset = File.readlines("evo_data/rules/input.txt")
294
507
 
295
- scatter_rules = ruleset.shuffle
508
+ numbers = "0 1 2 3 4 5".split(" ").shuffle
296
509
 
297
- puts "Generated Rules:\n#{scatter_rules}"
510
+ one = numbers[0].to_i
511
+ two = numbers[1].to_i
512
+ tre = numbers[2].to_i
513
+ fro = numbers[3].to_i
514
+ fiv = numbers[4].to_i
515
+ six = numbers[5].to_i
298
516
 
299
517
  open("new_routine.rb", "w") { |f|
300
- puts 'require "rules_ai"'
301
- puts "\n#{scatter_rules}"
518
+ f.puts "require 'rules_ai'\n\n"
519
+ f.puts "RulesAi::Rule_Set.#{ruleset[one]}"
520
+ f.puts "RulesAi::Rule_Set.#{ruleset[two]}"
521
+ f.puts "RulesAi::Rule_Set.#{ruleset[tre]}"
522
+ f.puts "RulesAi::Rule_Set.#{ruleset[fro]}"
523
+ f.puts "RulesAi::Rule_Set.#{ruleset[fiv]}"
524
+ f.puts "RulesAi::Rule_Set.#{ruleset[six]}"
302
525
  }
303
526
  end
304
527
 
@@ -1,3 +1,3 @@
1
1
  module RulesAi
2
- VERSION = "0.3.0"
2
+ VERSION = "0.9.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.3.0
4
+ version: 0.9.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-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