Skip to content

Instantly share code, notes, and snippets.

@passos
Created July 8, 2011 14:14
Show Gist options
  • Save passos/1071928 to your computer and use it in GitHub Desktop.
Save passos/1071928 to your computer and use it in GitHub Desktop.
Chinese Chess problem solution 1
#include <stdio.h>
void main()
{
short unsigned int x;
for (x = 0; (x & 0xF0) < 0x90; x += 0x10 ) {
for ( x &= 0xF0; (x & 0x0F) < 9; x++)
if ((x >> 4) % 3 != (x & 0x0F) % 3)
printf("A = %d, B = %d\n", (x >> 4) + 1, (x & 0x0F) + 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment