Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.4 kB
3
Indexable
Never
#include <iostream>

using namespace std;

int main()
{
    int area, num = 0;
    char opr;
    int abToMove[4] = { 0,0,0,0 };
    int player[4] = {0,0,0,0};
    cin >> area;
    int i = 0;
    while (player[0] < area || player[1] < area || player[2] < area || player[3] < area)
    {
        cin >> opr;
        if (opr == 'P')
        {
            for (int j = 0; j < 4; j++)
                cout << player[j] << " ";
            cout << endl;
            continue;
        }
        cin >> num;
        if (opr == 'M')
        {
            if (abToMove[i] == 0)
            {
                if (num == 1)
                {
                    abToMove[i]++;
                    //cout << abToMove[i] << endl;
                }
            }
            else if (abToMove[i] == 1)
            {
                if (num == 6)
                {
                    abToMove[i]++;
                    //cout << abToMove[i] << endl;
                }
                else
                    abToMove[i] = 0;
            }
            else if (abToMove[i] == 2)
            {
                player[i] += num;
                //cout << player[i] << " " << area << endl;
            }
        }
        else
            continue;

        if (i < 3)
            i++;
        else
            i = 0;
    }
    cout << "END OF GAME" << endl;
}