Marches & Gnats programming challenges
4 points by kqr
4 points by kqr
There's quite a difficulty step up between 3 (Binary increment) and 4 (unary multiplication). It's fun. I'm trying to optimize for the number of rules, and the leaderboard puts the best unary multiplication at 15 rules ! I'm currently at 30+ with some ideas to go towards 20, but no clue how to go down past that.
For the record here is my naive initial solution for unary multiplication, which you can test here https://abbasmoosajee07.github.io/TuringMachineSim/#
//INIT will put the = at the ned
INIT | INIT | R
INIT * INIT * R
INIT _ B1CK = L
//BACK will come back to right before the *
// putting markers A and B on the right of the numbers
B1CK | B2CK B L
B2CK | B2CK | L
B2CK * B3CK * L
B3CK | AD1A A R
// ADDA will add 1 to the result
AD1A * AD1A * R
AD1A | AD1A | R
AD1A B AD1A B R
AD1A = AD2A = R
AD2A | AD2A | R
AD2A _ M1VA | L
// MOVA will move the A marker one step to the left
M1VA = M1VA = L
M1VA | M1VA | L
M1VA B M1VA B L
M1VA * M1VA * L
M1VA A M2VA | L
M2VA | AD1A A R
M2VA _ RS1A _ R
// RSTA will put the A marker right before * again
RS1A | RS1A | R
RS1A * RS2A * L
RS2A | M1VB A R
// MOVB will move the B marker one step to the left
M1VB * M1VB * R
M1VB | M1VB | R
M1VB B M2VB | L
M2VB | AD1A B R
M2VB * END1 * L
// END will erase everything left of and including =
END1 | END1 | L
END1 A END1 | L
END1 _ END2 _ R
END2 | END2 _ R
END2 * END2 _ R
END2 B END2 _ R
END2 = HALT _ R