A program is being designed that will allow a user to log into an account on a website using a username and password.
Identify two possible sub-procedures that could be used in this program.
Did this page help you?
A program is being designed that will allow a user to log into an account on a website using a username and password.
Identify two possible sub-procedures that could be used in this program.
How did you do?
Did this page help you?
A Nonogram is a logic puzzle where a player needs to colour in boxes. The puzzle is laid out as a grid and each square needs to be either coloured black or left white.
The numbers at the side of each row and column tells the player how many of the boxes are coloured in consecutively. Where a row has two or more numbers, there must be a white square between the coloured squares.
In this example:
the first column has 1 1, this means there must be two single coloured boxes in this column. There must be at least 1 white box between them.
the first row has 2, this means there must be two consecutively coloured boxes in the row.
Juan is creating a program that will store a series of Nonograms for a user to play. The game will randomly select a puzzle and display the blank grid with the numbers for each row and column to the user.
The user plays the game by selecting a box to change its colour. If the box is white it will change to black and if it is black it will change to white. The user can choose to check the answer at any point, and the game will compare the grid to the answers and tell the user if they have got it correct or not.
Juan wants to create a program that will generate new Nonograms with different grid sizes. For example a Nonogram with a 10 × 10 grid or a 5 × 20 grid.
Describe how the program could be written to automatically generate a new Nonogram.
How did you do?
Did this page help you?
A program written using the Little Man Computer instruction set is shown in Fig. 1.
Write an algorithm using pseudocode that has the same functionality as the code in Fig. 1
How did you do?
Did this page help you?
Two people play a counting game. The rules of the game are as follows:
|
For example, if the first player chooses three numbers (1, 2, 3) then the second player could choose one number (4), two numbers (4, 5) or three numbers (4, 5, 6). The first player then takes another go.
Write an algorithm using pseudocode that allows two players to play this game. The algorithm should:
Alternate between player 1 and player 2
Ask the player how many numbers they would like to choose, ensuring that this is between 1 and 3
Display the numbers that the player has chosen
Display a suitable message to say which player has won once the number 15 has been displayed.
How did you do?
Did this page help you?