{"size": 776, "ext": "js", "max_stars_repo_path": "Class6/testlinden.js", "max_stars_repo_name": "Nianze/MPATE-GE-2633-SP21-DuBois", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Class6/testlinden.js", "max_issues_repo_name": "Nianze/MPATE-GE-2633-SP21-DuBois", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Class6/testlinden.js", "max_forks_repo_name": "Nianze/MPATE-GE-2633-SP21-DuBois", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.8695652174, "max_line_length": 66, "alphanum_fraction": 0.543814433}
outlets = 2;

var thestring = ' ';
var axiom = 'A';
var therules;

//therules = [['A', 'AB'], ['B', 'A']];
//therules = [['A', 'AB'], ['B', 'AC'], ['C', 'ABA']];
therules = [['A', 'DA'], ['B', 'AC'], ['C', 'ABA'], ['D', 'BCA']];

reset();


function bang()
{
	var outstring = '';
	for(var i = 0;i<thestring.length;i++)
	{
		var match = -1;
		var c = thestring.charAt(i); // current character
		for(var j = 0;j<therules.length;j++)
		{
			if(c==therules[j][0]) match = j;
		}
		if(match>-1) // the rule exists
		{
			outstring+=therules[match][1];
		}
		else // the rule does not exist
		{
			outstring+=c;
		}
	}
	outlet(1, outstring);
	thestring = outstring;
}

function reset()
{
	thestring = axiom; // start over
}

function position(v)
{
	outlet(0, thestring.charAt(v));
}