mardi 1 décembre 2020

Loose a game by a margin of points or fewer to earn an extra point

I've created a if statement for a function to print scores for a game. I cannot for the life of me figure the logic behind this. I'm adding an extra points if teamA has lost the game from teamB by a margin of 3 points, teamA gains an extra point.

This is my code

if(teamAGoals <= (teamBGoals - 3)) {
         home.setpoint(home.getpoint()+1);
     }
     else if(teamBGoals <= (teamAGoals - 3)) {
         away.setpoint(away.getpoint()+1);
     }

Aucun commentaire:

Enregistrer un commentaire