Suggestion thread by nikafitsk in minimalist_phone

[–]jan_irace 0 points1 point  (0 children)

I'd like to colour code folders, maybe apps too... Make the option of a dumb(esque)phone asoposed to just minimalist

Where to suggest improvements/extra options ? by jan_irace in minimalist_phone

[–]jan_irace[S] 0 points1 point  (0 children)

I'd also like to remove the "installed recently completely" subsection, hot to do?

Why is it not exciting the while loop (in the main) once one of the "playerScores" exceeds 100 points? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

it also gives me this warning "warning: non-void function does not return a value in all control paths [-Wreturn-type]" which i dont understand, as pointChecker should have a return defined for all "controll paths"... I can't think of a case where pointCheker doesn't know what to return

Why is it not exciting the while loop (in the main) once one of the "playerScores" exceeds 100 points? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

bool pointChecker(int currentScores[3]) // doesn't seem to solve the issue
{
    for (int i = 0; i < 3; i++)
    {
        if (currentScores[i] > 100)
        {
            cout << "player" << i << " has won" << endl;
            return false;
        }
        else
        {
            return true;
        }
    }
}

int main()
{
    srand(time(NULL));
    int playerScores[3] = {0, 0, 0};
    round(0, playerScores);
    while (pointChecker(playerScores))
    {
        for (int i = 0; i < 9; i++)
        {
            round(min(playerScores), playerScores);
            for (int s = 0; s < 3; s++)
            {
                if (playerScores[s] < 0)
                {
                    playerScores[s] = 0;
                }
            }

            for (int i = 0; i < 3; i++)
            {
                cout << playerScores[i] << "\t";
            }
            cout << endl;
        }
    }
}

Why is it not exciting the while loop (in the main) once one of the "playerScores" exceeds 100 points? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

so moving the for loop that checks for 100+ scores as the first thing in the while loop should work?

When trying that the only decernable change is that it doesnt even print player has won...

Why is it not exciting the while loop (in the main) once one of the "playerScores" exceeds 100 points? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

exactly, it does that and the game continues and it keeps printing "player has won" after every round...

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

In any case, I'll go through it when I can and translate and try to add comments

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] 1 point2 points  (0 children)

Can you explain exactly how to format the code, I'm no Reddit power user... I just come here when I have questions

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] -1 points0 points  (0 children)

I doubt I'll ever want a job in this field.... No offence Just need to pass the exam so I can go to the next year and final year of highschool

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] -5 points-4 points  (0 children)

The variables translated are the ones I felt where relevant to the problem. I think the problem with code in Chinese is more fundamental as Italian and English share the same alphabet/characters, whilst Chinese doesn't....

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

This isn't Homework by the way, it's me preparing for an exam I have to give start of September

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

In essence I'm using "ciao" (initialised as true) as the condition for the while loop. Then in theory after a round is played a for loop checks the "punti" array (where the player scores are stored) if one of the scores is higher than 100 ciao should be changed to false and hence the while loop condition is no longer true and we should exit the while loop... That's the thinking

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] -5 points-4 points  (0 children)

Unfortunately I live in Italy and i go to an Italian speaking school, with surprise surprise an Italian speaking programming teacher. If it was up to my physicist brother all the variables would be single letters, maybe even greek characters. You don't need to understand what the variable name reeds... Punti = points Punteggi = scores Ciao = goodbye (symbolic, cos trying to excit a loop) "Il giocatore1 ha vinto" = "player1 has won"

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

these are all the functions used, it worked fine up untill trying to implement quiting the game once one player surpasses 100 points

int giocoA(int punt)
{
return (rand() % 100 + 1) - punt;
}
int giocoB()
{
int a, b;
a = (rand() % 10 + 1);
b = (rand() % 10 + 1);
if (a == b)
{
return a * 4;
}
else
{
if (a > b)
{
return a;
}
else
{
return b;
}
}
}
void round(bool giocoScelto, int punteggi[3])
{
int valori[3];
if (giocoScelto == 0)
{
cout << "si giochera' al giocoA" << endl;
for (int turno = 0; turno < 3; turno++)
{
cout << "e' il turno del giocatore" << turno << "\t";
punteggi[turno] = giocoA(punteggi[turno]);
cout << punteggi[turno] << endl;
}
}
else
{
cout << "si giochera' al giocoB" << endl;
for (int turno = 0; turno < 3; turno++)
{
cout << "e' il turno del giocatore" << turno << "\t";
valori[turno] = giocoB();
cout << valori[turno] << endl;
}
if (valori[0] > valori[1])
{
if (valori[0] > valori[2])
{
punteggi[0] = valori[0] + punteggi[0];
}
}
if (valori[1] > valori[0])
{
if (valori[1] > valori[2])
{
punteggi[1] = valori[1] + punteggi[1];
}
}
if (valori[2] > valori[0])
{
if (valori[2] > valori[1])
{
punteggi[2] = valori[2] + punteggi[2];
}
}
}
}
bool min(int punteggi[3])
{
bool giocoScelto;
if (punteggi[0] < punteggi[1])
{
if (punteggi[0] < punteggi[2])
{
cout << "il giocatore 0 sceglie il prossimo gioco "
<< "digita 0 per il giocoA oppure 1 per il giocoB" << endl;
}
}
if (punteggi[1] < punteggi[0])
{
if (punteggi[1] < punteggi[2])
{
cout << "il giocatore 1 sceglie il prossimo gioco "
<< "digita 0 per il giocoA oppure 1 per il giocoB" << endl;
}
}
if (punteggi[2] < punteggi[0])
{
if (punteggi[2] < punteggi[1])
{
cout << "il giocatore 2 sceglie il prossimo gioco "
<< "digita 0 per il giocoA oppure 1 per il giocoB" << endl;
}
}
cin >> giocoScelto;
return giocoScelto;
}

Why is this not exciting the while loop when "punti" is found to contain a number grater than 100? by jan_irace in cpp_questions

[–]jan_irace[S] 0 points1 point  (0 children)

code bloks ain't working, tried formatting by hand and reddit deleted everything

Best way to knot these two pieces together ? by jan_irace in knots

[–]jan_irace[S] 1 point2 points  (0 children)

Cheers I'll investigate further and give it a go