Thursday, March 6, 2014

Long break due to school, but here is some Arnold

A friend of mine showed me a language called ArnoldC (https://github.com/lhartikk/ArnoldC). This wonderful language requires commands to be written in the language of Arnold Schwarzenegger quotes. Though it was a very fun language to work with, I have a slight confession regarding this problem, the program doesn't quite print out the answer. The problem asks for you to find a pythagorean triple (a,b,c) and the answer is then the product abc. The product abc is too large to store in ArnoldC's 16bit integers, so I just print the triple from this program and multiply on a calculator. I normal dislike intermediary answers, but this feels entirely sufficient - for what it's worth, it's less effort converting the answer this way than it was extracting the decimal answer from the brainF unary output I had a while ago. Despite needing to put up with Arnold, this solution is relatively fast - runs in .110s on my machine.
LISTEN TO ME VERY CAREFULLY sqrt
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE x
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE prev
YOU SET US UP 0
GET TO THE CHOPPER prev
HERE IS MY INVITATION  x
HE HAD TO SPLIT 2
ENOUGH TALK
HEY CHRISTMAS TREE current
YOU SET US UP prev
HEY CHRISTMAS TREE continue
YOU SET US UP 1
HEY CHRISTMAS TREE result
YOU SET US UP 1
HEY CHRISTMAS TREE diff
YOU SET US UP 1
STICK AROUND continue

GET TO THE CHOPPER prev
HERE IS MY INVITATION current
ENOUGH TALK

GET TO THE CHOPPER current
HERE IS MY INVITATION x
HE HAD TO SPLIT current
GET UP prev
HE HAD TO SPLIT 2
ENOUGH TALK

GET TO THE CHOPPER diff
HERE IS MY INVITATION current
GET DOWN prev
ENOUGH TALK

GET TO THE CHOPPER result
HERE IS MY INVITATION diff
YOU ARE NOT YOU YOU ARE ME 0
ENOUGH TALK

BECAUSE I'M GOING TO SAY PLEASE result
GET TO THE CHOPPER continue
HERE IS MY INVITATION 0
ENOUGH TALK
YOU HAVE NO RESPECT FOR LOGIC

GET TO THE CHOPPER result
HERE IS MY INVITATION diff
YOU ARE NOT YOU YOU ARE ME 1
ENOUGH TALK

BECAUSE I'M GOING TO SAY PLEASE result
GET TO THE CHOPPER continue
HERE IS MY INVITATION 0
ENOUGH TALK
YOU HAVE NO RESPECT FOR LOGIC

CHILL

I'LL BE BACK current
HASTA LA VISTA, BABY

IT'S SHOWTIME

HEY CHRISTMAS TREE a
YOU SET US UP 2
HEY CHRISTMAS TREE b
YOU SET US UP 7
HEY CHRISTMAS TREE a2
YOU SET US UP 0
HEY CHRISTMAS TREE b2
YOU SET US UP 0
HEY CHRISTMAS TREE c2
YOU SET US UP 0
HEY CHRISTMAS TREE c
YOU SET US UP 0
HEY CHRISTMAS TREE t1
YOU SET US UP 0
HEY CHRISTMAS TREE t2
YOU SET US UP 0
HEY CHRISTMAS TREE result
YOU SET US UP 1
HEY CHRISTMAS TREE always
YOU SET US UP 1

STICK AROUND always
STICK AROUND result
GET TO THE CHOPPER a2
HERE IS MY INVITATION a
YOU'RE FIRED a
ENOUGH TALK

GET TO THE CHOPPER b2
HERE IS MY INVITATION b
YOU'RE FIRED b
ENOUGH TALK

GET TO THE CHOPPER c2
HERE IS MY INVITATION a2
GET UP b2
ENOUGH TALK

GET YOUR ASS TO MARS c
DO IT NOW sqrt c2

GET TO THE CHOPPER result
HERE IS MY INVITATION c
YOU'RE FIRED c
YOU ARE NOT YOU YOU ARE ME c2
ENOUGH TALK

BECAUSE I'M GOING TO SAY PLEASE result
GET TO THE CHOPPER result
HERE IS MY INVITATION a
GET UP b
GET UP c
YOU ARE NOT YOU YOU ARE ME 1000
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE result
TALK TO THE HAND a
TALK TO THE HAND b
TALK TO THE HAND c
GET TO THE CHOPPER always
HERE IS MY INVITATION 0
ENOUGH TALK
GET TO THE CHOPPER a
HERE IS MY INVITATION 499
ENOUGH TALK
YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE NO RESPECT FOR LOGIC

GET TO THE CHOPPER a
HERE IS MY INVITATION a
GET UP 1
ENOUGH TALK

GET TO THE CHOPPER result
HERE IS MY INVITATION 500
LET OFF SOME STEAM BENNET a
ENOUGH TALK
CHILL

GET TO THE CHOPPER a
HERE IS MY INVITATION 1
ENOUGH TALK
GET TO THE CHOPPER b
HERE IS MY INVITATION b
GET UP 1
ENOUGH TALK
GET TO THE CHOPPER result
HERE IS MY INVITATION 1
ENOUGH TALK
CHILL
YOU HAVE BEEN TERMINATED

No comments:

Post a Comment