Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Created February 21, 2017 21:27
Show Gist options
  • Select an option

  • Save jorendorff/254807d9122315a975bc89884d565c9f to your computer and use it in GitHub Desktop.

Select an option

Save jorendorff/254807d9122315a975bc89884d565c9f to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
const int P[8] = {0, 0, 0, 0, 1, 1, 1, 1};
const int Q[8] = {0, 0, 1, 1, 0, 0, 1, 1};
int first_array[8];
char first = 'P';
// ---------------------------------------
for (int i =0;i<8;i++){
if (first=='P'){
first_array[i]=(!P[i]||Q[i]);
}
if (first=='Q'){
first_array[i]=(!Q[i]||P[i]);
}
}
for (int i=0;i<8;i++){
cout<<first_array[i]<<endl;
}
// ---------------------------------------
return 0;
}
1
1
1
1
0
0
1
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment