Does this even compile? I see a lot of problems that the compiler *should* complain about.
But your problem is with this statement:

if(tri = true){...
}
else if(tri = false)...


A...