Skip to content

Instantly share code, notes, and snippets.

@thwarted
Created June 22, 2011 06:40
Show Gist options
  • Save thwarted/1039609 to your computer and use it in GitHub Desktop.
Save thwarted/1039609 to your computer and use it in GitHub Desktop.
footguy - he's very impatient
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <unistd.h>
void uxsleep(int time)
{
sleep(time);
}
void ansi_goto(int x, int y)
{
printf("\x1b[%d;%dH",y,x);
}
void ansi_cls()
{
printf("\x1b[2J");
}
void footguy(int x,int y)
{
ansi_goto(x+1,y+2); printf("oo");
ansi_goto(x+0,y+3); printf("<|>");
ansi_goto(x+0,y+4); printf("_|_");
fflush(stdout);
}
void footguy_tap(int x, int y,int tap)
{
ansi_goto(x+2,y+4); printf(tap?"/":"_");
fflush(stdout);
}
void footguy_swear(int x, int y)
{
ansi_goto(x+1,y+0); printf("Welcome to SCInc!");
ansi_goto(x+3,y+1); printf("/");
fflush(stdout);
}
void main(int argc, char *argv[])
{
int taps;
int x=30, y=10;
srand(clock());
while(1)
{
x=rand()%70+3;
y=rand()%20;
ansi_cls();
footguy(x,y);
taps = rand()%41+10;
for(;taps > 0;taps--)
{
uxsleep(1);
footguy_tap(x,y,taps%2);
}
uxsleep(1);
footguy_swear(x,y);
uxsleep(3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment