I'm making a rock paper scissors game, and in this game there is a nested for loop so that the players challenge each other, the outer loop is supposed to loop through all the players starting with player 1, while the inner loop starts at the last player and moves to the outer loop player, this sounds simple enough but for some reason the loop I am trying to use doesn't work. Here is what the loop looks like:
for (j = 0; j < playerNum; j++)
{
for (k = (playerNum - 1); k > j; k--)
{
if(j == k)
{
continue;
}
players[j].challenge(players[k]); // challenge player[j] with player[k]
/* Save current player's results to gameResults total.
* Put each player result on a new line.
*/
gameResults += players[j].getWins() + "\n";
}
}