[PYTHON] Let's investigate the mechanism of Kaiji's cee-loline

During the period of self-restraint

I was worried because I could read various past works with the free manga app.

This is the gambling Cee-loline that appeared in the manga Kaiji.

Kaiji

A series of manga works by Nobuyuki Hon, and animations and live-action movies based on them.

Originally a bad human being, he demonstrates extraordinary courage and talent when placed in an extreme state of crisis. The main character, Kaiji Ito, is a manga here.

Currently, the following 5 + 1 volumes have been published. In addition, as spin-off works, there are "Middle management Tonegawa" and "1 day outing Hanchou".

Gaming Apocalypse Kaiji (1996-1999 Weekly Young Magazine, 13 volumes) Gaming Haunting Record Kaiji (2000-2004 Weekly Young Magazine, 13 volumes) Gaming Fallen Angel Kaiji (2004-2008 Weekly Young Magazine, 13 volumes) Gambling Fallen Angel Kazuya Kaiji (2009-2012 Weekly Young Magazine, 10 volumes) Gaming Fallen Record Kaiji One Poker Edition (2012-2017 Weekly Young Magazine, 16 volumes) Gaming Fallen Record Kaiji 2.4 Billion Escape Edition (2017-serialized, 6 volumes already published)

It is a work that deals with the basic gambling theme.

Cee-loline

In the manga, it is the gambling that appears in Chapter 3 Desire Swamp.

This is the gambling that Otsuki has brought to us as a recreation in the underground forced labor facility.

rule

Roll 3 dice at the same time until the roles are complete (up to 3 times)

Put the dice in a bowl, turn it upside down, place it on the ground, and take the bowl to determine the outcome.

The roles are as follows in order of strength.

Role name conditions
Pinzolo 1 ・ 1 ・ 1
Doublet 2.2.2,3.3.3,4 ・ 4 ・ 4,5 ・ 5 ・ 5,6/6/6
Shigoro 4 ・ 5 ・ 6
Largest order Two are the same, the number of one remaining
Pee If there was no role,When the dice come out of the bowl
Hifumi 1, 2, 3

There are refund rules in the manga, but this time I will omit them. We will simply consider the probability that a role will come out.

First, let's consider a function that determines the role. The role is to create a function that returns the strongest Pinzolo in the order of 1 and then the strongest. In addition, we do not think about reassignment here, and if they are not aligned, we will treat it as if there is no role. It should be noted that getting doublet is the same strength no matter which one comes out.

def tintiro_hand(h):
    #Pinzolo
    if all([h[0]==1,h[1]==1,h[2]==1]):
        return 1
    #Doublet
    if h[0]==h[1] and h[1]==h[2]:
        return 2
    #Shigoro
    if [4,5,6]==list(sorted(h)):
        return 3
        #Hifumi
    if [1,2,3]==list(sorted(h)):
        return 11
    #Die and piss
    calc = {}
    for n in h:
        if n in calc:
            calc[n]+= 1
        else:
            calc[n]=1
    if 2 in calc.values():
        return 3 + 7-sorted(calc.items(),key=lambda x:x[1])[0][0]
    else:
        return 10

def judge(h1,h_2):
    if h1==h_2:
        return 'DRAW'
    if h1<h_2:
        return 'WIN'
    else:
        return 'LOSE'

We will also create a function to determine the outcome.

Win or lose when fighting between the same dice

import itertools
from fractions import Fraction

hands1 = list(itertools.product([1,2,3,4,5,6],repeat=3))
hands2 = list(itertools.product([1,2,3,4,5,6],repeat=3))
wins = {}
for hand1 in hands1:
    for hand2 in hands2:
        w = judge(tintiro_hand(hand1),tintiro_hand(hand2))
        if w in wins:
            wins[w] +=1
        else:
            wins[w] = 1
total = sum(wins.values())
draw,win,lose =wins['DRAW'],wins['WIN'],wins['LOSE']
print('DRAW\t' , Fraction(draw,total) , ' \t{:%}'.format(draw/total))
print('WIN \t'    , Fraction(win ,total)  , '\t{:%}'.format(win/total))
print('LOSE\t'   , Fraction(lose,total)  , '\t{:%}'.format(lose/total))
DRAW 1639/5832 28.10%
WIN 4193/11664 35.95%
LOSE 4193/11664 35.95%

The odds of winning or losing are the same. Well, it's natural.

Win or lose when confronting Shigoro Samurai

** Shigoro 賽 **

It is a dice used by Team Leader Otsuki with only 4,5,6 eyes.

image.png

Since the back side of 4 is the same number as 4, when viewed from one direction There is a feature that you do not notice.

How does this change your winning percentage? I will try to compete with ordinary dice.

import itertools
from fractions import Fraction

hands1 = list(itertools.product([1,2,3,4,5,6],repeat=3))
hands2 = list(itertools.product([4,5,6,4,5,6],repeat=3))
wins = {}
for hand1 in hands1:
    for hand2 in hands2:
        w = judge(tintiro_hand(hand1),tintiro_hand(hand2))
        if w in wins:
            wins[w] +=1
        else:
            wins[w] = 1
total = sum(wins.values())
draw,win,lose =wins['DRAW'],wins['WIN'],wins['LOSE']
print('DRAW\t' , Fraction(draw,total) , '\t{:%}'.format(draw/total))
print('WIN \t' , Fraction(win ,total) , '\t{:%}'.format(win/total))
print('LOSE\t' , Fraction(lose,total) , '  \t{:%}'.format(lose/total))
DRAW 107/1944 5.50%
WIN 175/1944 9.00%
LOSE 277/324 85.49%

