Skip to content

Instantly share code, notes, and snippets.

b[48],c,k;//b is game board, c is column chosen by user, k keeps track of win state
/*
Win detection:
check four cells, each separated by n slots
AND (bitwise) them together:
If any of the cells are zero, the result is zero
If all the cells are one, the result is one
If all the cells are two, the result is two
If the cells contain a mix of ones and twos, the result is zero
m,s,c,p;
main(v){
for(;~(v=getchar());p=v)
if(m)
m=v^47||p^42;
else if(s)
s=v!=10;
else if(p^47)
c+=v^9&&v^10;