Module 7 - The “Sprites’ Track and Field Competition” Project

Z Wiki Mistrzowie Kodowania
Skocz do: nawigacji, wyszukiwania
Logo Mistrzowie.png


These materials have been developed by Ośrodek Edukacji Informatycznej i Zastosowań Komputerów (Centre for Information Technology Education and Application of Computers) in Warsaw as part of the “Mistrzowie Kodowania” (“Coding Masters”) Programme funded by Samsung Electronics Polska, licensed under CC-BY-SA “Attribution – Share Alike 3.0 Poland”

Information

Objectives

General objectives:

  • Review and revision of previously presented Scratch commands and language structures;
  • Development of a simple game in which processes are executed concurrently;
  • Implementation of the game in the Scratch environment.

Specific objectives:

  • The student will understand and be able to use appropriate structural instructions.
  • The student will understand the concepts of global and local variables and will be able to use them in the programme.
  • The student will be able to design and implement a simple Scratch game in which processes are executed concurrently.


Stages

Discussion of the solution of module VI additional task

Time to complete this part:about 10 minutes


At the beginning of the lesson we remind students what they were supposed to prepare between classes. We invite a volunteer to present his/her solution. We ask if anyone had a different way of finding a solution. We discuss the solutions (praising correct solutions to individual tasks).

If there was no homework, we start by repeating key issues from the previous module. We also ask if students have any doubts regarding their own projects. If anyone wants to show something he/she is proud of, we let him/her do it.


Designing a programme that simulates sprite races

Time to complete this part: about 20 minutes

At the beginning of the lesson we explain that the task to be to solved is to create a programme that simulates races. Initially two sprites will take part in the race. This time, however, we will not be developing together with the students an algorithm which will be written on the board, but discussing and brainstorming general assumptions and how the programme is to work. We will also discuss how some of the issues can be implemented (but without a specific indication of how to do it using specific Scratch commands).We note the conclusions of the brainstorming session in the form of a schematic drawing on the board. The discussion might look like the one described below, it is important to discuss all the items to be included in the programme (the starting point, how the sprites will move, setting a random movement speed, reaction to reaching the finish line by the quicker sprite).


We ask the following question: Where should we start designing our programme from? What should we include in it?

The answers may vary, including many correct ones. We will, therefore, seek to ensure to initially determine all the important elements of the programme, including:

  • where sprites will start from (we need to determine their position, because they should always start from the same positions), and where the finish line will be located,
A21.png


A11.jpg


  • which way they will move – to the right, to the left, and maybe up or down
    • selecting the direction from left to right seems natural, because this is in accordance with the direction of reading, and has the advantage of sprites being able to travel a longer distance,
  • how to determine the running speed of individual sprites so that each time the programme is started each sprite has a chance to win,
    • e.g. sprites can move by a random, small (e.g. between 1 and 5) number of steps, and such a random selection should take place before each sprite moves on the board – until one of them crosses the finish line,


A13.jpg
  • how a sprite will recognise that it has reached the finish line (crossed the line),
    • it can check after each movement (shift) by a randomly selected number of steps whether it has gone over the finishing position. If so, it has reached the finish line,
  • how a sprite will know that it is the first,
    • e.g. when it reaches the line it can check if the position of the other sprite is smaller or bigger than the position of the finish line. If it is smaller, this means that it has arrived first and can say “I won!”.If it is not smaller, this means that the other sprite arrived there earlier and won or there is a draw.