You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
4.9 KiB
JavaScript
91 lines
4.9 KiB
JavaScript
var responses = {
|
|
"zombie": {
|
|
screen: "Definition: A child process whose parent has been terminated, causing the memory and resources that were allocated to it to be removed so they can be used for ongoing processes, but whose exit status hasn't been read.",
|
|
paper: "Which past event still takes up space in your mind?",
|
|
},
|
|
"kill": {
|
|
screen: "Definition: Sending a signal to end an ongoing process, using its name instead of its number.",
|
|
paper: "Define a negative thought and ask it to stop.",
|
|
},
|
|
"server": {
|
|
screen: "Definition: A computer providing a service via network, managing resources, processing requests, and running services to meet the needs of its clients, i.e. other computers.",
|
|
paper: "Give what someone asks for only when they use the right words.",
|
|
},
|
|
"ghost": {
|
|
screen: "Definition: An image of a system that prevents system files from missing and helps data recovery.",
|
|
paper: "Give something that represents you to someone you care about.",
|
|
},
|
|
"parent": {
|
|
screen: "Definition: When a process creates a new process it is called a parent. For example, if you were to start a process and then this would divide into two (like a fork), the initial process would be the parent and the subsequent the child.",
|
|
paper: "Formulate an idea and let it spread. Congratulations, you are a parent now.",
|
|
},
|
|
"interrupt": {
|
|
screen: "Definition: An event that changes the order in which instructions for a process are executed, altering the flow of a program.",
|
|
paper: "Distract someone for a second.",
|
|
},
|
|
"client": {
|
|
screen: "Definition: The device or program that requests a service provided by the server.",
|
|
paper: "Go to the kitchen and ask for food.",
|
|
},
|
|
"nice": {
|
|
screen: "Alter the priority of a process by invoking the command. The lower the niceness, the higher the priority.",
|
|
paper: "Next time you're asked to do something, do something more important first.",
|
|
},
|
|
"echo": {
|
|
screen: "Definition: Display lines of text, just to see the terminal talking back to you, or to output the status of an ongoing process.",
|
|
paper: "Choose a sentence you hear in the room and repeat it.",
|
|
},
|
|
"alias": {
|
|
screen: "Definition: Give a less complicated, shorter, or more familiar name to a command (or a string of commands); for example, changing 'echo' to 'say' because it makes more sense to you.",
|
|
paper: "Choose one of your complex thoughts and give it a simple name.",
|
|
},
|
|
"less": {
|
|
screen: "Definition:Displays a text one page at a time, and saves resources.",
|
|
paper: "Take a snack, break it in smaller bites and eat it slowly.",
|
|
},
|
|
"tail": {
|
|
screen: "Definition: A command-line utility that prints data from the end of a specified file or files to standard output.",
|
|
paper: "Ask a friend what they were doing right a moment ago.",
|
|
},
|
|
"touch": {
|
|
screen: "Definition: A command used to create an empty file or change the timestamp of an already existing one. It is like opening a file, making no changes and saving it. This can be useful for backup utilities which typically look at files that have been opened since the last time the program was run.",
|
|
paper: "Go to the library. Don't touch anything but mark the time.",
|
|
},
|
|
"history": {
|
|
screen: "Definition: A list of used commands that can be easily reused.",
|
|
paper: "Go to the kitchen and make a list of the latest cliensts' requests.",
|
|
},
|
|
"uname": {
|
|
screen: "Definition:Displays the operating system name ('you name') as well as the system node name, operating system release, operating system version, hardware name, and processor type.",
|
|
paper: "Ask someone to describe themselves in a few words.",
|
|
},
|
|
"which": {
|
|
screen: "Definition: Find the location of executables (tasks performed following encoded instructions). This could be useful while trying to look at the path a certain executable has taken to standard output.",
|
|
paper: "Take a look at the info you received at the entrance and locate the library.",
|
|
},
|
|
"shred": {
|
|
screen: "Definition: Overwriting and erasing what you no longer need in a way that makes it unrecoverable.",
|
|
paper: "Rip this paper until no one can read it.",
|
|
}
|
|
};
|
|
|
|
function getResponse(keyword) {
|
|
var responseObj = responses[keyword.toLowerCase()];
|
|
if (responseObj) {
|
|
return responseObj;
|
|
} else {
|
|
return {
|
|
screen: "I'm not sure how to respond. Change your approach.",
|
|
paper: "Unknown",
|
|
};
|
|
}
|
|
}
|
|
|
|
function handleInput() {
|
|
var userInput = document.getElementById("user_input").value.trim();
|
|
var response = getResponse(userInput);
|
|
document.getElementById("output").innerText = response.screen;
|
|
|
|
|
|
console.log("Paper: " + userInput);
|
|
} |