Sinclair QL Beginner's Manual page 94

Hide thumbs Also See for QL:
Table of Contents

Advertisement

Represent a snakes and ladders game with a 100 element numeric array. Each element should
contain either
zero
or:
a number in the range 10 to 90 meaning that a player should transfer to that
number by going 'up a ladder' or 'down a snake'
or:
the digits 1, 2, 3, etc. to denote a particular player's position.
Set up six snakes and six ladders by placing numbers in the array and simulate one 'solo' run by a
single player to test the game.
3. CROSSWORD BLANKS
1
1
2
row
3
4
5
Crosswords usually have an odd number of rows or columns in which the black squares have a
symmetrical pattern. The pattern is said to have rotational symmetry because rotation through 180
degrees would not change it.
Note that after rotation through 180 degrees the square in row 4, column1 could become the square
in row 2, column 5. That is row 4, column 1 becomes row 2, column 5 in a 5 x 5 grid.
Write a program to generate and display a symmetrical pattern of this kind.
4.
Modify the crossword pattern so that there are no sequences, across or down, of less than
four white squares.
5. CARD SHUFFLE
Cards are denoted by the numbers 1-52 stored in an array. They can be converted easily to actual
card values when necessary. The cards should be 'shuffled' as follows.
Choose any position in range 1-51 e.g. 17
Place the card in this position in a temporary store.
Shunt all the cards in positions 52 to 18 down to positions 51 to 17
Place the chosen card from the temporary store to position 52.
Deal similarly with the ranges 1-50, 1-49 .. down to 1-2 so that the pack is well shuffled.
Output the result of the shuffle
2
3
4
5
columns

Advertisement

Table of Contents
loading

Table of Contents