baymax_JenifferDeVos 0.0.8
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.
- checksums.yaml +7 -0
- data/bin/baymax +32 -0
- data/lib/baymax.rb +122 -0
- metadata +38 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e1933fa25abdf1f221795f1a7d136edbcacb8dcabf33c967863c8b896fecc5d4
|
|
4
|
+
data.tar.gz: 292e5cfb01cdde114e7e9b520868744412cdc9557a1d1342aa948bc534a5a441
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 352b521f8df6c479080e68321f4057d3d8909e77a58a2cf7778317d0c521fc0cb13cd4160da71a35f7bbe92bcbddd6cc3e5c4609cc1853f94615f1f426f15989
|
|
7
|
+
data.tar.gz: 3abdb51f019d566739b6b06f4b8c5b29a5b7d5d45deb07ef1cc8815fde8b8b8a9ba217da53b42efd628cba045d124c404775ff718a8d47322a9a1ac9c72029fb
|
data/bin/baymax
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'baymax'
|
|
3
|
+
|
|
4
|
+
Baymax.introduce
|
|
5
|
+
|
|
6
|
+
loop do
|
|
7
|
+
puts "\n---------------------------------"
|
|
8
|
+
puts "COMMANDS: [s] Scan | [f] Fist Bump | [r] Recharge"
|
|
9
|
+
puts " [m] Mode | [p] Print Report | [q] Quit"
|
|
10
|
+
print "> "
|
|
11
|
+
|
|
12
|
+
input = gets.chomp.downcase
|
|
13
|
+
|
|
14
|
+
if input == "q"
|
|
15
|
+
puts "I am satisfied with your care."
|
|
16
|
+
break
|
|
17
|
+
elsif input == "s"
|
|
18
|
+
Baymax.scan
|
|
19
|
+
elsif input == "f"
|
|
20
|
+
Baymax.fist_bump
|
|
21
|
+
elsif input == "m"
|
|
22
|
+
Baymax.toggle_mode
|
|
23
|
+
elsif input == "r"
|
|
24
|
+
Baymax.recharge
|
|
25
|
+
elsif input == "p" # New Command!
|
|
26
|
+
Baymax.print_report
|
|
27
|
+
else
|
|
28
|
+
puts "I do not understand."
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Baymax.battery_check
|
|
32
|
+
end
|
data/lib/baymax.rb
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
class Baymax
|
|
2
|
+
# DATA
|
|
3
|
+
@@battery = 100
|
|
4
|
+
@@mode = "healthcare"
|
|
5
|
+
@@patient_name = nil
|
|
6
|
+
@@current_diagnosis = "None" # We need to track the last diagnosis
|
|
7
|
+
|
|
8
|
+
@@diagnoses = [
|
|
9
|
+
"a slight epidermal abrasion.",
|
|
10
|
+
"an allergic reaction to peanuts.",
|
|
11
|
+
"puberty.",
|
|
12
|
+
"mild dehydration.",
|
|
13
|
+
"acute thumb exhaustion.",
|
|
14
|
+
"a spider bite."
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
# VISUALS
|
|
18
|
+
def self.draw_face
|
|
19
|
+
puts ""
|
|
20
|
+
puts " ( ● — ● ) "
|
|
21
|
+
puts ""
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.speak(phrase)
|
|
25
|
+
if @@battery > 20
|
|
26
|
+
puts phrase
|
|
27
|
+
else
|
|
28
|
+
print "LOW BATTERY: "
|
|
29
|
+
phrase.each_char do |letter|
|
|
30
|
+
print letter
|
|
31
|
+
sleep(0.15)
|
|
32
|
+
end
|
|
33
|
+
puts ""
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.introduce
|
|
38
|
+
draw_face
|
|
39
|
+
if @@patient_name == nil
|
|
40
|
+
speak "Hello. I am Baymax."
|
|
41
|
+
speak "What is your name?"
|
|
42
|
+
print "> "
|
|
43
|
+
@@patient_name = gets.chomp
|
|
44
|
+
|
|
45
|
+
if @@patient_name.downcase == "hiro"
|
|
46
|
+
speak "Hiro... I will always be with you."
|
|
47
|
+
sleep(1)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
speak "Hello #{@@patient_name}."
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.recharge
|
|
54
|
+
puts "Returning to charging station..."
|
|
55
|
+
1.upto(5) { print "."; sleep(0.5) }
|
|
56
|
+
puts ""
|
|
57
|
+
@@battery = 100
|
|
58
|
+
speak "I am fully charged."
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.toggle_mode
|
|
62
|
+
if @@mode == "healthcare"
|
|
63
|
+
@@mode = "combat"
|
|
64
|
+
speak "COMBAT MODE ENGAGED."
|
|
65
|
+
else
|
|
66
|
+
@@mode = "healthcare"
|
|
67
|
+
speak "Healthcare protocol restored."
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.scan
|
|
72
|
+
speak "Scanning #{@@patient_name}..."
|
|
73
|
+
@@battery = @@battery - 10
|
|
74
|
+
0.upto(50) { |i| print "\r[#{'=' * (i/2)}] #{i*2}%"; sleep(0.02) }
|
|
75
|
+
puts ""
|
|
76
|
+
|
|
77
|
+
if @@mode == "combat"
|
|
78
|
+
speak "THREAT DETECTED."
|
|
79
|
+
@@current_diagnosis = "Threat detected"
|
|
80
|
+
else
|
|
81
|
+
# Save the diagnosis to the variable so we can print it later
|
|
82
|
+
@@current_diagnosis = @@diagnoses.sample
|
|
83
|
+
speak "Diagnosis: #{@@current_diagnosis}"
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def self.fist_bump
|
|
88
|
+
if @@mode == "combat"
|
|
89
|
+
speak "ROCKET FIST FIRED! BOOM!"
|
|
90
|
+
@@battery = @@battery - 25
|
|
91
|
+
else
|
|
92
|
+
speak "Fist bump!"
|
|
93
|
+
sleep(1)
|
|
94
|
+
speak "Ba-la-la-la-la..."
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.battery_check
|
|
99
|
+
if @@battery <= 20
|
|
100
|
+
speak "My... battery... is... low..."
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# --- NEW FEATURE: SAVE TO FILE ---
|
|
105
|
+
def self.print_report
|
|
106
|
+
speak "Printing medical report..."
|
|
107
|
+
sleep(1)
|
|
108
|
+
|
|
109
|
+
# This creates a file named 'medical_report.txt'
|
|
110
|
+
# "w" means 'write mode'
|
|
111
|
+
File.open("medical_report.txt", "w") do |file|
|
|
112
|
+
file.puts "--- SAN FRANSOKYO MEDICAL CENTER ---"
|
|
113
|
+
file.puts "Patient: #{@@patient_name}"
|
|
114
|
+
file.puts "Battery Level: #{@@battery}%"
|
|
115
|
+
file.puts "Last Diagnosis: #{@@current_diagnosis}"
|
|
116
|
+
file.puts "Care Provider: Baymax"
|
|
117
|
+
file.puts "------------------------------------"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
speak "Report saved to medical_report.txt."
|
|
121
|
+
end
|
|
122
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: baymax_JenifferDeVos
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.8
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Me
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
executables:
|
|
13
|
+
- baymax
|
|
14
|
+
extensions: []
|
|
15
|
+
extra_rdoc_files: []
|
|
16
|
+
files:
|
|
17
|
+
- bin/baymax
|
|
18
|
+
- lib/baymax.rb
|
|
19
|
+
licenses: []
|
|
20
|
+
metadata: {}
|
|
21
|
+
rdoc_options: []
|
|
22
|
+
require_paths:
|
|
23
|
+
- lib
|
|
24
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0'
|
|
29
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
requirements: []
|
|
35
|
+
rubygems_version: 3.6.9
|
|
36
|
+
specification_version: 4
|
|
37
|
+
summary: Baymax companion
|
|
38
|
+
test_files: []
|