Pair programming: The Golden Dot game

Source: Internet
Author: User

This homework is my first time to participate in the project, in the process of completion of this assignment, I deeply realized that two people together programming and alone to complete the task between the huge differences, in the process of completion of the task, we have to continue to adapt to each other's work style and coding style, in a word, This experience has made me realize the importance of working with others, and the different thinking about the same problem among two people helps to optimize the process and make it as perfect as possible. Next, summarize the specific process of the task.

First, after the issue of the assignment, I and Sun walk began to use an easy visual programming language to complete the golden point game, but then after a number of tradeoffs and considerations, my partner and I gave up the original idea, decided to continue to use the C language we are familiar with two people to encode. Because the C language in the visual Studio2013 platform to write programs, so the interface may not be very glamorous, but as a student of science and engineering, we also as far as possible to achieve another kind of minimalist beauty, with the least cost to realize the best results.

Before I started writing a program, my partner and I divided the program into several parts, which were responsible for the game's specific implementation, the calculation of the G value, and the management of the final results of each player. The next code by me and my pair of partners alternating, each of the results of each other to detect and evaluate, and to propose improvements, after each module is completed, we have to carry out further debugging work, if there are errors, we need to carry out specific analysis, find errors, and corresponding changes to the code, So that the calculation results in line with the expected requirements, so after nearly two weeks of hard work, the final process is finally completed, this is the crystallization of our two countless Hanjiang river. In this two weeks time, I found that many of my own programming habits have a lot of Sun Buchao or need to improve, but also found that the students in the way of thinking a lot of extraordinary, so I really eye-opening, benefit, in this, I would like to thank Sun Buchao, is that you make me feel this 2 weeks full of meaning, Learned a lot, if there is a chance, we would like to cooperate happily. The specific code and running results are shown below.

#include <stdio.h> #include <stdlib.h> #include <windows.h>int result[100][1000000];int count = 0;int  Num1[100][1];void Main () {int flag = 0, flag1;while (flag = = 0) {printf ("Welcome to golden point game \ n"), int i, A, j;int num[1000], sum = 0, L, M, G, num2[1000], num3[100], num4[100], t;printf ("Enter the number of participants in the game \ n"), scanf ("%d", &a);//Number of players for (i = 0; i < A; i++ //Enter data for each player {printf ("Please enter data for%d member", i+1), scanf ("%d", &num[i]), if (num[i]<0) {exit (0);} Else{if (num[i]>100) {exit (0);}}} for (i = 0; i < A; i++) {L = Num[i];sum = sum + l;} G = (int) (sum/a*0.618);//g value for (i = 0; i < A; i++) {L = ABS (NUM[I]-G); Num2[i] = l;num3[i] = l;}  for (i = 1; i < A; i++)//bubble Sort {for (j = 0; J < A-1, J + +) {if (Num3[j] > num3[j + 1]) {t = num3[j];num3[j] = num3[j + 1];num3[j + 1] = t;}}} for (i = 0; i < A; i++)//num4=0{num4[i] = 0;} for (i = 0; i < A; i++) {L = num3[0], M = num3[a-1];if (num2[i] = = L) {Num4[i] = A;} if (num2[i] = = m) {Num4[i] =-2;}} for (i = 0; i < A; i++)//output individual player information {printf ("%dThe scores of the members are%d\n ", i+1, Num4[i]);} for (i = 0; i < A; i++) {result[count][i] = num4[i];} Num1[count][0] = a;count++;p rintf ("If you want to continue, please press 0, no press any key to exit the game"); scanf ("%d", &flag);} int N, i;printf ("Would you like to see the previous results, is please enter 0, no press any key to exit \ n"); scanf ("%d", &flag1), while (Flag1 = = 0)//view the results of each round of the match result {printf (" Please enter the number of rounds you want to see "), scanf ("%d ", &n), for (i = 0; i<num1[n-1][0]; i++) {printf ("%d members are%d\n ", i+1, Result[n-1][i]);} printf ("If you want to continue watching, please enter 0, no press any key to exit \ n"); scanf ("%d", &AMP;FLAG1);} System ("Pause");}

  

Finally, I would like to attach a photo of my partner's work.

Pair programming: The 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.