default text=text; default turn=(turn+7)%9+1; int key[] = {1,2,3,4,5,6,7,8}; nbr neighbor[] = {no:, nw:, we:, sw:, so:, se:, ea:, ne:}; int value,i,offset; if(turn==2){ value=0;offset=0; for(i=0;i<8;i++){ value = (value+(neighbor[i]:text * key[i]))%128; if(key[i]%2) offset=(offset-neighbor[i]:text)%128; else offset=(offset+neighbor[i]:text)%128; } offset = 128-offset; text = (text +offset)^ value; }