You have to add this into your program.
Monday, 28 March 2011
add to cricket program
If " OUT" batsman has the right to refer the decision to an third umpire and the and the this could overturn the decision. The batsman has only one referral
You have to add this into your program.
You have to add this into your program.
Tuesday, 22 March 2011
Thursday, 17 March 2011
advice
General Certificate of Education
Advanced Subsidiary Examination
June 2011
Computing COMP1/AD
Unit 1 Problem Solving, Programming, Data Representation
and Practical Exercise
Advice on using the COMP1 Electronic Answer Document
1 (EAD)Centres may give a copy of this Advice document to candidates at any time, including during
the examination.
The Electronic Answer Document is provided by AQA to centres as a Microsoft
document. Candidates must type their answers to the COMP1 question paper into the EAD
on-screen.
® Word (2003)1
Taken from Appendix 1 of the Teachers' Notes (COMP1/TN)M/Jun11/COMP1/Advice
COMP1/Advice2
M/Jun11/COMP1/Advice
A In advance of the examination
subsequent pages they may use) may be completed in advance of the examination and
saved to the individual candidate’s user area of the secure network. If candidates are
to complete the EAD in this way, the centre is responsible for ensuring that no other
information is typed into the EAD in advance of the examination.
Candidates’ details on the front cover and in the footer of page 2 (and therefore any
– where they are to save the work they do during the examination
– what file format to use
– the name format in which to save their work
– about the role of the Print Monitor
– how to re-size a screen capture (screen dump/screen shot) to ensure the examiner
can read it with ease.
Centres must ensure that candidates know:
but centres are strongly encouraged to ensure that their candidates are familiar with the
EAD before the examination. Candidates are free to practice using
examination.
The COMP1 examination is not a test of candidates’ typing or word processing skills,a copy of it before theB What to do if the EAD fails for any reason
inappropriate places, check whether the margin size on the default printer needs
reducing. The margins used for the original Electronic Answer Document are: Top - 2 cm;
Bottom - 2.5 cm; Left 2 cm; Right - 2 cm.
When printing the Electronic Answer Document, if it appears to have page breaks in
printed out.
If your centre’s word processing software is not compatible with Microsoft
centres should ask candidates to type their answers into a blank document ensuring that the
Do not be concerned if the AQA logo does not appear or is mis-shapen when the EAD is® Word (2003),front page prominently
– GCE Computing, COMP1 examination, Summer + year of examination
– Centre Number
– Candidate Name
– Candidate Number
– at the end of the examination, the candidate’s signature.
carries the following information:Each subsequent page must also
in a footer (either typed in or written by hand):
– Centre Number
– Candidate Name
– Candidate Number.
Each answer
a staple or tie in the top left hand corner.
carry the following personal information of the candidatemust be clearly numbered. All pages must be securely attached together withTurn over
3
M/Jun11/COMP1/Advice
C Using screen captures (screen dumps/shots) in the EAD
Paste the screen capture into a cell of the EAD.
1. select the cell in which the screen capture appears
2. double click to bring up the picture editor dialogue box called ‘Format Picture’
3. select the ‘Layout’ tab
4. select the ‘In Front of Text option’
5. press ‘OK’ and go back to your EAD cell
6. expand the cell in the EAD by pressing the return key on your keyboard enough
times until the cell is big enough to show the whole screen capture. Crop the screen
capture if necessary, but ensure the examiner will be able to read it easily.
If only part of the capture shows up in the cell:
1. paste any screen capture into a blank Word document and save it using a suitable
filename
2. print this document with a footer containing the Centre Number, Candidate Name and
Candidate Number (or write them on by hand after printing)
3. insert the question part number
4. attach to the printed EAD in the relevant place leaving a reference in the
corresponding cell of the EAD to advise the examiner to look for a supplementary
handout containing a screen capture.If the above should fail, candidates should be advised to:
dice cricket
General Certificate of Education
Advanced Subsidiary Examination
June 2011
Computing COMP1/PM
Unit 1 Problem Solving, Programming, Data Representation
and Practical Exercise
Preliminary Material
To be given to candidates on or after Tuesday 1 March 2011, subject to the instructions
given in the
Teachers' Notes (COMP1/TN).Information
This Preliminary Material comprises–
Instructions to Candidates–
a Data File.
Preliminary Material.
A Skeleton Program is provided separately by your teacher and must be read in conjunction with this
Program before the examination.
Candidates are advised to familiarise themselves with the Preliminary Material and Skeleton
be given access to the Skeleton Program electronically at the start of the examination. You must
This Preliminary Material will be made available to you again in the examination. You will alsonot
examination room.
take any copy of the Preliminary Material, Skeleton Program or any other material into theM/Jun11/COMP1/PM
COMP1/PM2
M/Jun11/COMP1/PM
Instructions for Candidates
The question paper is divided into four sections and a recommendation is given to candidates as to
how long to spend on each section. Below are the recommended timings for the 2011 examination.
Section A
You are advised to spend no more than
Questions will examine the specification content
30 minutes on this section.not specific to the Preliminary Material.Section B
You are advised to spend no more than
You will be asked to create a new program
Program
20 minutes on this section.not related to the Preliminary Material or Skeleton.Section C
You are advised to spend no more than
Questions will refer to the
programming.
20 minutes on this section.Preliminary Material and the Skeleton Program, but will not requireSection D
You are advised to spend no more than
Questions will use the the
50 minutes on this section.Skeleton Program and the Preliminary Material and may require theHiScores.txt Data File
.Electronic Answer Document
Answers to questions for all four sections must be entered into the word processed document made
available to you at the start of the examination and referred to in the question paper rubrics as the
Electronic Answer Document
.Preparation for the Examination
You should ensure that you are familiar with this
For the Skeleton Program for your programming language, you should be familiar with:
Preliminary Material and the Skeleton Program.
types
the built-in functions available for manipulating string data and converting strings to other data
file handling commands for CSV (Comma Separated Variable) files
declaring and using arrays.Turn over
3
M/Jun11/COMP1/PM
Dice Cricket Game
The
simple game based on the sport of cricket.
When playing Dice Cricket, players use two special dice called the Bowl Die
The Bowl Die is a 6-sided die where, instead of the numbers 1 to 6, the sides have "0", "1", "2", "4",
"6", and "OUT" written on them. The player whose turn it is rolls the Bowl Die. If the result is one
of the numeric values then this is added to their score (the number of
continue to roll the Bowl Die until "OUT" is rolled. If the result is "OUT" then they roll the Appeal Die
to see what happens next.
The Appeal Die is a 4-sided die where the numbers 1 to 4 have been replaced with different values.
The values on the Appeal Die are "NOT OUT", "CAUGHT", "LBW" and "BOWLED". If when a
player rolls the Appeal Die they get a result of "NOT OUT" then their turn continues and they can
roll the Bowl Die again. Any other result on the Appeal Die means that they are out and their turn
finishes. When player one's turn is over player two has their turn. When player two is out the two
players' scores are compared and the winner is the one with the highest score.
In the
used then the two players have actually got a Bowl Die and an Appeal Die and enter the values they
roll into the program. If virtual dice are used then the program simulates the rolling of the Bowl Die
and Appeal Die by generating random numbers. There are 6 different values on the Bowl Die and 4
different values on the Appeal Die.
The
players playing Dice Cricket. After each game the scores of the two players are compared with the
previous top scores. The winner's details, if their score is higher, will replace those of the player
with the lowest top score. The loser's details, if their score is high enough, could also replace one of
the previous player’s details. If the winning player’s score is the same as the lowest top score their
details are not stored. If a game is drawn with a score lower than three of the top four scores then
only player one’s details will be stored.
In the
Skeleton Program is a program for the two-player game of Dice Cricket. Dice Cricket is a1 and the Appeal Die.runs they have got) and theySkeleton Program players can choose to play with real dice or virtual dice. If real dice areSkeleton Program also stores the names and scores of the four highest results obtained bySkeleton Program there is a menu containing five options:
Play game version with virtual dice
Play game version with real dice
Load top scores
Display top scores
If the user chooses to load top scores from a file then the file
contents placed in the array
QuitHiScores.txt is opened and theTopScores.The Data File
Ricky,12
Sachin,45
Brian,2
Monty,1
The data file
HiScores.txt will be available to you at the start of the examination.1
Dice is the plural of the word die.4
M/Jun11/COMP1/PM
Variables
Some of the variables used are:
Identifier Data Type Purpose
TopScores Array[1..4]
of Record
This is an array of records. Each
record stores the details about one of
the top four scores. A record consists
of a
name (string data type) and ascore
(integer data type)PlayerOut Boolean
not
Used to indicate if a player is out orCurrentPlayerScore Integer
the current player has accumulated
Used to store the number of runs thatPlayerNo Integer
player two's turn
Used to indicate if it is player one's orNotes
The programming language used to code the game will determine the letter case for each identifier
and so may not match exactly the identifiers shown in the table above.
Your chosen programming language may use arrays with a lower bound value of 0. If so, position 0
will not have been used.
Tuesday, 15 March 2011
Skeleton Program code for the AQA COMP1 Summer 2011
Program DiceCricket;
{Skeleton Program code for the AQA COMP1 Summer 2011 examination
this code should be used in conjunction with the Preliminary Material
written by the AQA COMP1 Programmer Team developed in the
Free Pascal IDE for Win32 v1.0.10 programming environment}
{Centres using Delphi should add the compiler directive that sets
the application type to Console (other centres can ignore this
comment). Centres may also add the SysUtils library if their
version of Pascal uses this}
{Permission to make these changes to the Skeleton Program does not
need to be obtained from AQA/AQA Programmer - just remove the \ symbol from
the next line of code and remove the braces around Uses SysUtils;}
{\$APPTYPE CONSOLE}
{Uses
SysUtils;}
Const MaxSize = 4;
Type TTopScore = Record
Name : String;
Score : Integer;
End;
TTopScores = Array[1..MaxSize] Of TTopScore;
Var
TopScores : TTopScores;
PlayerOneName : String;
PlayerTwoName : String;
OptionSelected : Integer;
Procedure ResetTopScores(Var TopScores : TTopScores);
Var
Count : Integer;
Begin
For Count := 1 To MaxSize
Do
Begin
TopScores[Count].Name := '-';
TopScores[Count].Score := 0;
End;
End;
Function GetValidPlayerName : String;
Var
PlayerName : String;
Begin
Repeat
Readln(PlayerName);
If PlayerName = ''
Then Write('That was not a valid name. Please try again: ');
Until PlayerName <> '';
GetValidPlayerName := PlayerName;
End;
Procedure DisplayMenu;
Begin
Writeln;
Writeln('Dice Cricket');
Writeln;
Writeln('1. Play game version with virtual dice');
Writeln('2. Play game version with real dice');
Writeln('3. Load top scores');
Writeln('4. Display top scores');
Writeln('9. Quit');
Writeln;
End;
Function GetMenuChoice : Integer;
Var
OptionChosen : Integer;
Begin
Write('Please enter your choice: ');
Readln(OptionChosen);
If (OptionChosen < 1) Or ((OptionChosen > 4) And (OptionChosen <> 9))
Then
Begin
Writeln;
Writeln('That was not one of the allowed options. Please try again: ');
End;
GetMenuChoice := OptionChosen;
End;
Function RollBowlDie(VirtualDiceGame : Boolean) : Integer;
Var
BowlDieResult : Integer;
Begin
If VirtualDiceGame
Then BowlDieResult := Random(6) + 1
Else
Begin
Writeln('Please roll the bowling die and then enter your result.');
Writeln;
Writeln('Enter 1 if the result is a 1');
Writeln('Enter 2 if the result is a 2');
Writeln('Enter 3 if the result is a 4');
Writeln('Enter 4 if the result is a 6');
Writeln('Enter 5 if the result is a 0');
Writeln('Enter 6 if the result is OUT');
Writeln;
Write('Result: ');
Readln(BowlDieResult);
Writeln;
End;
RollBowlDie := BowlDieResult;
End;
Function CalculateRunsScored(BowlDieResult : Integer) : Integer;
Var
RunsScored : Integer;
Begin
Case BowlDieResult Of
1 : RunsScored := 1;
2 : RunsScored := 2;
3 : RunsScored := 4;
4 : RunsScored := 6;
5, 6 : RunsScored := 0;
End;
CalculateRunsScored := RunsScored;
End;
Procedure DisplayRunsScored(RunsScored : Integer);
Begin
Case RunsScored Of
1 : Writeln('You got one run!');
2 : Writeln('You got two runs!');
4 : Writeln('You got four runs!');
6 : Writeln('You got six runs!');
End;
End;
Procedure DisplayCurrentPlayerNewScore(CurrentPlayerScore : Integer);
Begin
Writeln('Your new score is: ', CurrentPlayerScore);
End;
Function RollAppealDie(VirtualDiceGame : Boolean) : Integer;
Var
AppealDieResult : Integer;
Begin
If VirtualDiceGame
Then AppealDieResult := Random(4) + 1
Else
Begin
Writeln('Please roll the appeal die and then enter your result.');
Writeln;
Writeln('Enter 1 if the result is NOT OUT');
Writeln('Enter 2 if the result is CAUGHT');
Writeln('Enter 3 if the result is LBW');
Writeln('Enter 4 if the result is BOWLED');
Writeln;
Write('Result: ');
Readln(AppealDieResult);
Writeln;
End;
RollAppealDie := AppealDieResult;
End;
Procedure DisplayAppealDieResult(AppealDieResult : Integer);
Begin
Case AppealDieResult Of
1 : Writeln('Not out!');
2 : Writeln('Caught!');
3 : Writeln('LBW!');
4 : Writeln('Bowled!');
End;
End;
Procedure DisplayResult(PlayerOneName : String; PlayerOneScore : Integer;
PlayerTwoName : String; PlayerTwoScore : Integer);
Begin
Writeln;
Writeln(PlayerOneName, ' your score was: ', PlayerOneScore);
Writeln(PlayerTwoName, ' your score was: ', PlayerTwoScore);
Writeln;
If PlayerOneScore > PlayerTwoScore
Then Writeln(PlayerOneName, ' wins!');
If PlayerTwoScore > PlayerOneScore
Then Writeln(PlayerTwoName, ' wins!');
Writeln;
End;
Procedure UpdateTopScores(Var TopScores : TTopScores; PlayerName : String;
PlayerScore : Integer);
Var
LowestCurrentTopScore : Integer;
PositionOfLowestCurrentTopScore : Integer;
Count : Integer;
Begin
LowestCurrentTopScore := TopScores[1].Score;
PositionOfLowestCurrentTopScore := 1;
{Find the lowest of the current top scores}
For Count := 2 To MaxSize
Do
If TopScores[Count].Score < LowestCurrentTopScore
Then
Begin
LowestCurrentTopScore := TopScores[Count].Score;
PositionOfLowestCurrentTopScore := Count;
End;
If PlayerScore > LowestCurrentTopScore
Then
Begin
TopScores[PositionOfLowestCurrentTopScore].Score := PlayerScore;
TopScores[PositionOfLowestCurrentTopScore].Name := PlayerName;
Writeln('Well done ', PlayerName, ' you have one of the top scores!');
End;
End;
Procedure DisplayTopScores(TopScores : TTopScores);
Var
Count : Integer;
Begin
Writeln('The current top scores are: ');
Writeln;
For Count := 1 To MaxSize
Do Writeln(TopScores[Count].Name, ' ', TopScores[Count].Score);
Writeln;
Writeln('Press the Enter key to return to the main menu');
Readln;
End;
Procedure LoadTopScores(Var TopScores : TTopScores);
{Centres using older versions of Pascal might need to delete the line that
uses StrToInt and use the two alternative lines in braces. Permission to
make these changes does not need to be obtained from AQA/AQA Programmer.}
Var
Count : Integer;
Count2 : Integer;
{Err : Integer;}
LineFromFile : String;
ValuesOnLine : Array[1..2] Of String;
CurrentFile : Text;
Begin
Assign(CurrentFile, 'HiScores.txt');
Reset(CurrentFile);
For Count := 1 To MaxSize
Do
Begin
ValuesOnLine[1] := '';
ValuesOnLine[2] := '';
Readln(CurrentFile, LineFromFile);
Count2 := 1;
Repeat
ValuesOnLine[1] := ValuesOnLine[1] + LineFromFile[Count2];
Count2 := Count2 + 1;
Until LineFromFile[Count2] = ',';
Count2 := Count2 + 1;
Repeat
ValuesOnLine[2] := ValuesOnLine[2] + LineFromFile[Count2];
Count2 := Count2 + 1;
Until Count2 > Length(LineFromFile);
TopScores[Count].Name := ValuesOnLine[1];
TopScores[Count].Score := StrToInt(ValuesOnLine[2]);
{Val(ValuesOnLine[2],TopScores[Count].Score, Err);}
End;
Close(CurrentFile);
End;
Procedure PlayDiceGame(PlayerOneName, PlayerTwoName : String;
VirtualDiceGame : Boolean; Var TopScores : TTopScores);
Var
PlayerOut : Boolean;
CurrentPlayerScore : Integer;
AppealDieResult : Integer;
PlayerNo : Integer;
PlayerOneScore : Integer;
PlayerTwoScore : Integer;
BowlDieResult : Integer;
RunsScored : Integer;
Begin
For PlayerNo := 1 To 2
Do
Begin
CurrentPlayerScore := 0;
PlayerOut := False;
If PlayerNo = 1
Then Writeln(PlayerOneName, ' is batting')
Else Writeln(PlayerTwoName, ' is batting');
Writeln;
Writeln('Press the Enter key to continue');
Readln;
Repeat
BowlDieResult := RollBowlDie(VirtualDiceGame);
If BowlDieResult In [1..4]
Then
Begin
RunsScored := CalculateRunsScored(BowlDieResult);
DisplayRunsScored(RunsScored);
CurrentPlayerScore := CurrentPlayerScore + RunsScored;
Writeln('Your new score is: ', CurrentPlayerScore);
End;
If BowlDieResult = 5
Then Writeln('No runs scored this time. Your score is still: ',
CurrentPlayerScore);
If BowlDieResult = 6
Then
Begin
Writeln('This could be out... press the Enter key to find out.');
Readln;
AppealDieResult := RollAppealDie(VirtualDiceGame);
DisplayAppealDieResult(AppealDieResult);
If AppealDieResult >= 2
Then PlayerOut := True
Else PlayerOut := False;
End;
Writeln;
Writeln('Press the Enter key to continue');
Readln;
Until PlayerOut;
Writeln('You are out. Your final score was: ', CurrentPlayerScore);
Writeln;
Writeln('Press the Enter key to continue');
Readln;
If PlayerNo = 1
Then PlayerOneScore := CurrentPlayerScore
Else PlayerTwoScore := CurrentPlayerScore;
End;
DisplayResult(PlayerOneName, PlayerOneScore, PlayerTwoName, PlayerTwoScore);
If (PlayerOneScore >= PlayerTwoScore)
Then
Begin
UpdateTopScores(TopScores, PlayerOneName, PlayerOneScore);
UpdateTopScores(TopScores, PlayerTwoName, PlayerTwoScore);
End
Else
Begin
UpdateTopScores(TopScores, PlayerTwoName, PlayerTwoScore);
UpdateTopScores(TopScores, PlayerOneName, PlayerOneScore);
End;
Writeln;
Writeln('Press the Enter key to continue');
Readln;
End;
Begin
Randomize;
ResetTopScores(TopScores);
Write('What is player one''s name? ');
PlayerOneName := GetValidPlayerName;
Write('What is player two''s name? ');
PlayerTwoName := GetValidPlayerName;
Repeat
Repeat
DisplayMenu;
OptionSelected := GetMenuChoice;
Until OptionSelected In [1..4, 9];
Writeln;
If OptionSelected In [1..4]
Then
Case OptionSelected Of
1 : PlayDiceGame(PlayerOneName, PlayerTwoName, True, TopScores);
2 : PlayDiceGame(PlayerOneName, PlayerTwoName, False, TopScores);
3 : LoadTopScores(TopScores);
4 : DisplayTopScores(TopScores);
End;
Until OptionSelected = 9;
End.
{Skeleton Program code for the AQA COMP1 Summer 2011 examination
this code should be used in conjunction with the Preliminary Material
written by the AQA COMP1 Programmer Team developed in the
Free Pascal IDE for Win32 v1.0.10 programming environment}
{Centres using Delphi should add the compiler directive that sets
the application type to Console (other centres can ignore this
comment). Centres may also add the SysUtils library if their
version of Pascal uses this}
{Permission to make these changes to the Skeleton Program does not
need to be obtained from AQA/AQA Programmer - just remove the \ symbol from
the next line of code and remove the braces around Uses SysUtils;}
{\$APPTYPE CONSOLE}
{Uses
SysUtils;}
Const MaxSize = 4;
Type TTopScore = Record
Name : String;
Score : Integer;
End;
TTopScores = Array[1..MaxSize] Of TTopScore;
Var
TopScores : TTopScores;
PlayerOneName : String;
PlayerTwoName : String;
OptionSelected : Integer;
Procedure ResetTopScores(Var TopScores : TTopScores);
Var
Count : Integer;
Begin
For Count := 1 To MaxSize
Do
Begin
TopScores[Count].Name := '-';
TopScores[Count].Score := 0;
End;
End;
Function GetValidPlayerName : String;
Var
PlayerName : String;
Begin
Repeat
Readln(PlayerName);
If PlayerName = ''
Then Write('That was not a valid name. Please try again: ');
Until PlayerName <> '';
GetValidPlayerName := PlayerName;
End;
Procedure DisplayMenu;
Begin
Writeln;
Writeln('Dice Cricket');
Writeln;
Writeln('1. Play game version with virtual dice');
Writeln('2. Play game version with real dice');
Writeln('3. Load top scores');
Writeln('4. Display top scores');
Writeln('9. Quit');
Writeln;
End;
Function GetMenuChoice : Integer;
Var
OptionChosen : Integer;
Begin
Write('Please enter your choice: ');
Readln(OptionChosen);
If (OptionChosen < 1) Or ((OptionChosen > 4) And (OptionChosen <> 9))
Then
Begin
Writeln;
Writeln('That was not one of the allowed options. Please try again: ');
End;
GetMenuChoice := OptionChosen;
End;
Function RollBowlDie(VirtualDiceGame : Boolean) : Integer;
Var
BowlDieResult : Integer;
Begin
If VirtualDiceGame
Then BowlDieResult := Random(6) + 1
Else
Begin
Writeln('Please roll the bowling die and then enter your result.');
Writeln;
Writeln('Enter 1 if the result is a 1');
Writeln('Enter 2 if the result is a 2');
Writeln('Enter 3 if the result is a 4');
Writeln('Enter 4 if the result is a 6');
Writeln('Enter 5 if the result is a 0');
Writeln('Enter 6 if the result is OUT');
Writeln;
Write('Result: ');
Readln(BowlDieResult);
Writeln;
End;
RollBowlDie := BowlDieResult;
End;
Function CalculateRunsScored(BowlDieResult : Integer) : Integer;
Var
RunsScored : Integer;
Begin
Case BowlDieResult Of
1 : RunsScored := 1;
2 : RunsScored := 2;
3 : RunsScored := 4;
4 : RunsScored := 6;
5, 6 : RunsScored := 0;
End;
CalculateRunsScored := RunsScored;
End;
Procedure DisplayRunsScored(RunsScored : Integer);
Begin
Case RunsScored Of
1 : Writeln('You got one run!');
2 : Writeln('You got two runs!');
4 : Writeln('You got four runs!');
6 : Writeln('You got six runs!');
End;
End;
Procedure DisplayCurrentPlayerNewScore(CurrentPlayerScore : Integer);
Begin
Writeln('Your new score is: ', CurrentPlayerScore);
End;
Function RollAppealDie(VirtualDiceGame : Boolean) : Integer;
Var
AppealDieResult : Integer;
Begin
If VirtualDiceGame
Then AppealDieResult := Random(4) + 1
Else
Begin
Writeln('Please roll the appeal die and then enter your result.');
Writeln;
Writeln('Enter 1 if the result is NOT OUT');
Writeln('Enter 2 if the result is CAUGHT');
Writeln('Enter 3 if the result is LBW');
Writeln('Enter 4 if the result is BOWLED');
Writeln;
Write('Result: ');
Readln(AppealDieResult);
Writeln;
End;
RollAppealDie := AppealDieResult;
End;
Procedure DisplayAppealDieResult(AppealDieResult : Integer);
Begin
Case AppealDieResult Of
1 : Writeln('Not out!');
2 : Writeln('Caught!');
3 : Writeln('LBW!');
4 : Writeln('Bowled!');
End;
End;
Procedure DisplayResult(PlayerOneName : String; PlayerOneScore : Integer;
PlayerTwoName : String; PlayerTwoScore : Integer);
Begin
Writeln;
Writeln(PlayerOneName, ' your score was: ', PlayerOneScore);
Writeln(PlayerTwoName, ' your score was: ', PlayerTwoScore);
Writeln;
If PlayerOneScore > PlayerTwoScore
Then Writeln(PlayerOneName, ' wins!');
If PlayerTwoScore > PlayerOneScore
Then Writeln(PlayerTwoName, ' wins!');
Writeln;
End;
Procedure UpdateTopScores(Var TopScores : TTopScores; PlayerName : String;
PlayerScore : Integer);
Var
LowestCurrentTopScore : Integer;
PositionOfLowestCurrentTopScore : Integer;
Count : Integer;
Begin
LowestCurrentTopScore := TopScores[1].Score;
PositionOfLowestCurrentTopScore := 1;
{Find the lowest of the current top scores}
For Count := 2 To MaxSize
Do
If TopScores[Count].Score < LowestCurrentTopScore
Then
Begin
LowestCurrentTopScore := TopScores[Count].Score;
PositionOfLowestCurrentTopScore := Count;
End;
If PlayerScore > LowestCurrentTopScore
Then
Begin
TopScores[PositionOfLowestCurrentTopScore].Score := PlayerScore;
TopScores[PositionOfLowestCurrentTopScore].Name := PlayerName;
Writeln('Well done ', PlayerName, ' you have one of the top scores!');
End;
End;
Procedure DisplayTopScores(TopScores : TTopScores);
Var
Count : Integer;
Begin
Writeln('The current top scores are: ');
Writeln;
For Count := 1 To MaxSize
Do Writeln(TopScores[Count].Name, ' ', TopScores[Count].Score);
Writeln;
Writeln('Press the Enter key to return to the main menu');
Readln;
End;
Procedure LoadTopScores(Var TopScores : TTopScores);
{Centres using older versions of Pascal might need to delete the line that
uses StrToInt and use the two alternative lines in braces. Permission to
make these changes does not need to be obtained from AQA/AQA Programmer.}
Var
Count : Integer;
Count2 : Integer;
{Err : Integer;}
LineFromFile : String;
ValuesOnLine : Array[1..2] Of String;
CurrentFile : Text;
Begin
Assign(CurrentFile, 'HiScores.txt');
Reset(CurrentFile);
For Count := 1 To MaxSize
Do
Begin
ValuesOnLine[1] := '';
ValuesOnLine[2] := '';
Readln(CurrentFile, LineFromFile);
Count2 := 1;
Repeat
ValuesOnLine[1] := ValuesOnLine[1] + LineFromFile[Count2];
Count2 := Count2 + 1;
Until LineFromFile[Count2] = ',';
Count2 := Count2 + 1;
Repeat
ValuesOnLine[2] := ValuesOnLine[2] + LineFromFile[Count2];
Count2 := Count2 + 1;
Until Count2 > Length(LineFromFile);
TopScores[Count].Name := ValuesOnLine[1];
TopScores[Count].Score := StrToInt(ValuesOnLine[2]);
{Val(ValuesOnLine[2],TopScores[Count].Score, Err);}
End;
Close(CurrentFile);
End;
Procedure PlayDiceGame(PlayerOneName, PlayerTwoName : String;
VirtualDiceGame : Boolean; Var TopScores : TTopScores);
Var
PlayerOut : Boolean;
CurrentPlayerScore : Integer;
AppealDieResult : Integer;
PlayerNo : Integer;
PlayerOneScore : Integer;
PlayerTwoScore : Integer;
BowlDieResult : Integer;
RunsScored : Integer;
Begin
For PlayerNo := 1 To 2
Do
Begin
CurrentPlayerScore := 0;
PlayerOut := False;
If PlayerNo = 1
Then Writeln(PlayerOneName, ' is batting')
Else Writeln(PlayerTwoName, ' is batting');
Writeln;
Writeln('Press the Enter key to continue');
Readln;
Repeat
BowlDieResult := RollBowlDie(VirtualDiceGame);
If BowlDieResult In [1..4]
Then
Begin
RunsScored := CalculateRunsScored(BowlDieResult);
DisplayRunsScored(RunsScored);
CurrentPlayerScore := CurrentPlayerScore + RunsScored;
Writeln('Your new score is: ', CurrentPlayerScore);
End;
If BowlDieResult = 5
Then Writeln('No runs scored this time. Your score is still: ',
CurrentPlayerScore);
If BowlDieResult = 6
Then
Begin
Writeln('This could be out... press the Enter key to find out.');
Readln;
AppealDieResult := RollAppealDie(VirtualDiceGame);
DisplayAppealDieResult(AppealDieResult);
If AppealDieResult >= 2
Then PlayerOut := True
Else PlayerOut := False;
End;
Writeln;
Writeln('Press the Enter key to continue');
Readln;
Until PlayerOut;
Writeln('You are out. Your final score was: ', CurrentPlayerScore);
Writeln;
Writeln('Press the Enter key to continue');
Readln;
If PlayerNo = 1
Then PlayerOneScore := CurrentPlayerScore
Else PlayerTwoScore := CurrentPlayerScore;
End;
DisplayResult(PlayerOneName, PlayerOneScore, PlayerTwoName, PlayerTwoScore);
If (PlayerOneScore >= PlayerTwoScore)
Then
Begin
UpdateTopScores(TopScores, PlayerOneName, PlayerOneScore);
UpdateTopScores(TopScores, PlayerTwoName, PlayerTwoScore);
End
Else
Begin
UpdateTopScores(TopScores, PlayerTwoName, PlayerTwoScore);
UpdateTopScores(TopScores, PlayerOneName, PlayerOneScore);
End;
Writeln;
Writeln('Press the Enter key to continue');
Readln;
End;
Begin
Randomize;
ResetTopScores(TopScores);
Write('What is player one''s name? ');
PlayerOneName := GetValidPlayerName;
Write('What is player two''s name? ');
PlayerTwoName := GetValidPlayerName;
Repeat
Repeat
DisplayMenu;
OptionSelected := GetMenuChoice;
Until OptionSelected In [1..4, 9];
Writeln;
If OptionSelected In [1..4]
Then
Case OptionSelected Of
1 : PlayDiceGame(PlayerOneName, PlayerTwoName, True, TopScores);
2 : PlayDiceGame(PlayerOneName, PlayerTwoName, False, TopScores);
3 : LoadTopScores(TopScores);
4 : DisplayTopScores(TopScores);
End;
Until OptionSelected = 9;
End.
Thursday, 10 March 2011
electronic exam paper changes
Jake,
For your information, please find below e-mail from AQA with regards to AS Computing Unit 1.
Thank you,
Audrey
From: AQA Exams Office Support [mailto:eos@aqa.org.uk]
Sent: 04 February 2011 09:55
To: Audrey Reggio
Subject: Changes to the Electronic Answer Document for GCE Computing Unit 1 - COMP1
Sent: 04 February 2011 09:55
To: Audrey Reggio
Subject: Changes to the Electronic Answer Document for GCE Computing Unit 1 - COMP1
Audrey Reggio,
Changes to the Electronic Answer Document for GCE Computing Unit 1 - COMP1
With effect from the 2011 exam, there will be a new statement for candidates on the cover of the electronic answer document. The revised wording under the heading 'Warning' reads:
'It may not be possible to credit an answer if your:
- details are not printed on every page as instructed above
- Screen Captures are not legible to the examiner.'
Centres should ask candidates to practise making screen captures that are easily legible in terms of:
- the size of the capture
- the size of the font
- where appropriate, the use of colours.
Kind regards,
Rosemarie Edwards
Senior Manager - Exams Office Administration
Senior Manager - Exams Office Administration
If you no longer wish to receive e-mail communications from AQA, please unsubscribe here.
The Assessment and Qualifications Alliance (AQA) is a company limited by guarantee registered in England and Wales (company number 3644723) and a registered charity (registered charity number 1073334). Registered address: AQA, Devas Street, Manchester M15 6EX.
AQA is fully committed to protecting your privacy and complying with the Eight Principles enshrined in the Data Protection Action 1998 and related legislation. Your personal information will be treated confidentially by AQA at all times. For full details on how your personal information will be used, stored and protected, and how to request further information from AQA, please read AQA's Privacy and Fair Processing Statement.
Disclaimer: This e-mail is intended solely for the addressee, is strictly confidential, and may also be legally privileged. If you are not the addressee you may not read, print, re-transmit, store or act in reliance on it or any attachments. Please also destroy this message and notify us immediately by reply.
Disclaimer: This e-mail is intended solely for the addressee, is strictly confidential, and may also be legally privileged. If you are not the addressee you may not read, print, re-transmit, store or act in reliance on it or any attachments. Please also destroy this message and notify us immediately by reply.
Saturday, 5 March 2011
Thursday, 3 March 2011
Subscribe to:
Posts (Atom)