Author: Robert Hyatt
Date: 20:49:23 04/10/03
Go up one level in this thread
On April 10, 2003 at 08:50:50, José Carlos wrote:
>On April 10, 2003 at 07:44:49, Uri Blass wrote:
>
>>On April 10, 2003 at 07:11:43, Albert Bertilsson wrote:
>>
>>>On April 10, 2003 at 06:35:07, Uri Blass wrote:
>>>
>>>>On April 09, 2003 at 23:56:54, Russell Reagan wrote:
>>>>
>>>>>So...who wants to explain how this works? I don't know how it works, but it
>>>>>finds all of the solutions to the 8 queens problem.
>>>>>
>>>>>#include <stdio.h>
>>>>>int v,i,j,k,l,s,a[99];
>>>>>void main(void){
>>>>>for(s=8;*a-s;v=a[j*=v]-a[i],k=i<s,j+=(v=j<s&&(!k&&!!printf(2+"\n\n%c"-(!l<<!j),"
>>>>>#Q"[l^v?(l^j)&1:2])&&++l||a[i]<s&&v&&v-i+j&&v+i-j))&&!(l%=s),v||(i==j?a[i+=k]=0:++a[i])>=s*k&&++a[--i]);
>>>>> printf("\n\n");
>>>>>}
>>>>
>>>>I do not understand this code because my C knowledge is not enough.
>>>>
>>>>What is *a-s
>>>>
>>>>I understand that j*=v is j=j*v butI do not understand the meaning when * is at
>>>>the beginning of the command.
>>>>
>>>>I never used it.
>>>>
>>>>Uri
>>>The *a means "content of a". a is here regarded as a pointer to an integer, thus
>>>it can be interpreted as the number at the adress that a points to.
>>>
>>>*a is the same as a[0], guess this later is more commonly used.
>>>
>>>/Regards Albert
>>
>>I understand now.
>>
>>I have pointers but I do not use them in that way.
>>I also do not have numbers as conditions
>>
>>I think that it is a bad writing and it is better to write
>>(a[0]-s)!=0) because it is more clear and I assume that there is no difference
>>in speed because the compiler translate it to the same code.
>
> This is not written for speed, it's written for not being understood! (also fo
>being short). That's what obfuscation is all about, kind of a game.
> There're obfuscation contest, where contestants have to pick some algorithm
>and write the shortest and most obscure code.
> I don't like it, but some programmers do ;)
>
> José C.
There are lots of classic obfuscation tricks.
IE "abc"[3] is another way to say zero (0). "abc" is a string pointer that
points to the actual string which is a, b, c and the terminating null.
The idea is to make it as hard to read as possible.
I remember a few years ago where someone had this:
return("rm -r *"[7]); as a part of their program. That also returns a value
of zero. But it caused great concern and lots of posts "hey, this will erase
your hard drive, it is a trojan..."
It wasn't. :)
there are lots of other tricks for those of us that have followed this
for years. Those guys are _nuts_.
>
>
>>I guess that the code starts
>>
>>s=8
>>a[0]-s!=0 so we continue to do the loop
>>v=A[j*v]-A[i]=0-0=0
>>j=j*v=0
>>
>>k=i<s
>>Again I do not use it without ()
>>Does it mean k=(i<s)(I see no meaning for (k=i)<s
>>
>>I think the way to try to understand it is simply to follow all the varaibles
>>manually in the first steps but I am not going to do it now.
>>
>>Uri
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.