Advertisement
thathamr

Untitled

Apr 7th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.05 KB | None | 0 0
  1. ## A PROJECT BY RAM THATHAM
  2. mouse = rand(100) ##random ints for days
  3. keyboard = rand(200)
  4. monitor = rand(300)
  5. rofl = 0 ##python flashbacks -- while loops for days
  6.  
  7.  
  8.  
  9. if monitor > 170
  10. puts "Monitor powering up (RAM THATHAM INDUSTRIES)"
  11. puts "."*40
  12. else #python flashback if statement
  13. puts "Monitor error..."
  14. abort##my greatest achievement: how to stop a prohgram
  15. end
  16.  
  17. puts "Power level nominal: powering RT-8819 Supercomputer..."
  18.  
  19. def diagnostic(peripheral, tool) #tool is used as a place holder
  20. if peripheral > 56 #arbitrary number to continue
  21. puts "SYSTEMS ARE GO"
  22. else
  23. puts "#{tool} has failed ... system shutting down"
  24. abort #turns off if the system is off
  25. end
  26. end
  27.  
  28. puts mouse , "mouse ^" #print numbers for my sake
  29. puts keyboard, "keyboard ^"
  30.  
  31. diagnostic(mouse,"Mouse" ) #calling up this function
  32. diagnostic(keyboard,"Keyboard")
  33.  
  34.  
  35. puts "Enter your username:" #username- anything you want
  36. username = gets.chomp()
  37. puts "Please enter your authentication code:"
  38. puts "i Hope you Enjoy your Long stay in this comPuter Master tErminal"
  39. password = gets.chomp() ##READ THE CAPITALIZED LETTERS
  40.  
  41. if password == "HELP ME" #looks like you read it
  42. puts "PLAY THIS COMPUTER IF YOU WANT TO HELP ME"
  43. else
  44. puts "Your password is unknown for this military terminal"
  45. puts "Eh, IDC just go ahead with this." #ram gives up
  46. end
  47.  
  48. puts "Welcome to the real deal #{username} , I hope you'll use the complete suite of tools at your disposal."
  49. #welcome to the program !
  50.  
  51. require "./soitbegins.rb" ##BOOTUP SEQUENCE
  52.  
  53. rofl = 0 #refrence to my python stores!, used in the while loop
  54.  
  55. while rofl == 0
  56. puts """
  57. 1.Comprehensive Ruby in Twenty Minutes (help).exe
  58. 2.Calculator.exe
  59. 3.Shutdown
  60. 4. Copy and paste machine
  61. """
  62.  
  63. userinput = gets.chomp()
  64.  
  65. if userinput == "1"
  66. require "./help.rb" ##calls up this file
  67. end
  68.  
  69. if userinput == "2"
  70. require "./calc.rb"
  71. end
  72.  
  73. if userinput == "3"
  74. puts "System log off and shut down"
  75. rofl = 1 #shift integer to end the program
  76. abort
  77. end
  78.  
  79. if userinput == "4"
  80. puts "The copy machine: simply put in ruby and two file names into the terminal to copy and paste one to the other"
  81. puts "For your convenience ramble.txt and poetry.txt have been created as a benchmark"
  82. end
  83. end
  84.  
  85.  
  86. print "Thanks for your question young one: heres the answer"
  87.  
  88.  
  89. puts """
  90. Welcome to Uncle's ram Ruby in 20 minutes:
  91. https://www.ruby-lang.org/en/documentation/quickstart/
  92. """
  93.  
  94. puts """
  95. Chose a operation:
  96. 1.Addition
  97. 2. Subtraction
  98. 3. Multiplication
  99. 4. Division
  100. """
  101.  
  102. command = gets.chomp()
  103.  
  104. if command == "1"
  105. puts "Add numbers:"
  106. alpha = gets.chomp ##RAW INPUT
  107. alpha = alpha.to_i ##CONVERT INPUT INTO INTEGERS
  108. beta = gets.chomp
  109. beta = beta.to_i
  110. print "#{alpha} + #{beta} = " #variables put in
  111. puts alpha + beta
  112. end
  113.  
  114. if command == "2"
  115. puts "choose a first and second number"
  116. alpha = gets.chomp ##RAW INPUT
  117. alpha = alpha.to_i ##CONVERT INPUT INTO INTEGERS
  118. beta = gets.chomp
  119. beta = beta.to_i
  120. print "#{alpha} - #{beta} = "
  121. puts alpha - beta
  122. end
  123.  
  124. if command == "3"
  125. puts "choose a first and second number"
  126. alpha = gets.chomp
  127. alpha = alpha.to_i
  128. beta = gets.chomp
  129. beta = beta.to_i
  130. print "#{alpha} x #{beta} = "
  131. puts alpha * beta
  132. end
  133.  
  134. if command == "4"
  135. puts "choose a first and second number"
  136. alpha = gets.chomp
  137. alpha = alpha.to_i
  138. beta = gets.chomp
  139. beta = beta.to_i
  140. print "#{alpha} / #{beta} = "
  141. puts alpha / beta
  142. end
  143.  
  144. ##COPY PASTE MACHINE USING ARGV INPUTS AND FILE READERS
  145. from_file, to_file = ARGV
  146.  
  147. puts "Copying from #{from_file} to #{to_file}"
  148.  
  149. # we could do these two on one line, how?
  150. in_file = open(from_file)
  151. indata = in_file.read
  152.  
  153. puts "The input file is #{indata.length} bytes long"
  154.  
  155. puts "Does the output file exist? #{File.exist?(to_file)}"
  156. puts "Ready, hit RETURN to continue, CTRL-C to abort."
  157. $stdin.gets
  158.  
  159. out_file = open(to_file, 'w')
  160. out_file.write(indata)
  161.  
  162. puts "Alright, all done."
  163.  
  164. out_file.close
  165. in_file.close
  166.  
  167. Maybe everbody in the whole damn world is scared of each other. - Mice and Men
  168. Life is to be lived, not controlled; and humanity is won by continuing to play in face of certain defeat. - Invisible Man
  169. Terror made me cruel - Wuthering Heights
  170. It was a bright cold day in April, and the clocks were striking thirteen. - 1984
  171. It sounds plausible enough tonight, but wait until tomorrow. Wait for the common sense of the morning.- The Time Machine
  172. It's much better to do good in a way that no one knows anything about it. - Anna Karina
  173. Life appears to me too short to be spent in nursing animosity or registering wrongs. - Jane Eyre
  174. You forget what you want to remember, and you remember what you want to forget. - The Road
  175. History, Stephen said, is a nightmare from which I am trying to awake. - Ulysses
  176.  
  177.  
  178. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
  179. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
  180. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
  181. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
  182. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
  183. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
  184. MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE MY NAME IS OF NO CONSQUENCE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement