klx wrote: ↑Sat Aug 28, 2021 10:09 am
Ancient post, but the choice of not counting whitespace characters is a bit odd to me. I suppose you could encode all your logic in a string consisting of space and tab characters for a very "short" entry.
Not counting whitespace is a rule for the "International Obfuscated C Code Contest". This no doubt to leave the contestants freedom to determine the layout of the program without affecting the length. They even don't count semicolons there; I cannot imagine why they would do that.
For micro-Max I use a slightly different counting, as the purpose was not obfuscation per se. So I did want the program to have a nicely readable layout, rather than just be a single line of text. So I discard linefeeds, comments and spaces that could have been deleted without altering the meaning of the program. In your proposal all tabs and spaces would be coding characters, so they would have to be counted.
klx wrote: ↑Sat Aug 28, 2021 10:09 am
I suppose you could encode all your logic in a string consisting of space and tab characters for a very "short" entry.
Yes, you could. But then you need a parser for this 1bit coding. And this parser needs source code. Often solving a problem that will solve the real problem is just a detour that brings you nothing - no reduction in speed or space (program size). A good example is the first implementation of Tiny Basic and the second one. The first had this two levels approach (an intermediate language to solve the Basis interpreter problem), the second was Z80 assembler solving the problem in a straightforward way.
AndreAdrian wrote: ↑Thu Aug 26, 2021 5:29 pmNow I made a port to ESP32, ESP32-S2, ESP32-C3, called ESP32-Max, these are 32-bit CPUs with up to 4MByte RAM.
My CT800 engine runs on a Cortex-M4 microcontroller with 192kB RAM and 1MB ROM (266kB used), plus an embedded opening book, various time control options, and a mate search mode. Using that would also give you a 500 Elo uplift from Micro-Max. Licence is GPLv3+.
I'm currently trying to write a small chess program, it is mixed source python and C and is 5.2kb for now. I'm trying to make it smaller to enter the 4k TCEC bonus event but it is far from easy !
klx wrote: ↑Sat Aug 28, 2021 10:09 am
I suppose you could encode all your logic in a string consisting of space and tab characters for a very "short" entry.
Yes, you could. But then you need a parser for this 1bit coding. And this parser needs source code. Often solving a problem that will solve the real problem is just a detour that brings you nothing - no reduction in speed or space (program size).
A parser is like 50 characters, depending on the language and requirements. Here's a quick C example, decoding a binary string of tabs and spaces into shellcode and executing it. This shellcode simply returns the number 100, but you could just as well encode all of Stockfish there if you wanted, without changing the "code size".
klx wrote: ↑Sat Aug 28, 2021 10:09 am
I suppose you could encode all your logic in a string consisting of space and tab characters for a very "short" entry.
Yes, you could. But then you need a parser for this 1bit coding. And this parser needs source code. Often solving a problem that will solve the real problem is just a detour that brings you nothing - no reduction in speed or space (program size).
A parser is like 50 characters, depending on the language and requirements. Here's a quick C example, decoding a binary string of tabs and spaces into shellcode and executing it. This shellcode simply returns the number 100, but you could just as well encode all of Stockfish there if you wanted, without changing the "code size".
amanjpro wrote: ↑Mon Aug 30, 2021 3:45 pm
It doesn't translate from whitespace language to C++ unless I'm missing something
It translates from "binary whitespace" (tab / space) to machine code and runs it. This example is just "mov al, 100; ret;" but we can put any code there. The final code then becomes something like: