5
1
Write a program in brainfuck that accepts input of 4 ASCII characters as numbers (from 32 to 126) and outputs the numbers or ASCII equivalent sorted in ascending order.
Requirements: Your program should prompt the user for 4 characters that will be sorted by their ASCII value. All the inputs will be distinct. Any sorting algorithm can be used. Every cell is one byte, and the shortest code wins. If there is a tie, the code that uses the least memory cells wins.
Example input:
(i"G
Example output:
"(Gi
Helpful links: How to compare 2 numbers with brainfuck
If you have any questions please ask them in the comments.
I tried to write a program that solves this problem. It works, but it's so inefficient and lenghty (500+) that I don't want to post it here. If you bothered to go through the pain I did, you'll get a +1 from me.
I get why this should be language-specific. Sorting in BF is very different from normal languages. – MilkyWay90 – 2019-06-15T17:02:24.767
A lot of my early questions were of questionable quality. – qwr – 2019-06-15T20:25:56.997
11Meh, language-specific challenge. I can see how this would be a challenge in Brainfuck and fairly trivial in "normal" languages, but still... – Martin Ender – 2014-07-05T20:50:16.420
How about allowing more esoteric languages? – Knerd – 2014-07-10T17:27:16.630
@Knerd I'll allow it, but it's not the main focus of this question. – qwr – 2014-07-10T19:44:18.583
@qwr then you should edit your question :) – Knerd – 2014-07-10T20:36:13.123