Permalink
Browse files

Convert Main.Run to an instance method. Convert locals to fields.

This will prepare us to be able to extract out classes.
  • Loading branch information...
michaelgwelch committed Mar 21, 2012
1 parent 39bad7c commit 51f4330605395edd0d023215f873e66dbe2edb91
Showing with 11 additions and 5 deletions.
  1. +11 −5 csharp/BrainmessShort/Main.cs
@@ -5,18 +5,24 @@ namespace BrainmessShort
{
public class Brainmess
{
private readonly string program;
private int pc = 0;
private readonly int[] tape = new int[5000];
private int tc = 2500;
public Brainmess(string program)
{
this.program = program;
}
public static void Main(string[] args)
{
var reader = File.OpenText(args[0]);
Run(reader.ReadToEnd());
new Brainmess(reader.ReadToEnd()).Run();
reader.Close();
}
public static void Run(string program)
public void Run()
{
int pc = 0;
int[] tape = new int[5000];
int tc = 2500;
while(pc < program.Length)
{
char instruction = program[pc];

0 comments on commit 51f4330

Please sign in to comment.