python代写 python作业代写 python程序代写 代写python程序

CSC1002代写,python作业代写,留学生python作业代写,代写python

CSC1002 – Computational Laboratory,python作业代写,python程序代写

OVERVIEW

In this assignment, you are going to design and develop a Snake game. The game is composed of 3 objects: a snake, a monster and food items represented by a set of numbers from 1 to 9. In the figure shown above, the snake is represented by a sequence of squares where its head and its body are displayed in red and black colors respectively, while the monster by a purple square. The numbers are food items to be consumed by the snake.

The goal of the game is to maneuver the snake within the game area in four directions (up, down, left and right), trying to consume all the food items while avoiding head-on collision with the monster. As each food item is consumed, the snake grows with its body lengthened in size equal to the value of the number being passed. While directing the movement of the snake you should avoid contact with the monster. Furthermore the monster is also programmed to be motioned in the direction towards the head of the snake at a variable speed.


SCOPE

Design the snake game using the standard module “turtle”, including the following components:

a. Game Area (status and motion area)

b. A Snake

c. A Monster

d. Food Items

e. Game Status

f. Controls

g. Motion


GameArea

a. The game area is composed of an upper area for statuses and a motion area where the snake and monster are moved around, surrounded by a fixed margin along the four sides, with the following dimensions:

i. Upper status area = 500 (w) x 80 (h)

ii. Lower motion area = 500 (w) x 500 (w)

iii. Margins = 80 pixels around

b. Draw a border for both the status area and motion area.

• Food Items

a. Represented as numbers from 1 to 9, displayed within the motion area in random

locations. These numbers will be kept visible all time until they are consumed by the snake. When the head of the snake crosses one of these numbers, the number being crossed is considered consumed and it will be removed from the game area permanently. So, any one food item can be consumed once.

• Snake

a. The snake is composed of a head with a tail which extends as it consumes any food

items.

b. Use only simple, built-in shape “square” for both head and tail, default size.

 Use different colors for the head (ex: red) and the tail (ex: black with blue border color); choose a border color for the tail so that the length of the tail can be counted easily.

d. The tail extends as the snake moves, not at the point when the food item being consumed; in other words, at the moment the snake crosses a food item, the snake doesn’t change in size; as the snake moves the tail extends in the direction of the movement as if the end of the tail sticks onto the screen. The tail extension ends when the length of the snake has grown in size equal to the value of the number being crossed. The following figure shows the sequence of moves of the snake crossing a food item.


SKILLS

In this assignment, you will be trained on the use of the followings:

• Use built-in turtle module to design the snake program as per scope

• Use standard objects (strings, numbers & lists)

• GUI interaction

• Variable Scope

• Functions for program structure and decomposition


京ICP备2025144562号-1
微信
程序代写,编程代写
使用微信扫一扫关注
在线客服
欢迎在线资讯
联系时间: 全天