Skip to content

Instantly share code, notes, and snippets.

@dylnuge
Last active December 22, 2015 22:29
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 dylnuge/6540662 to your computer and use it in GitHub Desktop.
Save dylnuge/6540662 to your computer and use it in GitHub Desktop.
C-lilliquy, Macbeth style
#define HEREAFTER(X, Y) ((X) >= (Y))
#define SUCH_A_WORD 1
#define TOMORROW 1
#define PETTY_PACE .00001
#define LAST_SYLLABLE 1000
#define LIGHTED 1
#define OUT 0
#define DEATH 0x08
#define DUSTY 0x04
#define BRIEF DEATH
#define WALKING 0x01
#define SHADOW 0x02
#define POOR SHADOW
#define ON_STAGE WALKING
#define STRUTS 0x01
#define FRETS 0x01
#define HOUR 60
#define IDIOT 1
#define TELLER 8
#define FULL 0xfe
#define SOUND 0x01
#define FURY 0x01
typedef struct character {
int died;
int time_died;
} char_t;
/* Macbeth Act 5, Scene 5
C-lilliquy version */
int main(int argc, char** argv) {
// Set the stage, define characters (pun intended)
char_t* lady_macbeth = malloc(sizeof(char_t));
int time = 10;
int day = 0;
int* yesterdays = malloc(LAST_SYLLABLE/PETTY_PACE * sizeof(INT));
// (Seyton) The queen is dead, my lord
lady_macbeth->died = 1;
lady_macbeth->time_died = 0;
// (Macbeth) She should have died hereafter
if (!lady_macbeth->died || lady_macbeth->died && HEREAFTER(lady_macbeth->time_died, time)) {
// There would have been a time for such a word
time = SUCH_A_WORD;
}
// Tomorrow, and tomorrow, and tomorrow
while (TOMORROW && TOMORROW && TOMORROW) {
// Creeps in this petty pace from day to day
day = day + PETTY_PACE;
time += day;
// To the last syllable of recorded time
if (time == LAST_SYLLABLE) {
break;
}
// And all our yesterdays have lighted fools the way to dusty death
yesterdays[(day * 1/PETTY_PACE)] = (LIGHTED << (DEATH)) | DUSTY;
// Out, out, brief candle
int candle = yesterdays[(day * 1/PETTY_PACE)]
if (candle & BRIEF) {
candle &= (OUT, OUT);
}
}
// Life is but a walking shadow
int life = WALKING | SHADOW;
// A poor player who struts and frets his hour upon the stage
int player = life;
if (player & poor) {
while (player & ON_STAGE) {
player &= STRUTS & FRETS;
if (time > HOUR) {
// And then is heard no more
player = silence(player);
}
}
}
// It is a tale told by an idiot
int tale = (IDIOT << TELLER);
// Full of sound and fury
while ((tale <<= 1) != FULL) {
tale |= SOUND & FURY;
}
// Signifying nothing
return 0;
}
int silence(int actor) {
return actor &= ~WALKING;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment