Skip to content

Instantly share code, notes, and snippets.

@tangentstorm
Created September 1, 2016 19:16
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 tangentstorm/6af999d132bfe56b3c63f7adb7f0e83d to your computer and use it in GitHub Desktop.
Save tangentstorm/6af999d132bfe56b3c63f7adb7f0e83d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define I(n) for(int i=0; i<n; i++)
#define J(n) for(int j=0; j<n; j++)
#define O(str) printf(str)
#define Oc(c) putc(c, stdout)
#define M(x,y,c) m[y][x]=c;
int main() {
char c; char m[22][10];
J(22) I(10) m[j][i] = '.';
do switch(c = getc(stdin)) {
case 'p':
case 'P': J(22){ I(10){ Oc(m[j][i]); Oc(' '); } Oc('\n'); } break;
case 'T': M(5,0,'m'); M(6,0,'m'); M(7,0,'m'); M(6,1,'m'); break;
default: break;
} while (c != 'q');
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment