Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
Already signed up?
New to KöMaL?

Problem I. 396. (February 2016)

I. 396. It is very easy to create interesting games by using the Scratch programming language and environment. One can discover the basics on their own, but studying programs written by others can also be exciting and instructive. A Hungarian introduction to the language is available at http://scratch.inf.elte.hu/. You can create and share your programs on the international web page http://scratch.mit.edu after registration. The language handles visual elements, variables and lists, and objects can send messages to one another.

By using Scratch, create the well-known snake game according to the following description. The snake should move continuously either horizontally or vertically. One can use the left or right arrows to change the orientation of the head by \(\displaystyle 90^\circ\) relative to the current direction; the snake's body should follow the head. Initially, the length of the snake, including the head, is 5 units. On the board, five moving food pieces should appear (having random initial position and direction), which can be consumed by the head of the snake. The length of the snake decreases by 1 unit after each 10-second interval, and increases by 1 unit after eating 3 food pieces. When the snake eats a food piece, another piece should immediately appear somewhere, so there are always 5 pieces on the board. If the snake bites itself or hits the wall, the game is over. The user wins the game if the length of the snake reaches 25 units.

A short documentation of your solution with the Internet address of your shared game should be submitted in a file i396.txt.

(10 pont)

Deadline expired on March 10, 2016.


Statistics:

1 student sent a solution.
10 points:Szakali Benedek.

Problems in Information Technology of KöMaL, February 2016