With the same probability of winning or losing, you will lose 50% more. It's a nice dice.

What is the probability of a role?

The probability of getting a role is that the combination of dice is 216 ways ($ 6 ^ 3 $), so this is the denominator.

Looking at the probability of a role on each dice

import itertools
import matplotlib.pyplot as plt
%matplotlib inline

hands1 = list(itertools.product([1,2,3,4,5,6],repeat=3))
hands = {}
for hand1 in hands1:
    h = tintiro_hand(hand1)
    if h in hands:
        hands[h] +=1
    else:
        hands[h] = 1

plt.figure(figsize=(12,6))
x = [k for k,v in sorted(hands.items())]
y = [v for k,v in sorted(hands.items())]
for x1,y1 in zip(x,y):
    plt.text(x1, y1+1 , y1 , size = 10, color = "green")
    plt.text(x1, y1+10 , '{:.01%}'.format(y1/216), size = 10, color = "black")
label = ['111','Doublet','Shigoro','6','5','4','3','2','1','Pee','123']
plt.bar(x,y,tick_label=label)
plt.grid()
plt.show()

image.png

If it is confirmed without considering re-rolling three times, the role that appears most is no role (pee). So I think it's a rule to re-roll three times.

There is only one pinzolo. There are 6 types of the weakest 123.

What if this is Shigoro Sagami?

import itertools
import matplotlib.pyplot as plt
%matplotlib inline

hands = list(itertools.product([4,5,6,4,5,6],repeat=3))
hands2 = {i:0 for i in range(1,12)}
for hand in hands:
    h2 = tintiro_hand(hand)
    if h2 in hands2:
        hands2[h2] +=1
    else:
        hands2[h2] = 1

plt.figure(figsize=(12,6))
x = [k for k,v in sorted(hands2.items())]
y = [v for k,v in sorted(hands2.items())]
for x1,y1 in zip(x,y):
    plt.text(x1, y1+1 , y1 , size = 10, color = "green")
    plt.text(x1, y1+10 , '{:.01%}'.format(y1/216), size = 10, color = "black")
label = ['111','Doublet','Shigoro','6','5','4','3','2','1','Pee','123']
plt.bar(x,y,tick_label=label)
plt.grid()
plt.show()

image.png

It's overwhelming.

It is obvious when you compare them. スクリーンショット 2020-05-23 17.10.35.png

If it is Shigoro Sai, there will be no uselessness and at least 4 will come out. The probability of getting doublet is less than 5 times, and the probability of shigoro is 8 times.

In the case of manga, the payment of 111 is increased and the payment of 456 is slightly weakened, and it is camouflaged. I'm planning various things and the rules are interesting.

How to find squid

It was the record of the dice that my colleague Miyoshi kept that I found out the mechanism of this Ikasama dice.

I noticed that there are a lot of 456s only when the team leader is the best game here. You will be suspicious of the existence of the Ikasama dice.

With a normal dice, the probability of 456 is less than 3%, so you will only get 2-3 times in 100 times. The more you continue, the more the probability will converge and you should get closer to the original probability. If you keep collecting data thousands of times, you may notice that the probability is strange.

It is important to acquire daily data and notice the probability.

Summary

After all, you can see that statistics and probabilities are once again important for winning gambling.

If a public institution starts to hold Cee-loline due to IR Ikasama who went like this may be popular, and I'd like to look forward to that time.

Author information

Otsu py's HP: http://www.otupy.net/

Youtube: https://www.youtube.com/channel/UCaT7xpeq8n1G_HcJKKSOXMw

Twitter: https://twitter.com/otupython

Recommended Posts

Let's investigate the mechanism of Kaiji's cee-loline
I investigated the mechanism of flask-login!
Let's decide the winner of bingo
Investigate the effect of outliers on correlation
Let's claim the possibility of pyenv-virtualenv in 2021
Let's summarize the construction of NFS server
Let's use the API of the official statistics counter (e-Stat)
Let's clear the ambiguity of the hyphen (-) of the su command now! !!
[Statistics] Understand the mechanism of Q-Q plot by animation.
Let's break down the basics of TensorFlow Python code
Let's use the Python version of the Confluence API module.
Let's use the open data of "Mamebus" in Python
Let's test the medical collapse hypothesis of the new coronavirus
Let's analyze the emotions of Tweet using Chainer (2nd)
Let's analyze the sentiment of Tweet using Chainer (1st)
[Python] Let's change the URL of the Django administrator site
The beginning of cif2cell
The meaning of self
the zen of Python
The story of sys.path.append ()
Revenge of the Types: Revenge of types
Let's cross the wall of the left-handed coordinate system and the right-handed coordinate system.
Let's decide the lecture of PyCon JP 2016 by combinatorial optimization
Let's visualize the trading volume of TSE stocks --jpxlab sample
Let's utilize the railway data of national land numerical information
Let's make the analysis of the Titanic sinking data like that
Let's execute the command on time with the bot of discord
Let's touch the API of Netatmo Weather Station with Python. #Python #Netatmo
Let's predict the timing of the bals and enjoy the movie slowly
Decoding experiment of the mechanism of public electric wiretapping by CIA
Let's visualize the number of people infected with coronavirus with matplotlib
Let's use the distributed expression of words quickly with fastText!
Play with the password mechanism of GitHub Webhook and Python