0% found this document useful (0 votes)
114 views6 pages

T1 Worksheet 1

1. The document provides tasks to practice decomposing problems and writing algorithms. The first task involves determining whether individuals B and C are truth-tellers or liars based on questions to individual A. 2. The second task involves writing an algorithm to fill a 5-liter jug with exactly 4 liters using a 3-liter and 5-liter jug. 3. The third task involves writing algorithms for a computer to play noughts and crosses against a human and comparing algorithms.

Uploaded by

rukh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views6 pages

T1 Worksheet 1

1. The document provides tasks to practice decomposing problems and writing algorithms. The first task involves determining whether individuals B and C are truth-tellers or liars based on questions to individual A. 2. The second task involves writing an algorithm to fill a 5-liter jug with exactly 4 liters using a 3-liter and 5-liter jug. 3. The third task involves writing algorithms for a computer to play noughts and crosses against a human and comparing algorithms.

Uploaded by

rukh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Worksheet 1

Decomposition and abstraction


Unit 1 Computational thinking

Name:..................................................................................................... Class: .....................

Task 1
1. Qwerty is a small island in the southern
hemisphere.
The Qwertian people have two types of people.
The ASCIIs who always say the truth and the
UNICODEs who always lie.
There are three people (A, B and C) in a
Qwertian coffee shop.

You know from a friend that A is an ASCII, but


they will never tell you directly if someone is or
isn’t a UNICODE for fear of being attacked.
Write an algorithm for questions that you could ask A, B and C that would determine
whether B and C are ASCIIs or UNICODEs.

1
Worksheet 1
Decomposition and abstraction
Unit 1 Computational thinking

2. You have a 3-litre jug and a 5-litre jug.

You need to fill the 5-litre jug with exactly 4 litres of water.
Write an algorithm to solve this problem

2
Worksheet 1
Decomposition and abstraction
Unit 1 Computational thinking

3. Noughts and crosses is a game played with a 3x3 grid.

Two players take turns to add an X or O to the board


If a player gets three of their symbols in a row they win the game.
If no player achieves this, then the game is a draw.
(a) Create an algorithm for a computer to play a game of noughts and crosses against a
human. The computer will be X.

(b) Now try your algorithm against a partner’s.


Which algorithm is better at playing the game?

3
Worksheet 1
Decomposition and abstraction
Unit 1 Computational thinking

Task 2
1. ‘Beetle’ is a dice game for two or more players, played with a single six-sided die.
The objective is to be the first to draw all parts of a beetle. At each turn, a player rolls the
die to decide which part can be drawn.
The body has to be drawn first, by throwing a 6. Head, legs and tail can then be drawn
when the correct value is shown on the die.
Eyes and antennae cannot be drawn until the head is drawn.
The first person to draw all the body parts is the winner.
Throw Part Count
Six Body 1
Five Head 1
Four Tail 1
Three Leg 4
Two Antenna 2
One Eye 2
You need to write a program to allow a player to play Beetle against the computer.
(a) Decompose this game into component parts using a structure diagram.

(b) Which sub-problems, if any, could be reused if you are asked to write a program for a
different dice game?

4
Worksheet 1
Decomposition and abstraction
Unit 1 Computational thinking

Task 3
Find an Internet site that simulates playing a simple dice game, and decompose the steps in the
algorithm used to program the game.

Briefly describe the rules of the game


 What is displayed on the initial screen? What happens next?
 What is displayed once the game starts?
 What steps does the algorithm perform on each roll of the die?
 What is displayed when the game ends?

e.g. http://www.playonlinedicegames.com/
Draw a structure diagram which shows how the game is decomposed.

5
Worksheet 1
Decomposition and abstraction
Unit 1 Computational thinking

Task 4
A 3D computer game allows players to interact with a house.

(a) List at least five details that have been removed from the house by abstraction.

(b) Give five possible subprograms (functions or procedures) that may be used within the
game.

You might also like