Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

T1 Worksheet 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Worksheet 1 Computational thinking

Unit 6 Algorithms

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.

Ask them if they sleep, if they say yes they are ASCII, if they say no they are
UNICODE

1
Worksheet 1 Computational thinking
Unit 6 Algorithms

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

Estimate it

2
Worksheet 1 Computational thinking
Unit 6 Algorithms

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.

Place an X infront of every O

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


Which algorithm is better at playing the game?

3
Worksheet 1 Computational thinking
Unit 6 Algorithms

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.

When i roll, AI rolls after

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

All of it

4
Worksheet 1 Computational thinking
Unit 6 Algorithms

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.

Random dice is rolled

You might also like