Let's start from the top.
1. Too many global variables.
2. No indentation and lack of whitespace make this code unreadable.
3. Using goto. You really need to learn to use one of the more accepted loop constructs.
4. Putting multiple statements on one line. This makes following the logic of the program impossible. Put each statement on a line of it's own.
if(action==23){if(b1ct<b1mt){if(b4ct>0){if(b4ct<=(b1mt-b1ct)){b1ct=b4ct+b4ct; b4ct=0; actioncount=actioncount+1;movelist+="4 to 1\n";};if(b4ct>(b1mt-b1ct)){b4ct=b4ct-(b1mt-b1ct); b1ct=b1mt; actioncount=actioncount+1;movelist+="4 to 1\n";};}; };};// 23 4 to 1
Should be more like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
if(action == 23)
{
if(b1ct < b1mt)
{
if(b4ct > 0)
{
if(b4ct <= (b1mt - b1ct))
{
b1ct = b4ct + b4ct;
b4ct = 0;
actioncount = actioncount + 1;
movelist += "4 to 1\n";
}; // These semicolons are unneeded and will cause an error with some compilers.
if(b4ct > (b1mt - b1ct))
{
b4ct = b4ct - (b1mt - b1ct);
b1ct = b1mt;
actioncount = actioncount + 1;
movelist += "4 to 1\n";
};
};
};
};// 23 4 to 1
|
5. Lack of helper functions. Functions should be your friends.
6. Use of "magic numbers" (23) in the above snippet.
7. Variables with numbers added (b4ct, b5ct, b3ct, etc) suggest that you should consider std::vector or arrays.
8. Cryptic variable names. Using meaningful variable and function names will make you program much easier to read and understand.
Fixing the above issues should get you started in the right direction.