2019 Third programming

The third course is designed to spring 2019 test report

One. Pilot project name

Experimental Project Name: Snake

two. Pilot project Functional Description

1. snake structure
2 can be the moving snake
3. player can control the movement of the snake
4 hit their snake hits a wall or post, it can be determined game failed
5. snake longer able to eat food

III. Project module structure Introduction

Startup (); // initialize data
moveSnakeByDirection ();
// move snake
all elements of the canvas // first step scans array, the number of elements found positive are added 1
// find the maximum element (i.e., the tail), it becomes 0
// find the element equal to 2 (i.e. snake head), corresponding to the other pixel value is set to 1 bar (a new snake head) according to input vertical and horizontal directions
Show (); // display screen
gotoxy (); // cursor to the origin, to solve the game screen flicker issue
updateWithoutInput (); // nothing to do with user input to update
updateWithInput (); // update user input related to the operation of the baffle
main (); // loop through constant while rewriting of the game screen, so that the display screen is not stopped, the operation can be performed on the display screen

The overall model:

IV. Realized interface display

V. code hosting links

https://gitee.com/rszzsp/software_class_2_ren_senzhu/blob/master/%E8%B4%AA%E5%90%83%E8%9B%87.cpp

VI. Experiments summary

1. Ask a question

How to add Dev-c ++ graphics library?

2. Solution

After check the internet, read the discussion of the students at the door of the ege installation package in the group, according to the online tutorial to do step by step.

3. impressions

Before I did not read the code, I do not know Snake code is how to do it, but after reading the code or be able to read, write like a high school science comprehensive, like, totally not the time to write their own ideas but after reading the reference answer is very easy to understand it, this game is also very classic, very fun wish I could read a book to write this code is not very good.

Guess you like

Origin www.cnblogs.com/dzspve/p/10991285.html