A game developer is creating a text-based adventure game where a player navigates through a hazardous cave represented as an array.
cave array| Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|---|
| Content | # | # |
cave array.lastPos).1, 2, or 3.
'#':
"Trap triggered!" is displayed.0.pos = 0
lastPos = len(cave) - 1
while pos < lastPos:
Extend the program from Figure 3 so that the game works as described in the rules in Figure 2.
When writing your program, you should assume:
cave.'#' characters in cave can vary.'#' characters in cave can vary.'#' characters have already been initialized in the array.cave array can be of any length greater than 1.You should use meaningful variable names and correct programming syntax in your answer.
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.