Skip to content

Instantly share code, notes, and snippets.

@cesque
cesque / gist:409f2445dffe056581f6
Created February 2, 2015 23:49
Example of a Message system for online game
// Message.java
/*
A 'Message' consists of a Type and a Body. the Type essentially tells whoever is reading the Message that the Body is a certain class type.
Then whoever is recieving the message can cast the Body to that class, and read its contents
*/
public class Message {
public String type;
public MessageBody body;
public Message(String type, MessageBody body) {
@cesque
cesque / gist:b8cbdc9a29a321914984
Created November 12, 2014 01:39
Randomly generated poem using a JSON file of Shakespeare's sonnets, Markov Chains and RhymeBrain API
There can my pen, Where breath their badness
Who all thy aid, my self, that purpose
thine, That am that the fair; The manner
remember thee more: To thy might the other
poor beauty is, Beggar'd of altering things; Alas!
to flow, For how do none, That have
well might teach thee my angel be false,
@cesque
cesque / gist:4e195ee7d286ef08cbdf
Last active August 29, 2015 14:09
Generating a text using characters with finite state machine-controlled behaviour - first attempt
Huw stands idly. Huw stands up. An interesting thought strikes Huw. Huw thinks.
Huw continues his train of thought. Huw continues his train of thought. Huw
snaps out of his daydream. Huw gets bored. Huw stands idly. Huw gets tired and
sits down. Huw stands up. Huw sees something interesting on the other side of
the room, and decides to take a closer look. Huw walks towards the other side of
the room. Finally, Huw reaches his destination. An interesting thought strikes
Huw. Huw thinks. Huw continues his train of thought. Huw snaps out of his
daydream. Huw sees something interesting on the other side of the room, and
decides to take a closer look. Huw walks towards the other side of the room.
Finally, Huw reaches his destination. Huw gets bored. Huw stands idly. Huw gets
@cesque
cesque / gist:9c5a8ec991e0d9d28870
Last active August 29, 2015 14:08
More autogenerated text, this time using a different dictionary and some different layout/styling of the sentences
--- CHAPTER I - THE ONE ---
I.I - THE MAN SAW THE INFINITE PURGATORY.
I.II - HE BOWED IN THE INVERSE HEAVEN WITHIN A HUMAN LEST A ALTAR A DARK.
I.III - HE PROMISED BELOW THE CHOSEN ONE, BUT SMOTE THE HOLY CUBE BEHIND THE VOID BELOW THE HEXAGONAL HELL.
I.IV - SLOWLY, THE ONE PRAISED IN IT HER.
I.V - REVERENTIALLY, HIM COMMITTED.
I.VI - HE PRAISED THROUGHOUT HE, AND AFTER THAT PROMISED THE FORGIVEN DARK INFINITELY.
--- CHAPTER II - HIM ---
@cesque
cesque / gist:564be4e9aa54d40c00d7
Last active August 29, 2015 14:08
Automatically generated text for #NaNoGenMo. Only a few words in dictionary at the moment.
///////////////////////////////////////////////////////////////////////
Progress for #NaNoGenMo. Only a few words in dictionary at the moment
and the whole thing is held together with duct tape and string. It
crashes about 20% of the time on generating this short ~1000 word text.
///////////////////////////////////////////////////////////////////////
Clumsily, the bird on top of a bird and Ash picked up Daniel.