Skip to content

Commit

Permalink
Fixed stuff...
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsmeding committed Apr 7, 2014
1 parent 54afe68 commit 794af88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ My interpreter for MarioLANG in C++.
See http://esolangs.org/wiki/MarioLANG for a description of the language.

`mariolang.cpp` is the actual interpreter and the `.mlg`-files are sample codes in MarioLANG for testing purposes.
`99bottles.mlg` is not by me. Wouldn't even start it.
`guess.mlg` is _not_ a guessing game, since it just prints "Nr". Yeah well.
`genML.js` is a MarioLANG text generator using Node.JS.
`99bottles.mlg` is not by me. Wouldn't even start making it anyway.
12 changes: 6 additions & 6 deletions mariolang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,15 @@ class Level{
if(c=='\r')outputx=0;
else if(c=='\n'){outputx=0;outputy++;}
else if(c=='\t'){outputx=TABWIDTH*(outputx/TABWIDTH+1);}
else if(c<32){printf("^%c",'@'+c);outputx+=2;}
else if(c==127){printf("^?");outputx+=2;}
else {putchar(c);outputx++;}
} else putchar(memory[m->memp]);
else if(c<32){cout<<'^'<<'@'+c<<flush;outputx+=2;}
else if(c==127){cout<<"^?";outputx+=2;}
else {cout<<c;outputx++;}
} else cout<<(char)memory[m->memp];
break;
case ':':
num=printf("%d ",memory[m->memp]);
if(num<0)ERROR_FALSE("FATAL: IO error, printf returned a negative value!");
fflush(stdout);
outputx+=num;
break;
case ',':
Expand All @@ -242,8 +243,7 @@ class Level{
while(c!='\r'&&c!='\n'){
if(c>='0'&&c<='9'){
num=10*num+c-'0';
if(num>255)num/=10;
else cout<<c<<flush;
cout<<c<<flush;
} else if(c==127&&num!=0){ //backspace
cout<<"\x1B[D \x1B[D"<<flush;
num/=10;
Expand Down

0 comments on commit 794af88

Please sign in to comment.