The way of the sky, the loss is more than enough to make up for the deficiency; the way of man, the loss is more than the benefit

I think of a book "Does God Throw Dice?" I read in college. I
remember a story metaphor in it.

The two gamblers A and B have a total of 100 coins.
At first, A has 50, and B has 50
winning or losing rules: for example, A has 80 and B has 20. Then B has an 80% winning rate and A has a 20% winning rate.
Whoever wins once will get 1 coin from the opponent's hand.
As the gambling progresses...this causes the two to exist for a long time, and no one loses quickly.

1. The way of the sky, more than damage but not enough

I wanted to write a program for verification a long time ago. I happened to catch up with the epidemic, and
I was at home~ I attributed the winning rate to the number of coins in my hand. Every round of gambling, a random number is issued, and the number is within the number of coins of A (A wins). A gives B a coin (the winner gives the loser)
I made the following simplification:

A lot of coins have a low winning rate----->the coin is used as a proof of winning rate. The
winner has a lower winning rate----->the winner gives the loser a coin

#include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std;

int abs(int num)//取绝对值
{
    
    
	if (num < 0) num = -1*num;
	return num;
}

int main()
{
    
    
	srand((unsigned int)time(NULL));
	int zeroTOhundred=-1;
	int a=50, b=50;//a=1~50;b=50~100;
	int sum = 0;
	cout << a <<" "<< b << endl;
	for (;;sum++)
	{
    
    
		zeroTOhundred = abs(rand() % 100);//1-100
		cout << "a:" << a << "  b:" << b << "  赌局结果:" << zeroTOhundred << endl;
		//赌局结果在谁的范围内【谁币多算谁赢】
		//结果在b的范围内,a从b取出1个硬币【赢了的输钱减胜率】
		if (zeroTOhundred > a) {
    
    
			a++;
			b--;
		}
		//结果在a的范围内
		else {
    
    
			a--;
			b++;
		}

		if (a == 0 || b == 0) break;//一方输光,赌局结束
	}

	cout << sum << endl;
	return 0;
}

The theoretical possible number of steps is [50,+∞).
Running the above code... It is difficult to exit the loop, a (also represents that the other party is in the range of (40, 60)) has been in the range of (40, 60). It is difficult to get to a certain party to lose all the money, let alone lose all.

2. The way of people, the loss is insufficient and the gain is more than

I saw Li Yongle’s video a few days ago [How can I get rid of poverty? What is the difference between the poor and the rich? [Interpretation of the Nobel Prize in Economics]: https://www.bilibili.com/video/av74644387 to
contact this sentence in "Does God Roll the Dice" and "Tao De Jing" to write this blog is also triggered by this video Inspiration.

At the end of the talk, a curve of the survey results is given, from the midpoint of k/2 similar to the logistic curve, approaching to both sides
. The content in the video is roughly that the
poor will consume as soon as they have a little money, and they don’t have money to consume. It can’t be consumed at that time.
The consumption of the rich will not occupy much of his property, and it will be restored soon.
Insert picture description here

——To sum up my words, the more fault-tolerant the better

Reverse the winning rules of the previous code (change the greater than sign to less than or equal sign, and the comment...), it is the following code:

#include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std;

int abs(int num)//取绝对值
{
    
    
	if (num < 0) num = -1*num;
	return num;
}

int main()
{
    
    
	srand((unsigned int)time(NULL));
	int zeroTOhundred=-1;
	int a=50, b=50;//a=1~50;b=50~100;
	int sum = 0;
	cout << a <<" "<< b << endl;
	for (;;sum++)
	{
    
    
		zeroTOhundred = abs(rand() % 100);//1-100
		cout << "a:" << a << "  b:" << b << "  赌局结果:" << zeroTOhundred << endl;
		//赌局结果在谁的范围内【谁币多算谁赢】
		//结果在a的范围内,a从b取出1个硬币【赢了的拿钱加胜率】
		if (zeroTOhundred <= a) {
    
    
			a++;
			b--;
		}
		//结果在a的范围内
		else {
    
    
			a--;
			b++;
		}

		if (a == 0 || b == 0) break;//一方输光,赌局结束
	}

	cout << sum << endl;
	return 0;
}

The theoretical possible number of steps is [50,+∞).
Run the above code... I tried it a dozen times, mainly in the range of 90+ rounds to 200- rounds, only 2 times over 200 rounds, it can be seen that "the loss is insufficient and the gain is more than the gain" cannot last long.
Insert picture description here

Guess you like

Origin blog.csdn.net/sinat_27382047/article/details/104185040