Solving FIFA's 2014 Points Allocation Algorithm with Pseudocode

  • Thread starter Thread starter Travian
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around designing an algorithm in pseudocode for allocating points to teams based on match results in FIFA's 2014 World Cup format. Participants explore the conditions under which points are awarded for wins, draws, and outcomes involving penalty shootouts.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant presents a pseudocode algorithm for point allocation based on match results, including conditions for wins, draws, and penalty shootouts.
  • Another participant questions the clarity of the algorithm, suggesting that the sequence of asking for penalty shootout results and goals may be incorrect.
  • Some participants assert that the number of goals scored determines the winner, while others express uncertainty about the handling of draws and penalty shootouts in the algorithm.
  • A participant proposes a revised structure for the algorithm that prioritizes checking for a penalty shootout before determining the winner based on goals scored.
  • Concerns are raised about the algorithm's failure to account for draws adequately, with suggestions for how to incorporate this condition.
  • One participant acknowledges a misunderstanding regarding the treatment of penalty shootout goals and the implications for point allocation.
  • Another participant provides additional context about the rules of soccer, particularly regarding how knockout competitions handle ties and the role of penalty shootouts.

Areas of Agreement / Disagreement

Participants express differing views on the correctness of the original algorithm, with some agreeing on the need for adjustments while others remain uncertain about specific aspects, particularly regarding penalty shootouts and draws. No consensus is reached on the final algorithm structure.

Contextual Notes

Limitations include potential misunderstandings about soccer scoring rules, the need for clarity in the sequence of input prompts, and unresolved details regarding the handling of draws and penalty shootouts in the algorithm.

Travian
Messages
64
Reaction score
0

Homework Statement


In 2014 Fifa (the world governing body for international football) would like to revise the way teams are allocated points for the group stage of the World Cup as shown below:

Result Points
Win 3
Draw 1
Lose 0
Win (with penalty shootout) 2
Lose (with penalty shootout) 1

Design an algorithm using pseudocode that analyses the result of a match and awards points to the two teams accordingly.


Homework Equations





The Attempt at a Solution



Algorithm
Code:
Declare firstTeamGoals, secondTeamGoals, firstPen, secondPen as integer
Write “Please enter first team amount of goals”
Get firstTeamGoals ;
Write “Please enter second team amount of goals”
Get secondTeamGoals ;
IF (firstTeamGoals > secondTeamGoals) THEN
     Write “First team receives 3 points and second team receives 0 points”
ELSEIF (firstTeamGoals < secondTeamGoals) THEN
     Write “First team receives 0 points and Second team receives 3 points”
ELSE
IF (firstTeamGoals == secondTeamGoals)
     Write “Please input the number of scored penalties (first team)”
     Get firstPen ; 
     Write “Please input the number of scored penalties (second team)”
     Get secondPen ;
     IF (firstPen > secondPen) THEN
          Display “First team receives 2 points and second team receives 1 point”
     ELSE
          Display “First team receives 1 point and second team receives 2 points”
     ENDIF
ENDIF
ENDIF

I just want someone to confirm is this right. If not - where's the problem. Thank you.
 
Physics news on Phys.org
I'm no expert in soccer/futbol, but when you ask for "number of goals" and then ask for "number of penalty points", I don't think that's correct for this problem. It seems like you should ask if the game was won with a tie-breaking shootout first, and if the answer is no, then ask for the final score. I think "penalty kicks" are different from the tie-breaking shootout. Guess I should learn more about soccer :blushing:
 
Well the number of goals scored determines the winner. Isnt that right?
 
I don't know enough about soccer (as we in the US call it) to know if your algorithm is correct, particularly the part about the penalty shootouts (or even what that means).

Having said that, I don't think your algorithm is correct, since it doesn't seem to take draws into consideration.

I would think the algorithm would need to see if there was a penalty shootout first.

if (penalty shootout is true) then award 2 pts to winner and 1 pt to loser
otherwise if there is a winner, then award 3pts to winner and 0 pts to loser
otherwise award 1 pt to each team
 
Correct, but I think that includes the tie-breaking shootout goals. Your code above seems to assume that you will be given a tie score if there was a shootout after the tie. I apologize if I'm not interpreting the question or misunderstanding how soccer is scored.
 
Result Points
Win 3
Draw 1
Lose 0
Win (with penalty shootout) 2
Lose (with penalty shootout) 1

This is what the exercise says. You cannot receive 0 points if you loose after penalty shootout.

And yes, i think i missed the part where extra time commences.
 
Better information from wikipedia.org:

http://en.wikipedia.org/wiki/Soccer

wikipedia said:
In league competitions, games may end in a draw, but in some knockout competitions if a game is tied at the end of regulation time it may go into extra time, which consists of two further 15-minute periods. If the score is still tied after extra time, some competitions allow the use of penalty shootouts (known officially in the Laws of the Game as "kicks from the penalty mark") to determine which team will progress to the next stage of the tournament. Goals scored during extra time periods count toward the final score of the game, but kicks from the penalty mark are only used to decide the team that progresses to the next part of the tournament (with goals scored in a penalty shootout not making up part of the final score).

So I guess the tie-breaker shootout goals are handled differently.
 

Similar threads

  • · Replies 26 ·
Replies
26
Views
6K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 45 ·
2
Replies
45
Views
18K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
9
Views
9K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K