Advanced level 2024 North West mock computer science 3
Advanced level 2024 North West mock computer science 3
Project Role and Rcipomlbilltle* t do the following: | ||
You arc expected us part of the project tr . implement a module that will alio*‘‘ qualified. • Implement n module that |
(0 enter the names of qualified teams in the order in which they | ‘ |
Will | ||
fixtures for the qualified teams, and prim them for |
• Implement a module Ihnt w*
publishing to the public.
dr–wing up fixture., before the star, of the compe,i,i„„ and^
i
the qualified leums ,
Came Fixture? .
Assumption: Only 12 teams can participate and the order m
information will be stored in a dotn structure with the name QUALIFY .
QlllJitl45lJ«fllM.tJLQJil«
I
in which they qualified is shown in the figure below. This
Man Cameroon Guinea 11 12 |
[counlnelj [n dices^] jvoryCoait — |
Morocco Algorfo | Zambia |
1 | 2 | 3 | 4 |
Ghana Sonogal i Tunisia 0 Egypt 7 3 Nigeria 9 10 t Figure 1
NB: write Ivory Coast as IvoryCoast for simplicity.
To draw up the fixtures, 12 unique random numbers [7 to 12\ should be generated and stored as shown in the figure
below. The numbers (random numbers) indicated arc not the same as those your program will generate. This
information will be stored in a data structure with the name “GROUP”.
This means that, once a number is generated randomly, it must be verified that the number does not already exist in
the data structure “GROUP” before it can be stored. The algorithm in figure 3 can be used for this.
Random | 10 |
Numbers |
3
5 11 Index
Figure 2
The fixtures shall have THREE Groups with FOUR Teams in each group.
The 2 gives logic GROUP of the grouping A(headeris*that * GROUP the random A **)numbers , while the ^ ,next 5, 12four , l] in gives the GROUP first fourBindex [header positions .** GROUP [1, 2, 3B, 4*]*offigure ), and the
last four gives GROUP C( header: ** GROUP A **).
To select the countiies for a group, pick a random number from figure 2, compare it with all the indices in figure I.
If they correspond, then the team in figure lat that index position is added to the group. The skeleton pseudocode
below can be implemented for generating random numbers and for printing the group fixtures.
12 Unique Random numbers generation | FORi «– l to 12 do Flint group(s) header based on appropriate condition |
(le if i = 1 or if i = 5 or if i = 9)
FOfcj «–\ to 12 do
IF 1 5
*4 and GROUP[i] =j{
print the teams \n the group, & go to next line. }
ELSE lFi <8 andOROUP[i] = j{
print the teams inthe group, & go to next line.
ELSE IF i <« 12 and GROU?[i] = j {
print the teams in the gro^, & g0 to next line.
FORi l to 12 do
Generate between 1 & 12. store in N
/ = 1– 1
not
IF GROUP\j ] = N THEN
Generate between 1 & 12, store in N
set J to i — 1
HUE
set j to /– 1
END IF
UNTIE j «• 1