Problem with if statement controlling 8x8 matrix

placed ; after second if statement, still switches between 0 and 1. ?