Character Swap Post Mortem

I had been planning to create character swap well before I declared my intent to participate in this years’ NaNoGenMo, but joining this project solidified the idea for me. NaNoGenMo is based off an idea my friend Darius had in 2013 in response to the National Novel Writing Month, which encourages writers to write a 50,000 word novel in the month of November. The NaNoGenMo project encourages programmers to write code that generates a novel of 50k+ words with the only rule that you share the novel and your source code at the end.

I chose The Adventures of Sherlock Holmes by Arthur Conan Doyle as the first book to undergo a character swap mainly because it is a popular book of short stories with distinct and memorable references to gender which also exists in the public domain and so is freely available to modify.

adventures_sherlock_holmes

Continue reading

The Count Recursively Laugh Counting

The Count from Sesame Street came up in a code review and it was mentioned that if he ever tried to count his laughs it would be recursive and infinite due to his immortality. I wrote a small recursive program to demonstrate the Count’s folly, which running with finite memory counts 9629 AH’s before stack overflow.

import java.util.ArrayList;
import java.util.List;

/**
* The recursive laugh counting of Count Von Count.
*/
public class CountVonCount {

private List notCounted = new ArrayList<String>();

public static void main (String[] args) {

CountVonCount theCount = new CountVonCount();
theCount.laugh();

}

private void laugh(){

String ah = new String();
notCounted.add(ah);
count(ah);

}

private void count(String ah){

if (notCounted.contains(ah)){

String ahAh = new String();
notCounted.add(ahAh);
System.out.println(“That’s ” + notCounted.size() + ” AH’s!”);
count(ahAh);

}

}

}

InCommand

I met a traveller from an antique land
Who said: “Two vast and trunkless legs of stone
Stand in the desert . . . Near them, on the sand,
Half sunk, a shattered visage lies, whose frown,
And wrinkled lip, and sneer of cold command,
Tell that its sculptor well those passions read
Which yet survive, stamped on these lifeless things,
The hand that mocked them, and the heart that fed:
And on the pedestal these words appear:
‘My name is Ozymandias, king of kings:
Look on my works, ye Mighty, and despair!’
Nothing beside remains. Round the decay
Of that colossal wreck, boundless and bare
The lone and level sands stretch far away.”

Percy Bysshe Shelley, 1818

Continue reading

slowMovement(williams)

Dream dream = new Dream();
Box box = new BoltedBox(dream);
Hand hand = new Hand(box);
Night night = new Night(hand);
while (hand.holds(box.lid(tight))) {
    for (int iam = 0; iam < night.darkness().length; iam++){
        dream.radiance(iam);
        dream.complaint(iam);
        hand.lostKey(true);
        dream.lives();
    }
}

 

The original from Bartleby:

Slow Movement

William Carlos Williams (1915)

ALL those treasures that lie in the little bolted box whose tiny space is
Mightier than the room of the stars, being secret and filled with dreams:
All those treasures—I hold them in my hand—are straining continually
Against the sides and the lid and the two ends of the little box in which I guard them;
Crying that there is no sun come among them this great while and that they weary of shining;
Calling me to fold back the lid of the little box and to give them sleep finally.

But the night I am hiding from them, dear friend, is far more desperate than their night!
And so I take pity on them and pretend to have lost the key to the little house of my treasures;
For they would die of weariness were I to open it, and not be merely faint and sleepy
As they are now.