This is precisely why I say you've got a SOFTWARE problem, not a HARDWARE problem. You can't escape not fixing the software problem because next you'll try to do something really innovative like implementing an photovore algorithm or an object avoidance algorithm and that would require your wheels to spin under software control! At times you might want one wheel to stay put while the other rotates forward, at other times you might want both wheels to rotate in the same direction or you might want your wheels to rotate in opposite directions!
Changing the two wires on the motor doesn't fix your software, it just makes it insignificantly easier to write your software. If the help you get from changing the two wires on the motors would be significant you'd see people doing it all the time - but you don't see that!
Unfortunately I can't help you with your software problem because I don't know what you're using. It appears to be Roboduino code but I'm not sure - and I don't "speak" roboduino
- but I strongly suggest fixing the software, not the hardware.