#include #include char map[80][80]; char s[500]; int m,n; void znak(int x,int y,char c) { char d=map[x][y]; if (d==' ') { map[x][y]=c; return; } if (d==c) return; if (c=='/' && d=='\\') { map[x][y]='x'; return; } if (c=='\\' && d=='/') { map[x][y]='x'; return; } if ((c=='\\' || c=='/' || c=='x') && d=='x') return; if ((c=='-' && d=='|') || (c=='|' && d=='-')) { map[x][y]='+'; return; } if ((c=='-' || c=='+' || c=='|') && d=='+') return; map[x][y]='*'; } void ciara(int x,int y,int xx,int yy) { int p; int i; --x; --y;--xx;--yy; if (x>xx) { p=x; x=xx; xx=p; p=y; y=yy; yy=p; } if (x==xx) { if (y>yy) { p=y; y=yy; yy=p; } for (i=y; i<=yy; ++i) znak(x,i,'-'); } else for (i=x; i<=xx; ++i) { if (yyy) znak(i,y+x-i,'/'); else znak(i,y,'|'); } } void tekst(int x,int y,char *c) { int i; --x; --y; for (i=y; ixx) { p=x; x=xx; xx=p; } if (y>yy) { p=y; y=yy; yy=p; } for (i=x; i<=xx; ++i) for (j=y; j<=yy; ++j) map[i][j]=' '; } int main() { int x,y,xx,yy; char txt[500]; int i; while (scanf("%d %d",&n,&m)!=EOF) { if (!n && !m) return 0; vymaz(1,1,m,n); while (gets(s)) { if (!strcmp(s,"PRINT")) break; switch (s[0]) { case 'P': sscanf(s,"POINT %d %d",&y,&x); znak(--x,--y,'o'); break; case 'T': sscanf(s,"TEXT %d %d %s",&y,&x,txt); tekst(x,y,txt); break; case 'L': sscanf(s,"LINE %d %d %d %d",&y,&x,&yy,&xx); ciara(x,y,xx,yy); break; case 'C': sscanf(s,"CLEAR %d %d %d %d",&y,&x,&yy,&xx); vymaz(x,y,xx,yy); } } printf("+"); for (i=0; i