Dead Wall Question

Japanese Reach Mahjong Rules. Strategy, news, sets - anything!

Moderator: Shirluban

Post Reply
User avatar
Gamegrunt
Senior Reacher
Senior Reacher
Posts: 125
Joined: Thu Oct 22, 2009 2:20 am
Location: Grand Prairie, TX

Dead Wall Question

Post by Gamegrunt » Thu Nov 12, 2009 12:25 pm

My question has to do with where the tiles are removed from the kan wall and how and when they are replaced. I understand that the 14 tiles to the right of where the wall is broken is defined as the kan (dead) wall, and the top tile in the third row from the left (the very end of the wall both live and dead) is flipped and becomes the dora.

In some videos I have seen the kan replacements are taken from the end of the wall (one of the four tiles to the left of the dora) which makes sense - if the fourth of these tiles is taken as replacements the round ends in a draw. There must always be fourteen tiles in the dead wall so as they are taken they are replaced? In the Chinese game the \"roof\" tiles are replaced from the end of the live wall and become roof tiles themselves. I am uncertain as to mechanism for the taking of replacements and the replenishment of the dead wall.

What am I missing?

Gg

User avatar
chalwa
Senior Reacher
Senior Reacher
Posts: 132
Joined: Sat Jan 17, 2009 10:01 am
Location: Poland, Warsaw
Contact:

Re:Dead Wall Question

Post by chalwa » Thu Nov 12, 2009 1:18 pm

You dont have to physically add tiles to dead wall. You just have to end game X tiles earlier where X is number of kan\'s made. So if there was one kan, the last tile you take is the one at the top of the last column, not the bottom one. When there are two kan\'s you can move the last column to the dead wall, but you dont have to, just end game not taking those two tiles from end of living wall.

User avatar
Gamegrunt
Senior Reacher
Senior Reacher
Posts: 125
Joined: Thu Oct 22, 2009 2:20 am
Location: Grand Prairie, TX

Re:Dead Wall Question

Post by Gamegrunt » Thu Nov 12, 2009 1:34 pm

chalwa wrote:You dont have to physically add tiles to dead wall. You just have to end game X tiles earlier where X is number of kan\'s made. So if there was one kan, the last tile you take is the one at the top of the last column, not the bottom one. When there are two kan\'s you can move the last column to the dead wall, but you dont have to, just end game not taking those two tiles from end of living wall.
So the kan replacements are taken from the end (left of the dora). I note that it is often the case that the top of the last row (right of where the wall is broken) is sometimes set down so that essentially the dead wall would be 8 rows. The idea that the dead wall is understood to consist of the last 14 tiles and when they are all that remain the round ends whether or not there is a physical separation between the living and dead walls.

Gg

User avatar
Shirluban
Moderator
Moderator
Posts: 780
Joined: Thu Jan 22, 2009 1:53 pm
Location: Svartalfheim
Contact:

Re:Dead Wall Question

Post by Shirluban » Thu Nov 12, 2009 8:16 pm

Gamegrunt wrote:I note that it is often the case that the top of the last row (right of where the wall is broken) is sometimes set down so that essentially the dead wall would be 8 rows.
It should be the bottom of the last row and not the top.

The dead wall always have 14 tiles, always.
And it\'s always the last 14 tiles of the whole wall.

You can physically separate these 14 tiles from the living wall, or let them together, as you please.
IMHO, making a gap between the dead and the live wall is better. So you see at a glance where the live wall ends. (I believe most people do this.)



PS: "Birds Rule and Cats Drool!" Beware of what you say, we surround you!
Cats don't do タンヤオ (tan-yao) but タニャーオ (ta-nya-o).
World Riichi Championship Rules 2022
Comparison of riichi rules around the world

Robert
Junior Reacher
Junior Reacher
Posts: 88
Joined: Mon Feb 02, 2009 8:59 pm

Re:Dead Wall Question

Post by Robert » Thu Nov 12, 2009 9:48 pm

I believe that house rules govern this.

Try playing on tenhou.net. On their interface, you can actually \"see\" the wall and how it is done. When someone declares kan, the dead wall does indeed shrink -- and the game continues until either someone wins or all tiles other than those in the dead wall are exhausted.

On toupai-ou, I have noticed something different. The wall is not shown (except for the part with the dora indicators), but the count of tiles remaining is shown. When someone draws an extra tile for kan, this count goes down, meaning that the rules used are different from those on tenhou.

