djfz-2019-s426197/TaskX07/legiatolech.grm

16 lines
836 B
Plaintext
Raw Permalink Normal View History

add_four_digit = ("0":"4") | ("1":"5") | ("2":"6") | ("3":"7") | ("4":"8") | ("5":"9") | ("6":"01") | ("7":"11") | ("8":"21") | ("9":"31");
2020-01-20 12:11:08 +01:00
add_one_digit = ("C0":"1") | ("C1":"2") | ("C2":"3") | ("C3":"4") | ("C4":"5") | ("C5":"6") | ("C6":"7") | ("C7":"8") | ("C8":"9") | ("C9":"0C");
digit = "0" | "1" | "2" | "4" | "5" | "6" | "7" | "8" | "9";
number = digit+;
add_four = add_four_digit number?;
handle_carry = (number? (("S0":"0") | ("S1":"1") | ("S2":"2") | ("S3":"3")) number?) | number;
2020-01-20 12:11:08 +01:00
#handle_carry = (number? (("S0":"0C") | ("S1":"1C") | ("S2":"2C") | ("S3":"3C")) number?) | (number? (("C0":"1") | ("C1":"2") | ("C2":"3") | ("C3":"4") | ("C4":"5") | ("C5":"6") | ("C6":"7") | ("C7":"8") | ("C8":"9") | ("C9":"0C")) number?) | (number? ("C":"1")) | number;
2020-01-20 12:11:08 +01:00
export PROCESS = Optimize[Reverse[add_four @ handle_carry]];