Guess how others will think then think further! -- G-Number Game notes

Source: Internet
Author: User
Tags rounds

First, I would like to introduce you to a fun little game, G-number.

I first learned that this game was viewed in the blog of Jack Xin, Senior Development Manager of Microsoft. Later, I had the honor to go to the advanced software engineering course, which was frequently played by students. The game rule is very simple. Each person submits a real number in the (0,100) interval, calculates the average value, and times the average value by the golden number 0.618. The obtained number is G-number, the number submitted by game players is the closest to that submitted by G-number, which is the winner.

This game has some mathematical analysis and statistics, see the teacher blog: http://www.cnblogs.com/xinz/archive/2011/08/08/2130505.html

The fun is over. What I did not expect is that this will become a single project for our software engineering.AlgorithmImplement a player with volunteers writing a serverProgramThe game player program we wrote eventually connects the server to play the game. After 1700 rounds of games, the ranking is given by points. What I did not expect was that my character broke out and it was always running, first in the ranking list. Today, I promised my instructor to write a blog to introduce my own algorithms.

I think I will introduce my algorithms in two steps.

I. Guess how others will
Think

First of all, my assumption is based on the premise that our classmates are smart enough, so no one can easily play cards without common sense. Then, my algorithm first guesses how everyone works.

After reading the instructor's blog, you will understand that the numbers you submit may be related to the G-number in the previous round, I am bold to assume that G-number is related to the N power of 0.618 of the previous round of G-number (I only consider n =, 2, 3 ). We can obtain the G-number submitted by each round of players from the server's returned information. Use G (I, j) to indicate the G-number value submitted by the j players in the I round. Use Gn (I) to represent the G-number finally obtained based on the data submitted by each player in round I.

The first step of my algorithm is described as follows: (set T to the number of players, and my_gn_raw (I + 1) to my initial data in the I + 1 round)

For j = 1 to T

{

Delta_0 = g (I, j)-Gn (I-1 );

Delta_1 = g (I, j)-Gn (I-1) * 0.618;

Delta_2 = g (I, j)-Gn (I-1) * 0.618 ^ 2;

Delta_3 = g (I, j)-Gn (I-1) * 0.618 ^ 3;

Find N such that | delta_n | = min (| delta_0 |, | delta_1, | delta_2 |, | delta_3 |); // n = 0, 1, 2, 3

G_guess (I + 1, J) = Gn (I) * 0.618 ^ N + delta_n * random (0.35 ~ 0.75 );

/// Random () indicates the random number generated in the range (0.35, 0.75), g_guess (I + 1, J) possible G-number submitted by player J in the I + 1 round of Prediction

}

My_gn_raw (I + 1) = sum (G (I +)/t, g (I +)/t, g (I +)/t ,..., G (I + 1, t)/t );

Ii. Think twice before your demo-

So, in the first step, I can get a preliminary G-number. According to the rule, if the I + 1 round is the first round, I should submit my_gn_raw (I + 1) * is 0.618 the best choice ?? What I want to say is: Think twice before your demo!

For details, the data you submit will also be multiplied by 0.618 when calculating the overall G-number. Therefore, the submitted data cannot be my_gn_raw (I + 1) * 0.618, there should be a correction:

Assume that the data you submit is X, and the final G-number value of the I + 1 round is my_gn_raw (I + 1) * 0.618, then X should be corrected as follows:

X = (x * 0.618 + my_gn_raw (I + 1) * 0.618 * (T-1)/T;

The above formula X is the value of G-number that I submitted in the I + 1 round game.

The above is the description of my g-number algorithm. Looking back, my idea is not very complicated, but I first rationally guessed the possible playing rules of all players. Then, I chose to multiply the difference between my prediction and the actual situation delta_n by a random factor as compensation for the estimated deviation. In the last step, I just thought about it more carefully and made a simple correction. The starting point of the algorithm is very simple and simple.

Finally, let's take a look at the changing trend of the final G-number in each round of the game we have tracked:

The Y axis is the value of G-number, and the X axis represents the number of rounds of the game.

We can see that my bold assumption is basically not too far away, although sometimes G-number will suddenly change, but because I add a delta_n compensation to each player's estimation, this makes my algorithms less affected by sudden changes. When G-number gradually converges, I think that my correction has brought me a lot of benefit.

The last thing we want to talk about is whether we live or play games. In the game process, we need to make bold and reasonable assumptions. In addition, we need to think carefully about the details. Of course, this is not always possible. Naturally, luck is also very important. After everything is done, let alone success or failure. What we need more is to carefully analyze and summarize whether my assumptions and assumptions are reasonable? Is it thoughtful enough? When you are not picky about yourself, it's just luck, so you still feel great!

Dongliang he

MSRA-USTC class

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.