Ghost Leg

Ghost Leg (Chinese: 畫鬼腳), known in Japan as Amidakuji (阿弥陀籤, "Amida lottery", so named because the paper was folded into a fan shape resembling Amida's halo[1]) or in Korea as Sadaritagi (사다리타기, literally "ladder climbing"), is a method of lottery designed to create random pairings between two sets of any number of things, as long as the number of elements in each set is the same. This is often used to distribute things among people, where the number of things distributed is the same as the number of people. For instance, chores or prizes could be assigned fairly and randomly this way.

An example of how an amidakuji can be used.

It consists of vertical lines with horizontal lines connecting two adjacent vertical lines scattered randomly along their length; the horizontal lines are called "legs". The number of vertical lines equals the number of people playing, and at the bottom of each line there is an item - a thing that will be paired with a player. The general rule for playing this game is: choose a line on the top, and follow this line downwards. When a horizontal line is encountered, follow it to get to another vertical line and continue downwards. Repeat this procedure until reaching the end of the vertical line. Then the player is given the thing written at the bottom of the line.

If the elements written above the Ghost Leg are treated as a sequence, and after the Ghost Leg is used, the same elements are written at the bottom, then the starting sequence has been transformed to another permutation. Hence, Ghost Leg can be treated as a kind of permuting operator.

Process

As an example, consider assigning roles in a play to actors.

  1. To start with, the two sets are enumerated horizontally across a board. The actors' names would go on top, and the roles on the bottom. Then, vertical lines are drawn connecting each actor with the role directly below it.
  2. The names of the actors and/or roles are then concealed so that people do not know which actor is on which line, or which role is on which line.
  3. Next, each actor adds a leg to the board. Each leg must connect two adjacent vertical lines, and must not touch any other horizontal line.
  4. Once this is done, a path is traced from top of each vertical line to the bottom. As you follow the line down, if you come across a leg, you must follow it to the adjacent vertical line on the left or right, then resume tracing down. You continue until you reach the bottom of a vertical line, and the top item you started from is now paired with the bottom item you ended on.

Another process involves creating the ladder beforehand, then concealing it. Then people take turns choosing a path to start from at the top. If no part of the amidakuji is concealed, then it is possible to fix the system so that you are guaranteed to get a certain pairing, thus defeating the idea of random chance.

Mathematics

Part of the appeal for this game is that, unlike random chance games like rock, paper, scissors, amidakuji will always create a 1:1 correspondence, and can handle arbitrary numbers of pairings. It is guaranteed that two items at the top will never have the same corresponding item at the bottom, nor will any item on the bottom ever lack a corresponding item at the top.

It also works regardless of how many horizontal lines are added. Each person could add one, two, three, or any number of lines, and the 1:1 correspondence would remain.

One way of realizing how this works is to consider the analogy of coins in cups. You have n coins in n cups, representing the items at the bottom of the amidakuji. Then, each leg that is added represents swapping the position of two adjacent cups. Thus, it is obvious that in the end there will still be n cups, and each cup will have one coin, regardless of how many swaps you perform.

Properties

Permutation

A Ghost Leg transforms an input sequence into an output sequence with the same number of elements with (possibly) different order. Thus, it can be regarded a permutation of n symbols, where n is the number of vertical lines in the Ghost Leg.,[2] hence it can be represented by the corresponding permutation matrix.

Periodicity

Applying a Ghost Leg a finite number of times to an input sequence eventually generates an output sequence identical to the original input sequence.

i.e. If M is a matrix representing a particular Ghost Leg, then Mn=I for some finite n.

Reversibility

For any Ghost Leg with matrix representation M, there exists a Ghost Leg with representation M−1, such that M M−1=I

Odd/Even property of permutation

As each leg exchanges the two neighboring elements at its ends, the number of legs indicates the odd/even permutation property of the Ghost Leg. An odd number of legs represents an odd permutation, and an even number of legs gives an even permutation.

Infinite Ghost Legs with same permutation

It is possible to express every permutation as a Ghost Leg, but the expression is not one-to-one, i.e. a particular permutation does not correspond to a unique Ghost Leg. An infinite number of Ghost Legs represents the same permutation.

Prime

As there are an infinite number of Ghost Legs representing a particular permutation, it is obvious those Ghost Legs have a kind of equivalence. Among those equivalent Ghost Legs, the one(ones) which have smallest number of legs are called Prime.

Bubble sort and highest simplicity

A Ghost Leg can be constructed arbitrarily, but such a Ghost Leg is not necessarily prime. It can be proven that only those Ghost Legs constructed by bubble sort contains the least number of legs, and hence is prime. This is equivalent to saying that bubble sort performs the minimum number of adjacent exchanges to sort a sequence.

Maximum number of legs of prime

For a permutation with n elements, the maximum number of neighbor exchanging =

In the same way, the maximum number of legs in a prime with n tracks =

Bubblization

For an arbitrary Ghost Leg, it is possible to transform it into prime by a procedure called bubblization. When bubblization operates, the following two identities are repeatedly applied in order to move and eliminate "useless" legs.

When the two identities cannot be applied any more, the ghost leg is proven to be exactly the same as the Ghost Leg constructed by bubble sort, thus bubblization can reduce Ghost Legs to primes.

Randomness

Since, as mentioned above, an odd number of legs produces an odd permutation and an even number of legs produces an even permutation, a given number of legs can produce a maximum of half the total possible permutations (less than half if the number of legs is small relative to the number of tracks, reaching half as the number of legs increases beyond a certain critical number).

If the legs are drawn randomly (for reasonable definitions of "drawn randomly"), the evenness of the distribution of permutations increases with the number of legs. If the number of legs is small relative to number of tracks, the probabilities of different attainable permutations may vary greatly; for large numbers of legs the probabilities of different attainable permutations approach equality.

The 1981 arcade game Amidar programmed by Konami and published by Stern used the same lattice as a maze. The game even took its name from Amidakuji and most of the enemy movement conformed to the lot drawing game's rules

An early Sega Master System game called Psycho Fox uses the mechanics of an Amidakuji board as a means to bet a bag of coins on a chance at a prize at the top of the screen. Later Sega Genesis games based on the same game concept DecapAttack and its Japanese predecessor "Magical Hat no Buttobi Tabo! Daibōken" follow the same game mechanics, including the Amidakuji bonus levels.

Super Mario Land 2: 6 Golden Coins features an Amidakuji-style bonus game that rewards the player with a power-up. New Super Mario Bros. and Wario: Master of Disguise feature an Amidakuji-style minigame in which the player uses the stylus to trace lines that will lead the character down the right path.

In Mario Party there is a mini game where one of the four players pours money into an Amidakuji made out of pipes. The goal is to try to choose the path leading to the character controlled by the player.

The BoSpider in Mega Man X and Maverick Hunter X descends onto the player via an Amidakuji path.

In Super Monkey Ball 2, there is a level in the Advanced-Extra difficulty named "Amida Lot" (Advanced-EX 7) that features a floor resembling an Amidakuji board, which bumper travels around the way and may knock off the player if they happen to hit them. The goal only travels through one of the vertical lines and the player must reach the goal using the ghost legs while avoiding the bumpers to not fall out.

In WarioWare, Inc.: Mega Microgames!, the microgame "Noodle Cup" features Amidakuji-style gameplay.

Azalea Gym in Pokémon HeartGold and SoulSilver was redesigned with an Amidakuji-based system of carts to cross. The correct choices lead to the gym leader; the wrong ones lead to other trainers to fight.

Phantasy Star Online 2 uses the principle of Amidakuji for a randomly appearing bomb-defusing minigame. One must trace an Amidakuji path around each bomb to determine which button defuses it; incorrect selections knock players away for a few seconds, wasting time.

In the manga Liar Game (vol 17), an Amidakuji is used for determinate the rank of each participant to the penultimate stage of the game.

In the Japanese drama Don Quixote (episode 10), the character Shirota (Shota Matsuda) uses Amidakuji to help decide between candidate families for an adoption.

In the anime Cardcaptor Sakura (episode 41), the character Kaho Mizuki, Sakura's teacher, uses Amidakuji in order to choose which student will play each role in a certain school play.

In the anime Magic Kyun Renassiance (episode 10), the characters used Amidakuji to determine which rooms they'd get while at the villa after the Art Session.

The Japanese band "SCANDAL" released "A.M.D.K.J." (January 2020) and music video— https://www.scandal-heaven.com/t14860-a-m-d-k-j-lyrics

Notes

  1. Frédéric, Louis (2002). Japan Encyclopedia. ISBN 9780674017535.
  2. Ho 2012, p.31
gollark: Not haskellishly, though.
gollark: Except easy to use, there's a curve of learning.
gollark: Rust is, actually.
gollark: https://stackoverflow.com/questions/2399544/difference-between-inheritance-and-composition#2399554
gollark: So you don't have to do much work for it.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.