Created
          October 22, 2010 12:32 
        
      - 
      
- 
        Save wasabili/640461 to your computer and use it in GitHub Desktop. 
    K-On Fuck
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | int stk[2<<14]; | |
| int ps=0; | |
| void push(int n){stk[ps++]=n;} | |
| int pop(){return stk[--ps];} | |
| int len(char a[]){ | |
| int i; | |
| for(i=0;1;i++){ | |
| if(a[i] == '\0') return i; | |
| } | |
| } | |
| main(){ | |
| char a[2<<15]; // Input | |
| int c[2<<15]; // Commands | |
| int n; // Number of Commands | |
| int s; // Seeker of Commands | |
| signed char d[2<<14]; // Memory | |
| int p; // Pointer | |
| int jm; // Jump to ... | |
| int i,j,k; | |
| while(1){ | |
| putchar('>');putchar(' '); | |
| gets(a); | |
| s = p = jm = 0; | |
| n = len(a)/18; | |
| // Translate input into commands | |
| for(i=0;i<n;i++){ | |
| k=0; | |
| for(j=0;j<3;j++){ | |
| k*=2; | |
| if(a[i*18+j*6+1] == -127 && a[i*18+j*6+2] == -97) k+=1; // If tan | |
| } | |
| c[i] = k; | |
| } | |
| for(i=0;i<(2<<14);i++) d[i] = 0; | |
| //puts("Init finished"); | |
| for(s=0;s<n;s++){ | |
| k=c[s]; | |
| if(jm){ | |
| if(k == 6) jm++; | |
| else if(k == 7) jm--; | |
| }else{ | |
| char tmp[256]; | |
| //gets(tmp); | |
| if(k==0) ++p; | |
| else if(k==1) --p; | |
| else if(k==2) ++d[p]; | |
| else if(k==3) --d[p]; | |
| else if(k==4) putchar(d[p]); | |
| else if(k==5) d[p] = getchar(); | |
| else if(k==6){ | |
| if(d[p]) push(s-1); | |
| else jm = 1; | |
| }else if(k==7){ | |
| if(d[p]) s = pop(); | |
| } | |
| //printf("index:%d, command:%d, pointer:%d\n", s,k,p); | |
| //for(i=0;i<10;i++) printf("%d ", d[i]); | |
| //puts(""); | |
| } | |
| } | |
| puts(""); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment