开发者

What does this cryptic C code snippet do?

I’m reading some C code that can be found at https://home.hccnet.nl/h.g.muller/umax4_8.c. There, in main(), it has the following:

N=-1;W(++N<121)
    printf("开发者_高级运维%c",N&8&&(N+=7)?10:".?+nkbrq?*?NKBRQ"[b[N]&15]);

I don’t understand what this printf() call is doing, but somehow it outputs a chess board to the terminal.

Any idea?


Basically, this:

for (n = 0; n < 121; ++n) {
    if (n & 8) {
        n += 7;
        putchar('\n');
    } else {
        putchar(".?+nkbrq?*?NKBRQ"[b[n] & 15]);
    }
}

What that does is, after every 8 board items, print a newline; otherwise, print out the board item indicated by b[n].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