Golden Dot Game

Source: Internet
Author: User
Tags rounds

n students (n usually greater than ten), each writing a rational number between 0~100 ( excluding 0 or three ), to the referee, the referee calculates the average of all the numbers, and then times the 0.618(so-called golden partition constant) , the G value is obtained. The number of the submitted nearest to G(absolute value) of the students get n points, the farthest from the G students get-2 points, the other students get 0 points. after a few days of playing, we found some interesting phenomena, such as the golden dots moving down gradually.

Now please according to the rules of the game, make up a can play with a number of small game program, the requirements are as follows:

1, this job belongs to the pair programming project, must be completed by two people, and will be sent to the blog, respectively, the operation of the source code submitted to the codeing system;

2, if possible to use the C/s or b/n as much as possible, that is, using the server to receive and process all the players submitted by the number, and the results back to the players, players can be submitted by the client number;

3, if the use of single-machine approach, it is necessary to provide users with convenient input interface;

4, the game can run at least 10 rounds at a time, and can keep the results of the rounds.

A. Game Analysis process:

This game I was designed in C language, the main process of the game is already very clear. My design analysis of this program has the following points:

1. The design of this procedure uses the idea of bubbling sort.

2. Design three one-dimensional arrays, the first to store the numbers written by n students, the second to store the random data written by the students after the bubble sort of new sequence, the third is used to store the number of each student to choose the score.

3. This procedure is most used for the for loop structure, using a for loop to implement the input of the array element on the client, especially the bubbling sort method.

4. The game uses the bubble sorting method because the bubble sort can be in the first array of the irregular elements in the order from small to large into the second array, through the second array element we can parse, the second array of the first element must be the G value of the largest difference between the one, It can get-2, and the last one must be the smallest, it can get n points, the others are 0, and then we can sequentially input the scores into the third array, and then output them sequentially.

Two. The view of my partner

I think he did a good job, in our two people work together in the process, I learned a lot of things, we promote each other, mutual communication, he is very careful, although our final code is still wrong, but I think our thinking must be right, which I firmly believe that if there are errors can only show that our programming ability is not enough, The study is not fine, we constantly test debugging, but not enough success, this is my regret.

Golden Dot Game

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.