Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <stdio.h>
#define A (state&0x0001)
#define B (state&0x0002)
#define C (state&0x0004)
#define D (state&0x0008)
#define E (state&0x0010)
#define F (state&0x0020)
#define G (state&0x0040)
#define H (state&0x0080)
#define I (state&0x0100)
#define J (state&0x0200)
#define K (state&0x0400)
#define L (state&0x0800)
#define M (state&0x1000)
#define N (state&0x2000)
#define O (state&0x4000)
#define P (state&0x8000)
#define is_right(a,b,c,d) ((a)==0||(b)==0 || ( ((c)!=0)!=((d)!=0) ) )
static int count(int state) {
int count=0;
count += is_right(J,A,F,K);
count += is_right(M,B,K,N);
count += is_right(P,C,H,N);
count += is_right(L,D,G,N);
count += is_right(O,E,A,J);
count += is_right(C,F,B,M);
count += is_right(O,G,C,P);
count += is_right(B,H,D,I);
count += is_right(G,I,E,O);
count += is_right(D,J,D,K);
return count;
}
int main() {
unsigned long long int state;
int count;
for (state=0;state<=0xFFFF;state++) {
count=0;
count += is_right(J,A,F,K);
count += is_right(M,B,K,N);
count += is_right(P,C,H,N);
count += is_right(L,D,G,N);
count += is_right(O,E,A,J);
count += is_right(C,F,B,M);
count += is_right(O,G,C,P);
count += is_right(B,H,D,I);
count += is_right(G,I,E,O);
count += is_right(D,J,D,K);
if (count==1) {
printf("P O N M L K J I H G F E D C B A\n");
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",P!=0,O!=0,N!=0,M!=0,L!=0,K!=0,J!=0,I!=0,H!=0,G!=0,F!=0,E!=0,D!=0,C!=0,B!=0,A!=0);
if (is_right(J,A,F,K)) printf (" nur A hat recht\n");
if (is_right(M,B,K,N)) printf (" nur B hat recht\n");
if (is_right(P,C,H,N)) printf (" nur C hat recht\n");
if (is_right(L,D,G,N)) printf (" nur D hat recht\n");
if (is_right(O,E,A,J)) printf (" nur E hat recht\n");
if (is_right(C,F,B,M)) printf (" nur F hat recht\n");
if (is_right(O,G,C,P)) printf (" nur G hat recht\n");
if (is_right(B,H,D,I)) printf (" nur H hat recht\n");
if (is_right(G,I,E,O)) printf (" nur I hat recht\n");
if (is_right(D,J,D,K)) printf (" nur J hat recht\n");
printf("\n");
}
}
return(0);
}