Skip to content

Instantly share code, notes, and snippets.

@SongHia
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SongHia/8d7fdfb70afbac48dfaa to your computer and use it in GitHub Desktop.
Save SongHia/8d7fdfb70afbac48dfaa to your computer and use it in GitHub Desktop.
Murakami Too v1
When I was younger, I scared my mother to death, the things I would blurt out about District 12, about the people who rule our country, Panem, from the far-off city called the Capitol. Eventually I understood this would only lead us to more trouble. So I learned to hold my tongue and to turn my features into an indifferent mask so that no one could ever read my thoughts. Do my work quietly in school. Make only polite small talk in the public market. Discuss little more than trades in the Hob, which is the black market where I make most of my money. Even at home, where I am less pleasant, I avoid discussing tricky topics. Like the reaping, or food shortages, or the Hunger Games. Prim might begin to repeat my words and then where would we be?";
/*
Song Hia
ICM Fall 2014 - Daniel Shiffman's Section
*/
import rita.*;
String inputFile = "input.txt"; //variable for input text file
String[] rawText; // array for input text
String completeText; // mega string for input text
PrintWriter output; //variable for output function
void setup() {
size(800, 400);
background(255);
output = createWriter("output.txt"); //declare and name file for output function
loadInput();
translateInput();
saveOutput();
}
void loadInput() {
rawText = loadStrings(inputFile); //loads text into array
completeText = join(rawText, ""); //adds text into one string
// output.print("Before Text:" + completeText); //writes the text to output file
//displays on screen
new RiText(this, "Before Text - Click to MurakamiToo", 40, 40);
RiText.createLines(this, completeText, 40, 60, 720, 320);
RiText.drawAll();
}
void translateInput() {
//find and replace all instances of these words in the string
completeText = completeText.replaceAll("(Panem)", "Japan");
completeText = completeText.replaceAll("(the things I would blurt out about District 12)", "I often pondered the strangeness and futility of life");
completeText = completeText.replaceAll("(the Capitol)", "Tokyo");
completeText = completeText.replaceAll("(my thoughts)", "my thoughts except for my cat Dave Brubeck");
completeText = completeText.replaceAll("(trades in the Hob)", "lite jazz");
completeText = completeText.replaceAll("(which is the black market where I make most of my money)", "which is the only thing I dislike more than my odd birthmarks");
completeText = completeText.replaceAll("(Like the reaping, or food shortages, or the Hunger Games)", "Like my ability to communicate telepathically with animals, and cold food");
output.println("After Text: " + completeText); //writes the translated text to the output file
}
//finalizes
void saveOutput() {
output.flush();
output.close();
}
void mouseReleased()
{
new RiText(this, "After Text", 40, height/2);
RiText.createLines(this, completeText, 40, height/2+20, 720, 320);
RiText.drawAll();
}
void draw() {
}
After Text: When I was younger, I scared my mother to death, I often pondered the strangeness and futility of life, about the people who rule our country, Japan, from the far-off city called Tokyo. Eventually I understood this would only lead us to more trouble. So I learned to hold my tongue and to turn my features into an indifferent mask so that no one could ever read my thoughts except for my cat Dave Brubeck. Do my work quietly in school. Make only polite small talk in the public market. Discuss little more than lite jazz, which is the only thing I dislike more than my odd birthmarks. Even at home, where I am less pleasant, I avoid discussing tricky topics. Like my ability to communicate telepathically with animals, and cold food. Prim might begin to repeat my words and then where would we be?";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment