Solving FIFA's 2014 Points Allocation Algorithm with Pseudocode

  • Thread starter Travian
  • Start date
In summary: So I guess your code looks OK to me, but I don't understand soccer that well. I guess you will have to wait for a soccer expert. Sorry.In summary, an algorithm was designed using pseudocode to analyze the result of a soccer match and award points to the two teams accordingly. The algorithm takes into consideration if the game was won with a tie-breaking shootout, and if so, awards 2 points to the winner and 1 point to the loser. If there is a clear winner without a shootout, 3 points are awarded to the winning team and 0 points to the losing team. In the case of a draw, the algorithm prompts for the number of goals scored in the tie-breaking shootout and awards
  • #1
Travian
64
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
  • #2
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:
 
  • #3
Well the number of goals scored determines the winner. Isnt that right?
 
  • #4
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
 
  • #5
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.
 
  • #6
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.
 
  • #7
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.
 

Related to Solving FIFA's 2014 Points Allocation Algorithm with Pseudocode

1. What is FIFA's 2014 Points Allocation Algorithm?

FIFA's 2014 Points Allocation Algorithm is a mathematical formula used to determine the points earned by a team in the FIFA World Cup based on the outcome of their matches. It takes into account the strength of the opponent, the result of the match, and the stage of the tournament.

2. Why is it important to solve FIFA's 2014 Points Allocation Algorithm?

Solving FIFA's 2014 Points Allocation Algorithm allows for a better understanding of how points are awarded in the FIFA World Cup and can help teams strategize and optimize their performance in the tournament.

3. What is pseudocode and how is it used in solving FIFA's 2014 Points Allocation Algorithm?

Pseudocode is a simplified version of a programming language that uses plain English to outline the steps of an algorithm. It is used in solving FIFA's 2014 Points Allocation Algorithm as a way to break down the complex formula into smaller, more manageable steps.

4. Can the algorithm be solved using different programming languages?

Yes, the algorithm can be solved using different programming languages as long as the pseudocode accurately represents the steps of the algorithm. However, some programming languages may be better suited for solving this type of mathematical problem.

5. How can solving FIFA's 2014 Points Allocation Algorithm benefit the game of football?

Solving FIFA's 2014 Points Allocation Algorithm can benefit the game of football by providing a fair and transparent way to award points in the FIFA World Cup. It also allows for a better understanding of the tournament and can help improve the overall competitiveness and excitement of the game.

Similar threads

Replies
4
Views
694
  • Engineering and Comp Sci Homework Help
Replies
26
Views
5K
  • General Discussion
Replies
5
Views
765
  • Engineering and Comp Sci Homework Help
2
Replies
45
Views
16K
  • General Discussion
Replies
13
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Programming and Computer Science
Replies
4
Views
637
  • Engineering and Comp Sci Homework Help
Replies
2
Views
8K
Back
Top