ReturnCAValue

From scripting
Jump to: navigation, search
global proc int ReturnCAValue(string $InputStr) {

// -----    Input The Cellular Automata Values HERE:    -----    //
    int $Main1[7] = {111, 110, 101, 100,  11,  10,   1,   0};
    int $Main2[7] = { 1,   0,   1,   0,    1,   0,   0,   1};
// -----    ----------------------------------------    -----    //

	int $ConvInt = int($InputStr);
	int $WC = -1;
	do {
		$WC++;
	} while ($WC < 8 && $Main1[$WC] != $ConvInt);
	return $Main2[$WC];
}


More information on numerical arrays, read pages 9-16 in YSYT.

See also: Cellular Automata