I have this code and it works fine when there are three consecutive values (i.e. false, false, false, true OR true, true, true, false) but when I put non-c