While your approach may be clever - then again, maybe TOO clever - it is not easy to understand or troubleshoot. I suggest you simplify the part of your program that chooses which value of the next...