class Rustein::Zoidstein
Public Class Methods
assemble_animator()
click to toggle source
Assembles a specific Dr. Zoidstein
animation.
# File lib/Rustein.rb, line 40 def self.assemble_animator print "Sequencer will ask you questions related assembling animator...." print "Assemble which walk animation? >> "; animation = gets.chomp open("zoidstein_#{walk_direction}.py", "w") { |f| f.puts "from hr_little_api.robot import Robot" f.puts "from hr_little_api.robot import Animation" f.puts "\nrobot = Robot()\n" f.puts "if not robot.connect()" f.puts " print('Trouble connecting...')\n" f.puts " exit(-1)" f.puts "\n### Your code below here. ###" f.puts "robot.animate_#{animation}(})\n" f.puts "robot.disconnect()" } end
assemble_sensors()
click to toggle source
Sequence voltage sensors.
# File lib/Rustein.rb, line 59 def self.assemble_sensors print "Sequencer can take care of the sensors for you..." open("zoidstein_voltage.py", "w") { |f| f.puts "from hr_little_api.robot import Robot" f.puts "from hr_little_api.robot import Animation" f.puts "\nrobot = Robot()\n" f.puts "if not robot.connect()" f.puts " print('Trouble connecting...')\n" f.puts " exit(-1)" f.puts "\n### Your code below here. ###" f.puts "print(robot.voltage)\n" f.puts "robot.disconnect()" } end
assemble_walker()
click to toggle source
Assembles a Dr. Zoidstein
walking direction.
# File lib/Rustein.rb, line 20 def self.assemble_walker print "Sequencer will ask you questions related to assembling walker..." print "Assemble which walk direction? >> "; walk_direction = gets.chomp print "Walk how many steps? >> "; steps_taken = gets.chomp open("zoidstein_#{walk_direction}.py", "w") { |f| f.puts "from hr_little_api.robot import Robot" f.puts "from hr_little_api.robot import Animation" f.puts "\nrobot = Robot()\n" f.puts "if not robot.connect()" f.puts " print('Trouble connecting...')\n" f.puts " exit(-1)" f.puts "\n### Your code below here. ###" f.puts "robot.walk_#{walk_direction}(steps=#{steps_taken})\n" f.puts "robot.disconnect()" } end
duck_duck_stein()
click to toggle source
Teaches Dr. Zoidstein
reasoning with words.
# File lib/Rustein.rb, line 76 def self.duck_duck_stein require "duck_duck_go" print "What word do you wish to teach Zoidstein? >> "; teach_einstein = gets.chomp ddg = DuckDuckGo.new zci = ddg.zeroclickinfo(teach_einstein) word = zci.heading definition = zci.abstract_text topics = zci.related_topics["_"][0].text open("zoidstein_#{word}.py", "w") { |f| f.puts "from hr_little_api.robot import Robot" f.puts "from hr_little_api.robot import Animation" f.puts "\nrobot = Robot()\n" f.puts "if not robot.connect()" f.puts " print('Trouble connecting...')\n" f.puts " exit(-1)" f.puts "\n### Your code below here. ###" f.puts 'print("For the word #{word}, the definition is: #{definition}. The related topics is: #{topics}")\n' f.puts "robot.disconnect()" } end
rustein_cloner()
click to toggle source
Gives the exact date you cloned the repository.
# File lib/Rustein.rb, line 9 def self.rustein_cloner time = Time.new date = time.inspect puts "#{date}\n" system("git clone https://github.com/jdddog/hr_little_api") end
write_poetry()
click to toggle source
Zoidstein
orates my poetry.
# File lib/Rustein.rb, line 102 def self.write_poetry # Read in files. poem01 = File.readlines('poetry/allistodust.txt'); poem02 = File.readlines('poetry/alongforestgreen.txt') poem03 = File.readlines('poetry/anarchojean.txt'); poem04 = File.readlines('poetry/atmydoor.txt') poem05 = File.readlines('poetry/badinbed.txt'); poem06 = File.readlines('poetry/beingmyself.txt') poem07 = File.readlines('poetry/castleofthesea.txt'); poem08 = File.readlines('poetry/coping.txt') poem09 = File.readlines('poetry/devilgoodcompany.txt'); poem10 = File.readlines('poetry/dianacyberneticdreams.txt') poem11 = File.readlines('poetry/dogwithredcat.txt'); poem12 = File.readlines('poetry/dontfallback.txt') poem13 = File.readlines('poetry/droptheideologies.txt'); poem14 = File.readlines('poetry/flalaikurose.txt') poem15 = File.readlines('poetry/girlnothingbutadream.txt'); poem16 = File.readlines('poetry/goodopticsinthetropics.txt') poem17 = File.readlines('poetry/haywiremeltingdown.txt'); poem18 = File.readlines('poetry/inthislandoftennessee.txt') poem19 = File.readlines('poetry/invisibleminorities.txt'); poem20 = File.readlines('poetry/juicyneonsteak.txt') poem21 = File.readlines('poetry/lackofcommunication.txt'); poem22 = File.readlines('poetry/laimencoformoonlight.txt') poem23 = File.readlines('poetry/leadwithfeelingsnotthemind.txt'); poem24 = File.readlines('poetry/littleants.txt') poem25 = File.readlines('poetry/lonelypetalswither.txt'); poem26 = File.readlines('poetry/marrowlust.txt') poem27 = File.readlines('poetry/mmesmiled.txt'); poem28 = File.readlines('poetry/mmujinrose.txt') poem29 = File.readlines('poetry/momentarysilence.txt'); poem30 = File.readlines('poetry/neveradrollmoment.txt') poem31 = File.readlines('poetry/nevermorecrackingknuckles.txt'); poem32 = File.readlines('poetry/newlaconia.txt') poem33 = File.readlines('poetry/nightlystatues.txt'); poem34 = File.readlines('poetry/policestate.txt') poem35 = File.readlines('poetry/resigationpowder.txt'); poem36 = File.readlines('poetry/sentimentality.txt') poem37 = File.readlines('poetry/shadowonthewall.txt'); poem38 = File.readlines('poetry/shotgungirl.txt') poem39 = File.readlines('poetry/skeletonsfinallaugh.txt'); poem40 = File.readlines('poetry/skyslumbering.txt') poem41 = File.readlines('poetry/sliceoflife.txt'); poem42 = File.readlines('poetry/spidersandtheghost.txt') poem43 = File.readlines('poetry/superyacht.txt'); poem44 = File.readlines('poetry/thegirlwithrosecheeks.txt') poem45 = File.readlines('poetry/theleftarentjellybeans.txt'); poem46 = File.readlines('poetry/thetimeshedied.txt') poem47 = File.readlines('poetry/turntodust.txt'); poem48 = File.readlines('poetry/undertheweepingwillowtree.txt') poem49 = File.readlines('poetry/unravelingfriendship.txt'); poem50 = File.readlines('poetry/vivalacyborgia.txt') poem51 = File.readlines('poetry/waitinginthewall.txt'); poem52 = File.readlines('poetry/whattheysayofrome.txt') poem53 = File.readlines('poetry/windmillsong.txt'); poem54 = File.readlines('poetry/winonaleeredneckbeyondrepair.txt') poem55 = File.readlines('poetry/wiromantic.txt'); poem56 = File.readlines('poetry/yourmerlotourclimate.txt') poem_shelf = [ poem01, poem02, poem03, poem04, poem05, poem06, poem07, poem08, poem09, poem10, poem11, poem12, poem13, poem14, poem15, poem16, poem17, poem18, poem19, poem20, poem21, poem22, poem23, poem24, poem25, poem26, poem27, poem28, poem29, poem30, poem31, poem32, poem33, poem34, poem35, poem36, poem37, poem38, poem39, poem40, poem41, poem42, poem43, poem44, poem45, poem46, poem47, poem48, poem49, poem50, poem51, poem52, poem53, poem54, poem55, poem56, ] active_poem01 = poem_shelf.sample; active_poem02 = poem_shelf.sample; active_poem03 = poem_shelf.sample; active_poem04 = poem_shelf.sample; active_poem05 = poem_shelf.sample; active_poem06 = poem_shelf.sample; active_poem07 = poem_shelf.sample; active_poem08 = poem_shelf.sample; active_poem09 = poem_shelf.sample; active_poem10 = poem_shelf.sample; active_poem11 = poem_shelf.sample; active_poem12 = poem_shelf.sample; time = Time.new line_01 = active_poem01.sample line_02 = active_poem02.sample line_03 = active_poem03.sample line_04 = active_poem04.sample line_05 = active_poem05.sample line_06 = active_poem06.sample line_07 = active_poem07.sample line_08 = active_poem08.sample line_09 = active_poem09.sample line_10 = active_poem10.sample line_11 = active_poem11.sample line_12 = active_poem12.sample open("zoidstein_poetry.py", "w") { |f| f.puts "from hr_little_api.robot import Robot" f.puts "from hr_little_api.robot import Animation" f.puts "\nrobot = Robot()\n" f.puts "if not robot.connect()" f.puts " print('Trouble connecting...')\n" f.puts " exit(-1)" f.puts "\n### Your code below here. ###" f.puts 'robot.say("#{line_01} #{line_02} #{line_03} #{line_04} #{line_05} #{line_06} #{line_07} #{line_08} #{line_09} #{line_10} #{line_11} #{line_12}")\n' f.puts "robot.disconnect()" } end