I've written some code below and I can't get it to compile. I think I have my While and If in the wrong place.

Any help is greatly appreciated!

Here is the structured english:

```
PlayerOneScore <- 0
PlayerTwoScore <- 0
OUTPUT ‘How many balls do you wish to face?’
INPUT BallsNo
FOR EachPlayer <- 1 TO 2 DO
CurrentScore <- 0
OUTPUT ‘Player’ + EachPlayer + ‘to go’
OUTPUT ‘Please roll the bowling die’
OUTPUT ‘Enter 1 if result is a 1’
OUTPUT ‘Enter 2 if result is a 2’
OUTPUT ‘Enter 3 if result is a 4’
OUTPUT ‘Enter 4 if result is a 6’
OUTPUT ‘Enter 5 if result is a 0’
FOR EachBall <- 1 TO BallsNo DO
OUTPUT ‘Ball number: ‘ + EachBall
INPUT BowlResult
IF BowlResult = 1 THEN
CurrentScore <- CurrentScore + 1
ELSE IF BowlResult = 2 THEN
CurrentScore <- CurrentScore + 2
ELSE IF BowlResult = 3 THEN
CurrentScore <- CurrentScore + 4
ELSE IF BowlReuslt = 4 THEN
CurrentScore <- CurrentScore + 6
END IF
END FOR
IF EachPlayer = 1 THEN
PlayerOneScore <- CurrentScore
ELSE
PlayerTwoScore <- CurrentScore
END FOR
IF PlayerOneScore > PlayerTwoScore THEN
OUTPUT ‘Player One Wins’
ELSE IF PlayerTwoScore > PlayerOneScore THEN
OUTPUT ‘Player Two Wins’
ELSE
OUTPUT ‘Draw’
```

```
Program Game;
var
PlayerOneScore: Integer;
PlayerTwoScore: Integer;
BallsNo: Integer;
CurrentScore: Integer;
Ptr: Integer;
Result:Integer;
Begin
PlayerOneScore:= 0;
PlayerTwoScore:= 0;
Writeln('How many balls do you wish to face?');
Readln(BallsNo);
Ptr:=1;
While Ptr < 1
Do Ptr:=Ptr+1;
CurrentScore:=0;
Writeln ('Player turn');
Writeln ('Please roll the bowling die');
Writeln ('Enter 1 if result is a 1');
Writeln ('Enter 2 if result is a 2');
Writeln ('Enter 3 if result is a 4');
Writeln ('Enter 4 if result is a 6');
Writeln ('Enter 5 if result is a 0');
While BallsNo >0 Do
BallsNo:=BallsNo-1;
Writeln('This is',BallsNo);
Readln(Result);
If Result = 1 Then
CurrentScore:= CurrentScore+1
Else If Result = 2 THEN
CurrentScore:= CurrentScore+2
Else If Result = 3 THEN
CurrentScore:= CurrentScore+4
Else If Result=4 THEN
CurrentScore := CurrentScore+6;
Until BallsNo = 0;
If Ptr = 1 THEN
PlayerOneScore := CurrentScore
Else PlayerTwoScore := CurrentScore;
Until Ptr=2;
If PlayerOneScore > PlayerTwoScore Then
Writeln('Player One Wins');
If PlayerTwoScore > PlayerOneScore Then
Writeln('Player Two Wins');
Else
Writeln('Draw');
End.
end.
```