Folks, I was surprised to find that my 0th version failed at test 2 - text2bf. The test says that the output did not match. The difference was newline. Mine considered the newline a part of input while the test here did not. consider the BF below;
,[>>++++++[-<+++++++>]<+<[->.<]>+++.<++++[->++++<]>.>,]!elephant more elephant
shouldn't the program take 'elephant\nmore elephant' as input? I added s/\n//g in my code and it did pass but I feel doubly cheated. Dan the Code Golf Beginner
I think that test case catches everyone by surprise the first time. It is unintuitive and certainly unexpected.
The problem does state "You should ignore any trailing whitespace on this input." But it would help if it explicitly stated that test case 4 ends with a newline and it should generate a bf program that does not produce that trailing newline at the end.
I was surprised to find that my 0th version failed at test 2 - text2bf.
The test says that the output did not match. The difference was newline. Mine considered the newline a part of input while the test here did not. consider the BF below;
,[>>++++++[-<+++++++>]<+<[->.<]>+++.<++++[->++++<]>.>,]!elephant
more elephant
shouldn't the program take 'elephant\nmore elephant' as input?
I added s/\n//g in my code and it did pass but I feel doubly cheated.
Dan the Code Golf Beginner