Wednesday, 24 October 2012

The money market in online games

Reference: my note on classical view of money

Recently I'm playing an android app called Fantasica, what interested me is not about the RPG system or something similar, but the trading system. Besides the basic trading unit (let's call it money), there are two commodities that requires money in the real world to acquire (may drop from quests occasionally as well). Interestingly the main transaction unit is the commodities instead of money, which violates the classical view of barter economy. How can this happen?

Before we solve the above problem just revise the problem that came up with barter economy:
1)       Difficulty to quantitize its value because the value of a good is subjective, some goods like living things are hard to be divided
2)       High transaction cost, low transacted quantity
3)       Hard to meet double-coincidence of wants, that is, trader A wants trader B’s goods while trader B wants trader A’s goods. Also heterogeneity exist among goods, it may cause disagreement of the exchange.
4)       No standard of deferred payment and low durability: goods depreciates time to time so the value of goods in future is less foreseeable.

Or course the transaction unit that we're interested does not construct a barter economy. They serves as medium of trade, standard of deferred statement, bla bla bla and it's a commodity money. However commodity money still contain some of the disadvantage stated above, like the difficulty in quantitizing its value.

And now what's the difference between virtual world's economy and that of in the real world?

Monday, 15 October 2012

Counting in combinatorics I - Review in basic arithmetics

Counting is the action of finding the number of elements of a finite set of objects.

Counting is perhaps described as a pre-math skill, but is consistantly used in numerous higher fields, like linear algebra, abstract algebra, and especially combinatorics --- fitting the definition above, combinatorics emphasizes the sample spaces and targetted set. In other words, number of combinations is simply the number of elements in the targeted set.

I. the basic implication of counting

Back to what you've learnt in the kindergarden, we are turning a "situation" into a specific number, which is an elemental quantification process. If '+' is representing 'an' apple then we count '+++' --- 'an apple and an apple and an apple' --- to 3.

Sometimes we will use the concept of steps to conduct the counting --- we start from '+' which is 1, two '+'s left means 2 steps forward which is 2, and 3. The 'step approach' develops as the principle of addition in such given situations.

What can be called a suprise is that what we've learnt in kindergarden has a high coincidence with vigoruously defined arithemetic system, which relies on the Peano's arithmeitc axioms.

Another approach for counting is by defining specific finite numbers. Instead of saying '+++' is 'one more than one plus one' we 'define' it to be 'three' --- this is particular effective for finite numbers, as well as for pre-education as they don't have the concept of addition.

In a formal way to describe the above approach, we say the 'situations' (number of '+', apples, whatever) is mapped to a sequence {1,2,3,4,.....}, which is the natrual numbers.

Mapping between different spaces is one of the most important idea in mathematics: geometry (inversion), linear algebra (linear transformation), algebra (functions), statistics (distribution transformation), etc. And we use mapping again in counting.

More precisely, combinatorics, the extension of counting.

II. Principle of counting

This time I didn't aim to introduce so advanced tricks to compute hard combinatorical problem, but I'm trying to provide alternatiive views for counting-based college combinatorics problems.

How do we count?

With finite and 'small' set of elements we can count it by 'definition' of specific numbers like above, but for harder problems we need an aloairthm for it.

