rules_ai 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 93591c32e5f7c57a6bd1e39f4ebca36ce3d48606cc37f0e3c9cf12848ca667db
4
+ data.tar.gz: 49c37130fe39cd03bd227bf43131ddab72e310b22e339c14e9211fd5921026c7
5
+ SHA512:
6
+ metadata.gz: 491b31b35fdedfb6c74ec8c62758fa635be32d0c1f4738e7ffdd200411ec31911e02b7209859334da43ab59e0bb24da9d98b249de3e851ada2ed0368eb1a9b5e
7
+ data.tar.gz: 53ebcc9303f07a2d617e4827c32108e402ba98ef26d9e0875b458de4205a16259b743497935c8faf515a1f42859e5354738a1f7fb0824606a4908a92b6765c35
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at gitea@fake.local. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rules_ai.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Gitea
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # RulesAi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rules_ai`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rules_ai'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rules_ai
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rules_ai. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rules_ai/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
+
42
+ ## Code of Conduct
43
+
44
+ Everyone interacting in the RulesAi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rules_ai/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rules_ai"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,308 @@
1
+ require "rules_ai/version"
2
+
3
+ module RulesAi
4
+ class Error < StandardError; end
5
+
6
+ # Your code goes here...
7
+ class Rules_Set
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
11
+
12
+ starting_time = a
13
+ ending_time = b
14
+
15
+ hours_passed = ending_time - starting_time
16
+
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}"
22
+ end
23
+
24
+ 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
+
28
+ if input > 100
29
+ input = 0
30
+ end
31
+
32
+ number = input
33
+
34
+ # Infinity algorithm.
35
+ round_1 = number / 2 # 1
36
+ round_2 = round_1 / 2 # 2
37
+ round_3 = round_2 / 2 # 4
38
+ round_4 = round_3 / 2 # 8
39
+ round_5 = round_4 * 7
40
+ round_6 = round_5 * 5
41
+
42
+ new_number = round_6
43
+
44
+ open("data/number/input.txt", "w") { |f|
45
+ f.puts new_number
46
+ }
47
+ end
48
+
49
+ def self.autonomous_prompting
50
+ number = File.read("data/autonomous_prompting/input/number.txt").strip.to_i
51
+
52
+ if number > 3
53
+ number = 0
54
+ end
55
+
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
68
+
69
+ number = number + 1
70
+
71
+ open("data/input/number.txt", "w") { |f|
72
+ f.puts number
73
+ }
74
+ end
75
+
76
+ def self.greet_user
77
+ print "What is your name? >> "; name = gets.chomp
78
+
79
+ puts "Hello, #{name}."
80
+ end
81
+
82
+ ## Simple reciprocal cipher with randomized key.
83
+ def self.mixed_13
84
+ alph = File.read("keyset/alph.txt").strip
85
+ beta = File.read("keyset/beta.txt").strip
86
+
87
+ input = File.read("documents/plaintext.txt").to_s.upcase
88
+
89
+ ciphertext = input.tr alph, beta
90
+
91
+ open("documents/ciphertext.txt", "w") { |f|
92
+ f.puts ciphertext
93
+ }
94
+ end
95
+
96
+ #def self.write_poetry
97
+ #end
98
+
99
+ def self.estimate_digest
100
+ ream_size = 4
101
+
102
+ print "How many drawn pages do you have? >> "; page_count = gets.chomp.to_i
103
+
104
+ loop_count = page_count / ream_size
105
+ rounded_loop = loop_count.to_i + 1
106
+
107
+ total_pages = 0
108
+
109
+ actual_multiplier = 0
110
+
111
+ rounded_loop.times do
112
+ total_pages += ream_size
113
+
114
+ actual_multiplier += 1
115
+ end
116
+
117
+ extra_content = total_pages - page_count
118
+
119
+ cover_pages = 2
120
+
121
+ total_count = total_pages + cover_pages
122
+
123
+ puts "\nThe total pages are: #{total_pages} pages"
124
+ puts "The total pages for extra content: #{extra_content} pages."
125
+ puts "The total ream count is: #{actual_multiplier} reams of #{ream_size} pages."
126
+ puts "With front and back cover, the final bound book is #{total_count} pages."
127
+ end
128
+ end
129
+
130
+ ######################################################################
131
+ # Don't mess with these, these revolve around spatial relationships. #
132
+ ######################################################################
133
+ # class Static_Perimeters
134
+ #
135
+ # # The objects within the space.
136
+ # def positive_perimeters
137
+ # # Base radius of static objects.
138
+ # base_radius = 2500
139
+ #
140
+ # # Specfic multipliers for Earth index based objects.
141
+ # base_two = 2
142
+ # base_fro = 4
143
+ # base_six = 6
144
+ # base_eit = 8
145
+ #
146
+ # # Size of specific objects.
147
+ # size_of_planets = base_radius ** base_fro
148
+ # size_of_moons = base_radius ** base_two
149
+ # size_of_stars = base_radius ** base_six
150
+ # size_of_blackholes = base_radius ** base_eit
151
+ #
152
+ # # Total output sizes of specific objects.
153
+ # puts "The size of the planets is #{size_of_planets} radius."; sleep(3)
154
+ # puts "The size of the moons is #{size_of_moons} radius."; sleep(3)
155
+ # puts "The size of the stars is #{size_of_stars} radius."; sleep(3)
156
+ # puts "The size of a blackhole is #{size_of_blackholes} radius."; sleep(3)
157
+ # end
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
308
+ end
@@ -0,0 +1,3 @@
1
+ module RulesAi
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,23 @@
1
+ require_relative 'lib/rules_ai/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "rules_ai"
5
+ spec.version = RulesAi::VERSION
6
+ spec.authors = ["Gitea"]
7
+ spec.email = ["gitea@fake.local"]
8
+
9
+ spec.summary = %q{Ruby gem for providing rules based functionalities for non machine learning portions of AI.}
10
+ spec.description = %q{This is a collection of different rules based functions, from calculating how many hours have passed, tesla multiplication, autonomous prompting ( such as a morning promptor ), user greeting, randomized rot13 alphabets, and calculating the size of a comic digest.}
11
+ spec.homepage = "https://lwflouisa.github.io/Weaver-AI"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rules_ai
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gitea
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This is a collection of different rules based functions, from calculating
14
+ how many hours have passed, tesla multiplication, autonomous prompting ( such as
15
+ a morning promptor ), user greeting, randomized rot13 alphabets, and calculating
16
+ the size of a comic digest.
17
+ email:
18
+ - gitea@fake.local
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - ".gitignore"
24
+ - CODE_OF_CONDUCT.md
25
+ - Gemfile
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - bin/console
30
+ - bin/setup
31
+ - lib/rules_ai.rb
32
+ - lib/rules_ai/version.rb
33
+ - rules_ai.gemspec
34
+ homepage: https://lwflouisa.github.io/Weaver-AI
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.3.0
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubygems_version: 3.1.2
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Ruby gem for providing rules based functionalities for non machine learning
57
+ portions of AI.
58
+ test_files: []