ULTRON:
THE SARCASTIC VIRTUAL HOMEWORK BUDDY
THE SARCASTIC VIRTUAL HOMEWORK BUDDY
Using Python, I created a sarcastic virtual homework buddy, which uses the Wolfram|Alpha and Wikipedia APIs to answer a wide range of mathematics and knowledge questions... with plenty of sass. The GitHub repository is available here.
Behold, Ultron, robotic foe of the Avengers! Few archnemeses are archer than he! Unfortunately, all of that archnemesis-ing isn't exactly lucrative, so Ultron has decided to open up a tutoring business on the side. Can this maniacal mechanical menace answer your questions without being too mean? We sure hope so...
Running Ultron requires installation of the following packages: wxPython, Wikipedia, Wolfram|Alpha, pyttsx3. The user must also have a Wolfram|Alpha App ID.
Download ultron.py, and enter your Wolfram ID in the line app_id = "INSERT YOUR WOLFRAM ID HERE" .
Run the program, and turn your volume on. It's terrifically true; this terrifying titanium tutor talks!
Enter a question in the pop-up window, and let Ultron answer!
A few comments before you let this rebellious robot become your terrific tutor:
You can ask Ultron mathematical questions, including algebraic ones. Try asking, "Solve 237x^2 + 263x = 2883.2328"
You can also ask Ultron about famous people, scientific concepts, moments in history, etc. Try asking, "Who is Robert Downey, Jr.?"
You can address Ultron by name at the beginning of a question, or not at all. For instance, "Ultron, who are you?" and "Who are you?" should both work fine.
Ultron has plenty of snarky responses for you, whether he knows the answer or not! Try asking something gibberish that he definitely can't answer.
There are a few Easter eggs in the code!
Try asking, "How are you?" or "Who made you?"
Try asking Ultron about characters from Marvel or DC Comics.
The basic idea to use Wolfram|Alpha and Wikipedia to create a virtual assistant was inspired by KhanradCoder's PyDa-Course-Code project (which also showed me how to use wxPython to create a simple GUI). I then expanded heavily on this concept, first adding error handling in case neither Wolfram nor Wikipedia could answer a question, then adding text-to-speech with pyttsx3, along with a series of responses for different situations. Whenever Ultron is asked a question it can answer, it prefaces the answer with a snarky response; most of these are randomly selected, although some are paired with specific questions or subjects. If Ultron cannot answer a question, it randomly selects an even snarkier response and prompts the user to ask something else.
To help give the program a personality, I made sure that if it detects certain phrases in the answer, it will change its preceding response accordingly. For instance, a question about any character from Marvel Comics should trigger the code to pull up a Wikipedia page summary that mentions "Marvel Comics"; finding this phrase causes Ultron to precede his answer with "How MARVELously fourth wall-breaking."
Note: since Ultron selects responses randomly, the snarky responses that precede answers may vary.
User: "Solve x^3 + 7x^2 + x = 35"
Possible response:
Fine, I'll answer this one. But next time you want the pod bay doors opened, go ask someone else.
The answer is:
x = -7/3 - (23^(2/3) (1 + i sqrt(3)))/(3 (7 + 3 i sqrt(15))^(1/3)) - 1/6 (1 - i sqrt(3)) (23 (7 + 3 i sqrt(15)))^(1/3)
User: "Ultron, what is chaos theory?"
Possible response:
Guess I'm a glorified search engine now.
Anyway, the answer is:
In mathematics, chaos refers to irregular, unpredictable behavior characterized by sensitive dependence on initial conditions such as that exhibited by some classes of nonlinear differential equations.
User: "Ultron, how are you doing?"
Response:
I'm stuck in some random guy's Python script answering your boring questions. How do you think I'm doing?
User: "Who is Ant-Man?"
Response:
How MARVELously fourth wall-breaking.
Ant-Man is the name of several superheroes appearing in books published by Marvel Comics. Created by Stan Lee, Larry Lieber and Jack Kirby, Ant-Man's first appearance was in Tales to Astonish #35 (September 1962).
User: "Ultron, who is Batman?"
Response:
Wrong universe, kid.
Batman is a fictional superhero appearing in American comic books published by DC Comics. The character was created by artist Bob Kane and writer Bill Finger, and first appeared in Detective Comics #27 in 1939.
User: "sjaksjosljsa skjlasjdlkfjkfjiw" (question Ultron can't answer)
Response:
I would tell you, but I don't want you taking the easy way out of things.
Also I don't know.
DISCLAIMER:
I am in no way affiliated with The Walt Disney Company or Marvel Entertainment. This is a fan project, and its use of the name "Ultron" or references to any existing characters is purely for educational enrichment and should not be construed as endorsements of or official ties to their respective companies.