Denote the count of a set A be . (If you know some set theory this shouldn't be something new to you.)

The two basic principle:

Principle of addition (in combinatorics): .

Why? We start to count from A, starting from zero: 0, 1, 2, .... up to |A|. We can also count B, starting from zero again: 0, 1, 2,... up to |B|. Now, if we start to count B after A --- starting from |A|, we have |A|, |A|+1, |A|+2,... up to |A| + |B| which is our answer.

Formally, as elements repetition will be counted with its multiplicity, we assume all elements are distinct, then which leads to the above result.

I have to point out that the concept of zero appears quite frequently which is different from the natrual number system elementally ruled by the peano's axioms. This is an interesting problem to think with: As natrual numbers are used since the pre-historic era but the concept of zero appears very lately (later than negative numbers and fractions), why the concept of zero is so elemental in modern society? One of the reason is probably about the number bases creates a 'nothing' in a certain digit but the overall number represents something --- in ancient times they uses a blank to represent 'nothing' for that digit but that looks so odd and the concept of zero eventually appears.

Definition. We can 'multiply' sets (formally called cartesian product): If where A, B are sets, then C is also a set which includes:

Example. Denote the result of the first toss of a coin be and that for the second coin be the same. The result of tossing two coins is given by .

In basic arithmetic, multiplication is only a 'repetition' or 'short form' of addition (similarly, power or factorial is only a 'repetition' or 'short form' of multiplication.

Here's quite a famous quote from master rigorist, Landau's Foundation of Analysis:

'The preface for student...

4. The multiplication table will not occur in this book, not even the following theorem:
2*2 = 4
but I would recommend, as an exercise, define:
2 = 1+1
4 = ((1+1)+1)+1
then prove the theorem as an exercise...

The preface for scholar...

...I hope that I've written this book in such a way that a normal student can read it in two days. And then (since he already knows the formal rules from school) he may forget its contents."

(Interested reader should try to prove the above statement.)

Multiplication is not a necessary in arithmetic because there is addition. Similarly we transform the expression of multiplication into the basic way (addition) and our counting would work.

Principle of multiplication (in combinatorics): .

What does it imply? If A and B are sets with some elements, and C is the set of choice to choose one from A and one from B, then the resulting count is given by |A x B|.

Proof: left as exerise --- if you have no idea try to prove the theorem that Landau stated.

Up to now it seems that we are simply repeating what we're taught in schools, but starting from the basic, magic will happen soon.

Friday, 5 October 2012

The journey of Tenhou

Considering that I recognize appropiate tactics since like a month ago (with 200 plays already accumulated), the recent result sounds really good here. Different from the Canton style or Taiwan style, the result from Japanese mahjong is accounted every 2 'rounds', the points calculation and yaku patterns promotes the defensive tactics to a very large extent. Like many sports, somehow you need some luck to allow you to score in the offending side, but defending is more about determination, alertness, calculation and skill, and most people treat the Japanese styled mahjong with the highest technical level about different styles of mahjong.

Raising the rank is quite time-consuming but sometimes through playing against the public you can really know your ability throughly.

Well... it's hard to talk about them in English...

I don't think I'm good enough to deal with tactics systemetically yet, but there's one point I would like to stress with:

As an echo with the passage I written about, different games has their own index of dependence on luck and randomness, but as long as they're not completely random (an example for completely random game would be the jackpot 777 machines in casino... that's why you should never play in casino but you'll always lose as your skill isn't helping you.), through a large enough number of plays the confidence interval of ability to play can stil be distingusihable among different players. Some of the games doesn't allow a large number of plays (at least at the competition level) but mahjong isn't one of them. Through a large number of play we can have a series of statistics to deal with. One of the most significant statistic is the percentage of ranking. In a 3 -players mahjong assuming complete randomness the expected result should be like :
1: 0.333, 2: 0.333, 3: 0.333

However, as you can see above the percentage of ranking really differs quite a lot. In private multiplayer room my percentage of 1st rank is almost 50% with a large enough plays (300). If you have studied some basic statistics you will know that a hypothesis testing --- chi square test here. You can actually work out yourself, but the about statistics is showing evidence that tactics is significant to your ranking.

Despite the statistical arguement, we can also use 'existance' to support our arguement inversely. As most players know, the overall ranking depends on the pts, and sometimes the pts you lose for 3rd is more than you earn per 1st. That is, to raise your rank you have to get 1st more than 3rd in a certain ratio --- under a completely random system this is possible but the iteration expectation  length is much much longer than the entire situation. Mathematically if a point start at 0 at t = 0 and when t goes by 1 unit, the point goes left or right randomly. Then at t = k the expected maximum distance from origin is 1/sqrt(k). Similarly here: If you are going to get a net +10 ratio you expect to have 100 plays; but when the ratio of 1st:3rd is 4:3 (for most cases), the net difference required increases as number of games increases, and as a result the games required increases dramatically.

You can try this from the following Python code:

from random import random
def randomwalk(netdiff=10,trial=20,plus=1,minus=-1):
    for i in range(trial):
        x = 0
        count = 0
        while x < limit:
            a = random()
            if a < 0.5:
                x += plus
            else:
                x += minus
            count += 1
        print count
randomwalk()


Now, try randomwalk(10,20,1,-4.0/3)? What will happen?

It shows that it's nearly impossible to raise the rank under completely random system, and that's why we need tactics, we need to defense to avoid getting the third, and this is how 'gambling' stuffs can be 'scientific'.

There are far more stuffs in mahjong involves statistical analysis or even probability calculation, and I think more of them will come soon.