User avatar
chalwa
Senior Reacher
Senior Reacher
Posts: 132
Joined: Sat Jan 17, 2009 10:01 am
Location: Poland, Warsaw
Contact:

Re:Dead Wall Question

Post by chalwa » Thu Nov 12, 2009 10:16 pm

I think rules on tenhou and toupai-ou are the same. The difference is just in visualization. On tenhou there is little break where the dead wall ends after tiles are divided, but games end when there are only 14 tiles left - if there was kan made, there are tiles left after this gap between dead and living wall.
On toupai-ou tiles are not shown, but idea still is the same (I think), after you make kan you make one tile less in game so its natural number of tiles will be lowered. Case is rather it gives you tile from living wall, or dead wall (both program must have \"in memory\" ), and I\'m pretty sure it gives tile from not visible part of dead wall.

Robert
Junior Reacher
Junior Reacher
Posts: 88
Joined: Mon Feb 02, 2009 8:59 pm

Re:Dead Wall Question

Post by Robert » Thu Nov 12, 2009 10:21 pm

What makes you think it keeps track of the \"living wall\" and the \"dead wall\" separately? Rather, more likely it just draws tiles as needed, as in Washizu mahjong.

Poochy
Senior Reacher
Senior Reacher
Posts: 106
Joined: Sun Feb 08, 2009 5:10 am

Re:Dead Wall Question

Post by Poochy » Sat Nov 14, 2009 3:32 am

From a computer science standpoint, generating the full wall first would be far preferable to rolling for the next tile every time a tile is drawn. It actually takes a considerable amount of processing to generate a random number in a way such that all possibilities are equally likely. For example, many computer pseudorandom number generators simply spit out a series of binary digits*, which means the base algorithm and has a lower bound of 0 and an upper bound of 2^n-1, where n is the number of bits you tell it to spit out. This means that depending on the value of n specified, the algorithm can only roll numbers in ranges such as 0 to 127, 0 to 255, 0 to 511, 0 to 1023, etc. To get other ranges requires modular arithmetic. For example, lets say you had an algorithm that generates random numbers from 0 to 255, and you want a random number from 0 to 6. You\'d have to take the result of the roll, divide it by 7, and take the remainder for a number from 0 to 6. But notice that 255 isn\'t a multiple of 7. Thus the possibility of 252, 253, 254, and 255 will make the final result happen to be 0, 1, 2, or 3 slightly more often than 4, 5, or 6. So instead, you have to check if the first result is greater than or equal to 252, and re-roll if it is, check again, and so on. Now imagine doing this first for a number from 0 to 135 (for the 136 total tiles in the wall), then one from 0 to 134, and so on, potentially down to one from 0 to 14 (for the haitei tile). Not to mention the whole time, you\'d have to maintain a list of all tiles that haven\'t been drawn yet, another programming pain in the butt because of how many times you\'d have to search through the whole list (to remove a tile) or count through the list (if you just mark tiles \"used\", and deal the nth unused tile where n is the number rolled), among other problems.

*Note: For those of you who don\'t know binary, using a sequence of random binary digits is equivalent to:
1. Start with 0.
2. Multiply your number by 2.
3. Flip a fair coin. If heads, add 1.
4. Repeat steps 2 and 3 a total of n times.
Notice that the maximum number produced by this is with all heads, which yields 2^n-1, and the minimum is 0 if you get all tails. Each number in between has exactly one sequence of heads/tails flips that will yield it; I\'ll leave it up to you to verify that for yourself. Or just ask me later.

A much better solution would be to roll a random number with a large range for every tile. Then sort the tiles in order by the random numbers they were assigned, breaking ties by making sublists of any ties and doing tiebreaker rolls to shuffle the sublist. Of course, this means the wall would be predetermined.

Short answer: From a computer science standpoint, shuffling the wall in advance and reading from the saved shuffle result is far more efficient.

Also, this article claims that Tenhou generates the wall at the start.

User avatar
Shirluban
Moderator
Moderator
Posts: 780
Joined: Thu Jan 22, 2009 1:53 pm
Location: Svartalfheim
Contact:

Pseudo-random number generator

Post by Shirluban » Sat Nov 14, 2009 10:22 am

About (pseudo)random number generators:
(Maybe over-technically).

The language C pseudo-random number generator gives numbers from 0 to 32767. Each is equiprobable.
When you reduce this to a lower range (like 0-143) the final probabilities becomes slightly uneven. For general purpose, like games, the difference is enough small to don\'t worry about.
For scientific study or cryptography this can be a serious problem.

Pseudo-RNG have an other problem : the numbers always show up in the same order.
This is why it\'s not a true-random number generator.
As long you don\'t use the raw numbers (0 to 32767), and need only a lower range (0-143), the predictable aspect disappear. It is still here, but you can\'t see it thru the final values.

The main interest of this \"order\" is to recreate the whole series by just re-initializing the RNG with the initial seed.
Think about this when a video game allows you the replay a game by just giving a 5-digit number : it\'s the RNG seed.
Again, it\'s ok for general purpose, but can be a big problem for high precision tasks. If someone get the seed and know how the raw values are converted into final values, i.e. tiles, he can predict the whole wall and players hand.

www.osamuko.com
In the past you could get the seed by observing your own games, and thus predict what everybody would draw. Fortunately Tenhou fixed that bug, but it proves tile order in the walls doesn\'t change during the game.

You probably wonder why computers don\'t use real-random number generator.
Expect manually throwing a new casino dice, or looking at some quantic atom properties, there is not many real-random events.
Cats don't do タンヤオ (tan-yao) but タニャーオ (ta-nya-o).
World Riichi Championship Rules 2022
Comparison of riichi rules around the world

Mcgreag
Fresh Reacher
Fresh Reacher
Posts: 32
Joined: Sun Jul 05, 2009 10:56 am
Location: Sweden

Re:Pseudo-random number generator

Post by Mcgreag » Sat Nov 14, 2009 11:42 am

There is that guy a GamesByEmail.com that built a dice throwing machine that does 1.3 milion throws per day.

http://gamesbyemail.com/News/DiceOMatic

But a good computerized random numbers generator would provide a better randomness than that.

User avatar
Shirluban
Moderator
Moderator
Posts: 780
Joined: Thu Jan 22, 2009 1:53 pm
Location: Svartalfheim
Contact:

Re:Pseudo-random number generator

Post by Shirluban » Sat Nov 14, 2009 9:09 pm

You mean \"1.3 million rolls a day\".

It\'s amazing!

I really appreciate the irony in the title \"May thy dice chip and shatter\". It\'s exactly what I expect them to do!
Letting aside the fact these dice are not equiprobable in the first place, a such rough treatment should damage them quickly, altering the probabilities.
I hope he frequently feeds his machine with fresh dice.

He claims that \"the rolls you get are exactly as random as those you would get throwing by hand\", so he didn\'t intent to have a true-random number generator.
Cats don't do タンヤオ (tan-yao) but タニャーオ (ta-nya-o).
World Riichi Championship Rules 2022
Comparison of riichi rules around the world

drob
Fresh Reacher
Fresh Reacher
Posts: 5
Joined: Sat Sep 19, 2009 7:06 pm

Re:Pseudo-random number generator

Post by drob » Sun Nov 15, 2009 8:53 am

>Expect manually throwing a new casino dice, or looking at some quantic atom properties, there is not many real-random events.

Atmospheric noise, shot noise, thermal noise, electronic noise and radioactive decay comes to mind quite readily.

Poochy
Senior Reacher
Senior Reacher
Posts: 106
Joined: Sun Feb 08, 2009 5:10 am

Re:Pseudo-random number generator

Post by Poochy » Mon Nov 16, 2009 1:49 am

I think Shirluban\'s main point is, there aren\'t many truly random events that can be conveniently used in everyday activities. Try making a Mahjong game that shuffles the tiles based on radioactive decay or random noise, and without breaking the bank for specialized hardware. (And no using Random.org\'s algorithms based on atmospheric noise, either. That\'s cheating.) Though it\'s not impossible, it\'s way too much trouble to be worth it.

Robert
Junior Reacher
Junior Reacher
Posts: 88
Joined: Mon Feb 02, 2009 8:59 pm

Re:Pseudo-random number generator

Post by Robert » Tue Dec 22, 2009 11:47 pm

Mcgreag wrote:There is that guy a GamesByEmail.com that built a dice throwing machine that does 1.3 milion throws per day.

http://gamesbyemail.com/News/DiceOMatic

But a good computerized random numbers generator would provide a better randomness than that.
Even better: use the die rolls to seed a good PRNG.

Post Reply