Activity for H_Hâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #289436 | Initial revision | — | over 1 year ago |
Question | — |
Reverse the bits in a Byte Simple challenge: Read a byte, swap bit 7 with 0, 6 with 1, 5 with 2 and 4 with 3 and then output the byte. For example the byte `0b1001'1100` would turn into `0b0011'1001`. Rules: - Shortest code wins - A byte has at least 8 bit. If it makes things easier, you can use a bigger byte size. The ... (more) |
— | over 1 year ago |
Comment | Post #285888 |
This has less unique characters: `!![]/(!![]+!![])` (more) |
— | over 1 year ago |
Comment | Post #285821 |
There is no word about specification or anything like that. For me, the requirement to have a official programming language specification, one that exactly specifies what a keyword is and what not is a totally different requirement than just the requirements of having the concept of keywords. (more) |
— | over 1 year ago |
Comment | Post #285821 |
Can you please specify this in the post? This is a huge restriction so far not mentioned.
Please keep in mind that there are real world languages that don't have a language specification, for example rust. (more) |
— | over 1 year ago |
Comment | Post #285821 |
"The program need not do anything meaningful or perform any particular input/output"
But i assume it is ok when it outputs something and when it waits for a user input? Some languages have a keyword that reads something or write something. (more) |
— | over 1 year ago |
Comment | Post #285821 |
Can a keyword be a single character?
Or to ask a bit more general: What exactly do you define as a keyword for this challenge? (more) |
— | over 1 year ago |
Comment | Post #287207 |
Ok, but can you answer the other question: What is the maximum input length? I assume it is not infinite since that would invalidate most languages and it invalidates every real worl implementation of any solution. (more) |
— | over 1 year ago |
Comment | Post #287540 |
IMHO using a function instead of a running program is already cheating. But when you think it is ok you can also accept the return value as a valid form of output.
In this case, it isn't actually the return value but changing the string in place. (more) |
— | over 1 year ago |
Comment | Post #287540 |
Otherwise, `f(int*p){for(;*p;p++)*p|=32;}` would also work. [Try it online!](https://tio.run/##jY6xDoIwFEV3vqJhoYWQIA4aK4P@hjg0tWgH26YgiUG@vb4HwcWYuDXnvNt7ZX6VMoSGatOljg2N9ZSnjrssY6l7VeuSjwEcuQttCO2tvrBoiAhxj66l8VFBQBFpTa98q63ZxYyDxYTwXjxPq3Kbr8szwgVsEJCKJHWRIMdODOiq4ETv5wN4wQSwWLZkNcZ0BnaCsEHehKeLnK... (more) |
— | over 1 year ago |
Comment | Post #287207 |
What is the maximum input length? Can i provide a solution that just works for a single character, since you can call it for every character? (more) |
— | over 1 year ago |
Comment | Post #279657 |
Maybe you can specify on which system you tested it? It is at least not standard C, since there is no `putch()` in standard C. And it probably needs a system where `sizeof(int)==sizeof(char*)`, so that you don't lose anything after `gets()` return. (more) |
— | over 1 year ago |
Comment | Post #288535 |
This means basically every real world programming language can't be used since they don't support a infinity amount of memory (they neither support an infinite amount of integers (or characters, .... whatever you prefer) / infinite long strings nor an infinitely high value for a single integer ). (more) |
— | over 1 year ago |
Comment | Post #279657 |
I tested it under Linux AMD64 with GCC 10.2.1. `putch` isn't know and the return value of `gets()` get converted to a `int` and back to a pointer, causing it to lose the upper halve of the pointer value causing a segment fault in `strchr()`. (more) |
— | over 1 year ago |
Comment | Post #285880 |
Are languages that don't have a built in floating point type or don't have types at all (for example brainfuck) forbidden? Or can i use a IEEE floating point representation in a integer? Or a fraction? Or giving the mantises and exponent as 2 integers? (more) |
— | over 1 year ago |
Comment | Post #288535 |
What is the maximum length of string X and string Y? In bytes. And how many characters do i have to remove at maximum? (more) |
— | over 1 year ago |
Comment | Post #288943 |
Can you give a example program? The challenge is hard to understand (at least for me). And how can the result be exactly ${-1,0,1}$ even when $n>3$, wouldn't that imply a result with more numbers? (more) |
— | over 1 year ago |
Edit | Post #289174 |
Post edited: |
— | over 1 year ago |
Edit | Post #289174 | Initial revision | — | over 1 year ago |
Answer | — |
A: Reverse an ASCII string Brainfuck, 10 Bytes ```,[>,],], # read and fill the tape to the right with the read characters < # go back to the last valid character, i.e. one before EOF [ ] # loop till current cell is 0 (i.e. cell pointer is before the first read character .< # output cha... (more) |
— | over 1 year ago |
- ← Previous
- 1
- 2
- 3
- Next →