Execute SNUSP/Java: Difference between revisions
m
Fixed syntax highlighting.
(minor changes) |
m (Fixed syntax highlighting.) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1:
{{implementation|SNUSP}}{{collection|RCSNUSP}}
This [[Java]] implementation has all of the basic characters plus '<code>%</code>', '<code>@</code>', and '<code>#</code>' (characters from modular and bloated SNUSP found on [
The implementation comes in two classes: the main program and a code pointer class. The separation is for the easier addition of '<code>&</code>' (split) which could come in the future (the code pointer class would only need to extend <tt>Thread</tt> and code would need to be added to deal with the command). The main class decides on the input method (file or std in), reads the code, and starts the code pointer. It also figures out where the starting point in the code is ('<code>$</code>' or 0,0).<br clear=all>
{{works with|Java|1.5+}}
The main class:<java>import java.awt.Point;▼
The main class:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
Line 47 ⟶ 49:
return code;
}
}</
The code pointer class:
<syntaxhighlight lang="java5">import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
Line 87 ⟶ 90:
public void run(){
}
Line 214 ⟶ 215:
return retVal;
}
private enum Direction{
UP,DOWN,LEFT,RIGHT;
}
}</syntaxhighlight>
|