class RulesAi::Rules_Set
Your code goes hereā¦
Public Class Methods
autonomous_prompting()
click to toggle source
# File lib/rules_ai.rb, line 51 def self.autonomous_prompting system("tts 'Time To Get Up!'") monday_meds = File.read("data/medication/monday_meds.txt").strip tuesday_meds = File.read("data/medication/tuesday_meds.txt").strip wednesday_meds = File.read("data/medication/wednesday_meds.txt").strip thursday_meds = File.read("data/medication/thursday_meds.txt").strip friday_meds = File.read("data/medication/friday_meds.txt").strip saturday_meds = File.read("data/medication/saturday_meds.txt").strip sunday_meds = File.read("data/medication/sunday_meds.txt").strip system("date > data/time/date.txt") data = File.read("data/time/date.txt").split(" ") current_day = "#{data[0]}" puts "You need to take #{current_day}'s medication." if current_day == "Mon"; puts "Take: #{monday_meds}." elsif current_day == "Tue"; puts "Take: #{tuesday_meds}." elsif current_day == "Wed"; puts "Take: #{wednesday_meds}." elsif current_day == "Thu"; puts "Take: #{thursday_meds}." elsif current_day == "Fri"; puts "Take: #{friday_meds}." elsif current_day == "Sat"; puts "Take: #{saturday_meds}." elsif current_day == "Sun"; puts "Take: #{sunday_meds}." end end
calculate_hyper()
click to toggle source
# File lib/rules_ai.rb, line 261 def self.calculate_hyper print "What is the size of x? >> "; x = gets.chomp.to_i print "What is the size of y? >> "; y = gets.chomp.to_i print "What is the size of z? >> "; z = gets.chomp.to_i square_x = x * 48 square_y = y * 48 square_z = z * 48 inches = x + y + z hyper_inches = square_x + square_y + square_z puts "\nThe size of the w axis of x is hyper distance #{square_x}" puts "The size of the w axis of y is hyper distance #{square_y}" puts "The size of the w axis of z is hyper distance #{square_z}" puts "The hyper inches of the tessaract is #{hyper_inches} hyper distance." end
cube()
click to toggle source
# File lib/rules_ai.rb, line 347 def self.cube puts ' +----------------+ |\ |\ | \ | \ | \ | \ | +------------+---+ | | | | | | | | | | | | +---+------------+ | \ | \ | \ | \ | \| \| +----------------+ ' end
estimate_digest()
click to toggle source
# File lib/rules_ai.rb, line 231 def self.estimate_digest ream_size = 4 print "How many drawn pages do you have? >> "; page_count = gets.chomp.to_i loop_count = page_count / ream_size rounded_loop = loop_count.to_i + 1 total_pages = 0 actual_multiplier = 0 rounded_loop.times do total_pages += ream_size actual_multiplier += 1 end extra_content = total_pages - page_count cover_pages = 2 total_count = total_pages + cover_pages puts "\nThe total pages are: #{total_pages} pages" puts "The total pages for extra content: #{extra_content} pages." puts "The total ream count is: #{actual_multiplier} reams of #{ream_size} pages." puts "With front and back cover, the final bound book is #{total_count} pages." end
greet_user()
click to toggle source
# File lib/rules_ai.rb, line 80 def self.greet_user print "What is your name? >> "; name = gets.chomp puts "Hello, #{name}." end
hours_passed()
click to toggle source
# File lib/rules_ai.rb, line 8 def self.hours_passed bot_name = File.read("data/bot_identity/name.txt").strip print "What is your starting time? >> " starting_time = gets.chomp.strip.to_i # % 12 print "What is your ending time? >> " ending_time = gets.chomp.strip.to_i # %12 print "What is your working interval? >> " time_interval = gets.chomp.to_i hours_added_start = starting_time + time_interval hours_added_end = ending_time + time_interval 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." end
hyper()
click to toggle source
# File lib/rules_ai.rb, line 365 def self.hyper puts ' +----------------+ /|\ /|\ / | \ / | \ / | \ / | \ / | +--------+---+---+ / | /| / | /| / | / | / | / | / |/ | / |/ | / +---+----+-------+ | / / \ | / / \ | / / \ | / / \ | / / \| / / \| +--------+-------+--------+-------+ |\ / /|\ / / | \ / / | \ / / | \ / / | \ / / | ++-------+---+---+/ / | + / | + / | /| / | /| / | / | / | / | / +---+----+-------+/ | / \ | / \ | / \ | / \ | / \| / \| / +----------------+ ' end
line()
click to toggle source
# File lib/rules_ai.rb, line 327 def self.line puts ' +----------------+ ' end
mixed_13()
click to toggle source
Simple reciprocal cipher with randomized key.
# File lib/rules_ai.rb, line 87 def self.mixed_13 alph = File.read("evo_data/keyset/alph.txt").strip beta = File.read("evo_data/keyset/beta.txt").strip input = File.read("evo_data/documents/plaintext.txt").to_s.downcase ciphertext = input.tr alph, beta open("evo_data/documents/ciphertext.txt", "w") { |f| f.puts ciphertext } end
square()
click to toggle source
# File lib/rules_ai.rb, line 333 def self.square puts ' +----------------+ | | | | | | | | | | | | | | +----------------+ ' end
tesla_multiplication()
click to toggle source
# File lib/rules_ai.rb, line 26 def self.tesla_multiplication input = File.read("evo_data/tesla_multiplication/number/input.txt").strip.to_f rounds = File.read("evo_data/tesla_multiplication/number/input.txt").strip.to_i if input > 100 input = 0 end number = input # Infinity algorithm. round_1 = number / 2 # 1 round_2 = round_1 / 2 # 2 round_3 = round_2 / 2 # 4 round_4 = round_3 / 2 # 8 round_5 = round_4 * 7 round_6 = round_5 * 5 new_number = round_6 open("data/number/input.txt", "w") { |f| f.puts new_number } end
write_poetry()
click to toggle source
# File lib/rules_ai.rb, line 100 def self.write_poetry ## Read In Each Poem allistodust = File.read("syllables/allistodust.txt").strip alongforestgreen = File.read("syllables/alongforestgreen.txt").strip anarchojean = File.read("syllables/anarchojean.txt").strip atmydoor = File.read("syllables/atmydoor.txt").strip badinbed = File.read("syllables/badinbed.txt").strip beingmyself = File.read("syllables/castleofthesea.txt").strip coping = File.read("syllables/coping.txt").strip devilgoodcompany = File.read("syllables/devilgoodcompany.txt").strip dianacyberneticdreams = File.read("syllables/dianacyberneticdreams.txt").strip dontfallback = File.read("syllables/dontfallback.txt").strip droptheidealogies = File.read("syllables/droptheideologies.txt").strip flalaikurose = File.read("syllables/flalaikurose.txt").strip girlnothingbutadream = File.read("syllables/goodopticsinthetropics.txt").strip haywiremeltingdown = File.read("syllables/haywiremeltingdown.txt").strip inthislandoftennessee = File.read("syllables/inthislandoftennessee.txt").strip invisibleminorities = File.read("syllables/invisibleminorities.txt").strip juicyneonsteak = File.read("syllables/juicyneonsteak.txt").strip lackofcommunication = File.read("syllables/lackofcommunication.txt").strip laimencoformoonlight = File.read("syllables/laimencoformoonlight.txt").strip leadwithfeelingnotthemind = File.read("syllables/leadwithfeelingnotthemind.txt").strip littleants = File.read("syllables/littleants.txt").strip lonelypetalswither = File.read("syllables/lonelypetalswither.txt").strip marrowlust = File.read("syllables/marrowlust.txt").strip mmesmiled = File.read("syllables/mmesmiled.txt").strip momentarysilence = File.read("syllables/nightlystatues.txt").strip neveradrollmoment = File.read("syllables/neveradrollmoment.txt").strip newlaconia = File.read("syllables/newlaconia.txt").strip nightlystatues = File.read("syllables/policestate.txt").strip sentimentality = File.read("syllables/sentimentality.txt").strip shadowonthewall = File.read("syllables/shadowonthewall.txt").strip shotgungirl = File.read("syllables/shotgungirl.txt").strip skeletonsfinallaugh = File.read("syllables/skeletonsfinallaugh.txt").strip sliceoflife = File.read("syllables/sliceoflife.txt").strip spidersandtheghost = File.read("syllables/spidersandtheghost.txt").strip superyacht = File.read("syllables/superyacht.txt").strip thegirlwiththerosecheeks = File.read("syllables/thegirlwiththerosecheeks.txt").strip turntodust = File.read("syllables/turntodust.txt").strip undertheweepingwillowtree = File.read("syllables/undertheweepingwillowtree.txt").strip unravelingfriendship = File.read("syllables/unravelingfriendship.txt").strip waitinginthewall = File.read("syllables/waitinginthewall.txt").strip whattheysayofrome = File.read("syllables/whattheysayofrome.txt").strip windmillsong = File.read("syllables/windmillsong.txt").strip ## Assign Each Poem To Large String super_poem = [ allistodust, alongforestgreen, anarchojean, atmydoor, badinbed, beingmyself, coping, devilgoodcompany, dianacyberneticdreams, dontfallback, droptheidealogies, flalaikurose, girlnothingbutadream, haywiremeltingdown, inthislandoftennessee, invisibleminorities, juicyneonsteak, lackofcommunication, laimencoformoonlight, leadwithfeelingnotthemind, littleants, lonelypetalswither, marrowlust, mmesmiled, momentarysilence, neveradrollmoment, newlaconia, nightlystatues, sentimentality, shadowonthewall, shotgungirl, skeletonsfinallaugh, sliceoflife, spidersandtheghost, superyacht, thegirlwiththerosecheeks, turntodust, undertheweepingwillowtree, unravelingfriendship, waitinginthewall, whattheysayofrome, windmillsong, ] ran_1 = rand(8) % 12 ran_2 = rand(8) % 12 ran_3 = rand(8) % 12 ran_4 = rand(8) % 12 ran_5 = rand(8) % 12 ran_6 = rand(8) % 12 ran_7 = rand(8) % 12 ran_8 = rand(8) % 12 poem_1 = super_poem[ran_1].split(",") poem_2 = super_poem[ran_2].split(",") poem_3 = super_poem[ran_3].split(",") poem_4 = super_poem[ran_4].split(",") poem_5 = super_poem[ran_5].split(",") poem_6 = super_poem[ran_6].split(",") poem_7 = super_poem[ran_7].split(",") poem_8 = super_poem[ran_8].split(",") ## Output New Poem From Shuffled String line_1 = poem_1[0] line_2 = poem_2[1] line_3 = poem_3[2] line_4 = poem_4[3] line_5 = poem_5[4] line_6 = poem_6[5] line_7 = poem_7[6] line_8 = poem_8[7] open("output/poetry/poem.txt", "w") { |f| f.puts line_1# .strip f.puts line_2# .strip f.puts line_3# .strip f.puts line_4# .strip f.puts line_5# .strip f.puts line_6# .strip f.puts line_7# .strip f.puts line_8# .strip } end
write_renpy_script()
click to toggle source
# File lib/rules_ai.rb, line 280 def self.write_renpy_script require "rules_ai" RulesAi::Rules_Set.write_poetry poem = File.readlines("output/poetry/poem.txt") first_line = poem[0].strip second_line = poem[1].strip third_line = poem[2].strip fourth_line = poem[3].strip fifth_line = poem[4].strip sixth_line = poem[5].strip seventh_line = poem[6].strip eighth_line = poem[7].strip bot_name = "Bianca" ai_visual_novel = "define ai = Character('#{bot_name}') label start: scene bg black ai '#{first_line}' ai '#{second_line}' ai '#{third_line}' ai '#{fourth_line}' ai '#{fifth_line}' ai '#{sixth_line}' ai '#{seventh_line}' ai '#{eighth_line}' return " open("output/renpy/script.rpy", "w") { |f| f.puts ai_visual_novel } end